2017,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

繰り返しますが、私は、テロリストの思想を理解できないし、これからも理解するつもりもありません。

Again, I can not understand the thought of terrorists and I do not intend to understand from now on.

しかし、これらのことから学ぶべきことは、あると思っています。

However, I think there is something to learn from these things.

(その1)

(Part 1)

訳の分からない思想や行動を取るテロリストや国家元首は存在する。そのような思想や行動を理解する試みは、概ね無駄に終わる。

There are terrorists and heads of state who take thoughts and actions unknown to their translation. Attempts to understand such ideas and behaviors are largely in vain.

(その2)

(Part 2)

たった10人にも満たないテロリストによって、世界中から、日本国民全員がテロリスト同然に見られていたという時代があった。

There was a period when all the Japanese citizens had been seen as terrorists from all over the world by the Japanese terrorists less than 10 people.

ということです。

-----

憎むべきは、そして、報復すべき対象は、テロリストです。

The object to be hatred, retaliated is a terrorist.

罪を憎んで人を憎まず ―― などという諺(ことわざ)は、私には分かりません。

"hate the sin, but don't hate the person" .... I do not know the proverb.

「人」を憎んで「人」を憎み倒す ―― これが私の基本ポリシーです。

I hate 'people' and hate and hate 'people' - this is my basic policy.

-----

その憎悪や報復の対象を、組織や民族や宗教や思想にまで拡大することは、

Expanding the object of hatred and retaliation to organizations, ethnic groups, religion and thought,

弱くて、勉強不足で、きちんと調べる手間暇すらも行わない怠け者で、卑怯者であるとすら ―― 私には思えます。

I think that such a person is weak, lazy, lack of study, and coward.

憎むべきは、とことん「人」「人」、そして「人」であり、そして、自分の人生をかけて、その「人」に向けて、きっちり報復を果たすべきです。

The most hateful thing is the "person" "person" and "person", and, we should fulfill retaliation exactly for that "person" by spending your own life.

-----

ちなみに、私闘は、法律違反(明治22年制定 (決闘罪ニ関スル件))です。

By the way, private fight is against the law (established Meiji 22 (battle crimes)).

2017,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

その中でも、特に、私がショックを受けたのが、

Among them, especially what I was shocked is

●テルアビブ空港乱射事件

- Tel Aviv Airport Shooting case

1972年、3人の日本人テロリストが、イスラエルのテルアビブのロット空港で、ターミナルで自動小銃を乱射。

In 1972, three Japanese terrorists shot automatic rifles at the terminal at Tel Aviv 's Lot Airport in Israel.

ターミナルにいた民間人24人を殺害、100人以上に重軽傷を与える。

they killed 24 civilians who were at the terminal, give injuries to over 100 people.

●ダッカ日航機ハイジャック事件

- Dhaka JAL Hijack case

日本国内で服役および勾留中のテロリスト9名の釈放と、16億円を要求したハイジャック事件。

A hijack case that the criminal requested the release of nine terrorists who were serving and detained in Japan and 1.6 billion yen.

日本国政府は「超法的措置」を発令して、テロリストの釈放に応じる。

The Government of Japan issued "super legal measures" and responded to the release of terrorists.

です。

私には、どういう脳の回路が『無関係の民間人を殺害して、革命を成就させる』という、たわけた思想を生み出せるのか分かりませんし、今後も分かる努力をする予定はありません。

I do not know what kinds of brain circuit can create a foolish idea of "killing irrelevant civilians and fulfilling the revolution", and there is no plan to make an effort to understand in the future.

-----

私、この週末に、「超法的措置」の法的根拠を、かなり真剣に探しました ―― 当然、そんなものはないのですが(あったら、法治主義国家の自己否定になる)、

I searched quite seriously the legal basis of "super legal measures" this weekend, of course, there is not such a thing (if it is, it becomes self-denial of a legalist state),

「行政の権利の濫用」を根拠として、誰かが訴えを行って(テロの被害者の遺族なら、訴権はあるでしょう)、最高裁が「違憲ではない」という判断をしている―― とかいうような、判決文を探していましたが、残念ながら、見つけられていません。

Based on the "abuse of administrative rights", if someone gets a lawsuit (if they were bereaved of the victims of terrorism, there would have a right of it), the Supreme Court is making a judgment that it is not "unconstitutional". I was looking for a sentence like that, but unfortunately I have not found it.

(私の探しかたが甘いのかもしれませんので、ご存知の方は、私に教えて下さい)

(If you know, please let me know)

(続く)

(To be continued)

2017,江端さんの忘備録

今、世界では、「狂ったイスラム教原理主義者」(×イスラム原理主義者、×イスラム教徒)によるテロが世界中を騒がせていますが、

Today, in the world terrorism by "Crazy Muslim fundamentalists" (Neither Islamic fundamentalists nor Muslims) is making noise around the world,

かつて、それに匹敵するような ―― 場合によっては、それすらも超えるような

Once that was equal to them, In some cases, it seems to exceed

我が国(日本)の国際テロ組織が、世界中の人々から恐れられていた時代があります。

The international terrorist organizations of Japan (Japan) have been feared by people all over the world.

「日本赤軍」というテロリスト集団です。

It was a terrorist group "Japan Red Army".

●ドバイ日航機ハイジャック事件

- Dubai Nikko Machine Hijacking case

●シンガポール事件

- Singapore case

●在クウェート日本大使館占拠事件

- Embassy occupied case in Kuwait in Japan

●ハーグ事件

- Hague case

●クアラルンプール事件

- Kuala Lumpur case

●ジャカルタ事件

- Jakarta case

●三井物産マニラ支店長誘拐事件

-Mitsui & Co. Manila Branch Chief Kidnapping case

とまあ、世界中で無差別殺害を含む事件を立て続けに起こしてきました。

They had been raising cases involving indiscriminate murders in rapid succession all over the world.

そりゃ、1回や2回ならともあれ、これだけ年がら年中テロを行っていれば、

Well, if it was just one or two times, as long as they were carrying out terrorism all the year round,

世界の人から、

From the people of the world, it could not be helped that

「日本人って、みんな、あんな感じ(テロリスト)なのか?」

"Are Japanese people like that terrorists?"

と思われても仕方がない、という状況にあったのです。

It was inevitable.

このように、日本人が、世界中から恐怖の対象と見なされていた時代があったのですよ(本当)。

In this way, there was a time when Japanese people were regarded as subjects of terror from the world (true).

(続く)

(To be continued)

2023,江端さんの忘備録

嫁さんが、義母の介護の為に、一週間ほど帰省しています。

My wife is returning home for a week to care for my mother-in-law.

という訳で、当然ながら、普段、嫁さんがやってくれている家事を、自分でやっています。

So, naturally, I am doing the housework that my wife usually does for me.

-----

ところで、私、海外出張をする時も、服は下着3セットを基準に、荷物を最小限にして、荷物は機内持ち込みのみにしています。

By the way, when I go on overseas business trips, I also minimize my luggage based on three sets of underwear as my standard of clothing, and only carry-on luggage.

ロストバゲージが怖いからです。

Because I am afraid of lost baggage.

海外旅行時の、私の下着の洗濯は、極めて簡単です。

When traveling abroad, washing my underwear is extremely easy.

下着を湯船に突っ込んで、下着と一緒に入浴します。

Plunge my underwear into the bathtub and take a bath together with my underwear.

でもって、下着を石鹸で洗います ―― そんでもって、下着で、体を洗っています。

And then I wash my underwear with soap -- and then I wash my body with my underwear.

下着と私のどちらが汚れているかと言われれば、私の体の方に決っていますので、これは合理的なWin-Winと言えます。

If you ask whichi is dirtier, my underwear or me, it is my body, so this is a reasonable win-win.

あとは、下着を絞って、浴槽または部屋に干しておけば終了です。

Then, wring out the underwear and hang them in the bathtub or room to dry. That's all.

2日間も干しておけば、下着は乾きます。

After two days of drying, the underwear will be dry.

ゆえに、下着は3セットあれば十分なのです。

Hence, three sets of underwear are sufficient.

これは、余計な水も使わず、最短時間で行える『SDGs的洗濯』です。

This is "SDG-style laundry" that can be done in the shortest amount of time without using extra water.

-----

この他、

In addition to the above,

- 腐りそうになった食材は、すべてカレーに突っ込んで食べ切る

- All ingredients that are about to go bad are plunged into the curry and eaten up.

- 三角コーナーの生ゴミは、冷凍庫に凍らせておき、纏めてゴミの日に出す

- Freeze food scraps in the freezer and put them out on garbage day.

など、各種のノウハウがあります。

Various types of expertise, such as above.

これは、6年間の学生時代の下宿生活で取得したものです。

These were acquired during six years of student boarding and lodging.

-----

嫁さんと私の間には、娘との結婚を希望する者(性別を問わず)に対して一つの暗黙的ルールがあります。

My wife and I have one unspoken rule for anyone (regardless of gender) who wishes to marry our daughter.

『一人暮らしを、ちゃんと成立させてきた実績があること』です。

The first is "to have a proven track record of establishing a one-person household".

自立して生活もできんような生活無能力者に、娘を渡せない ―― と思っていたのですが、最近、驚愕の事実を知りました。

We thought, "we can't give my daughter to a person who is incapable of living independently," but recently I learned a startling fact.

何年も一人暮らしをしているのにも関わらず、自炊一つできない奴(男)がいたことを知りました。

I learned that there was a guy (man) who lived alone for years but could not cook a single meal for himself.

彼は『鳥と豚と牛の肉の違いも分からん』と無邪気に語っていましたが ―― はっきりいって、それ『マザコン』や『ロリコン』以上にヤバい。

He innocently said, "I don't even know the difference between chicken, pork, and beef meat" -- clearly, that's worse than "mother's boy " or "pedophile".

例えば、幼児や小学生の女児がいるような家に、頻繁に独身の男がやってくるのを、歓迎する親がいると思うか?

正直言って『恐しいカミングアウトだ』と思いました。

To be honest, I thought, 'This is a horrible coming out.

------

私、近年の非婚率の上昇に対して、自分なりのいくつかの見解を示してきました。

I have offered several views of my own on the recent rise in the rate of nonmarriage.

―― 『結婚の価値、良さ、メリット』を、若者に対して言語化できない、私(たち)の無能

そして、今だに『結婚というシステムを前提とした出産』などという、タルいことを言い続けていれば ―― 『ゼロエミッション』は、二酸化酸素より先に、人口の方で、簡単に実現されてしまうでしょう。

―― 課題先進国(少子化、非婚化、高齢化)である我が国を、世界中が見守っています。

しかし、上記のような『生活能力の欠如』も、その大きな要因の一つであると痛感しました。

However, I keenly felt that the 'lack of life skills' mentioned above was alson one of the major factors.

2019,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

認知症に罹患した状態での、公務が可能かどうかについては、もちろん慎重な判断が必要であり、また国益にも関わる重大な案件でもあることも、重々に承知しています。

Of course, it is necessary to carefully judge whether or not public services are possible in the state of suffering from dementia, and I also understand that it is a major project related to national interests as well.

However, as mentioned here, dementia is a 100% inevitable disease.

それ故、私達は、認知症と共存する社会を作っていかなければなりません。

Therefore, we must create a society that coexists with dementia.

この時、認知症の人間を問答無用に、社会の仕組みの外に放り出すのか、あるいは、一定のルールの元で社会に組み入れていくのか ――

Now, should we throw out people with dementia without question, or incorporate into society under certain rules?

―― 課題先進国(少子化、非婚化、高齢化)である我が国を、世界中が見守っています。

"The world is watching over Japan, which has many advanced problems (low birthrate, non-maritalization, aging)."

-----

もっとも、前大臣が、認知症であるかどうかが不明な状況で、このような仮定の話を展開することは、甚だしくご本人に不快な思いをさせていると思います。

However, I think that expanding the story of such assumptions under the unclear circumstances whether the former minister has dementia.

しかし、そのことを承知した上で、今回の一件、一つの仮定に基づく問題提起のユースケースとさせて頂くことを、お許し頂きたいと思うのです。

However, I would like to allow him to use this case as a use case for raising questions based on one assumption.

なぜなら、国政のトップが、この問題に取り組む姿勢を見せることになれば、それは、日本のみならず、世界に対する、大きなアピールになると思うのです。

Because, if the head of government shows the attitude to tackle this problem, it will be a great appeal not only to Japan but also to the world.

それは、これまでのこの方の「失言集」を全部ひっくり返しても余りある、我が国のみならず、全世界に対する大きな「希望」になると、私は確信しているのです。

I am convinced that it will be a big "hope" for not only Japan but the whole world, even if there are enormous misstep of him.

-----

私は、認知症が「その周辺の人間に膨大な負荷をかける病気」であることは思い知っていますが、「恥しいものである」とは考えていません。

I know that dementia is "a disease that will give huge burdens around the patient", however, I do not think that "it is a shameful disease."

繰り返しますが、私達は、生きている限り ―― 程度の差こそあれ ―― 認知症から逃れることはできません。

Again, as long as we live, we can not escape from dementia.

認知症との共存は難しい社会課題です。

Coexistence with dementia is a difficult social issue.

しかし、少くとも、認知症が「恥しいものである」わけがありませんし、そのような偏見があってはなりません。

However, at least, there is no reason that dementia is "shameful" and there should be no such bias.

2023,江端さんの技術メモ

問題

現在、192.168.0.23/postgresにアクセスを確認

で、A5:SQL Mk-2は接続成功している様子

だが、publicの下の「テーブル」「ビュー」などを叩いても何も出てこない。

念のためpgAdAdmin4 で試してみたが、こちらも問題なし

解決(T研究所のKさんに教えて貰いました)

『データベースを登録する際に、データベース名に「agent_db」 を指定していただく必要があります』

 

参考文献

https://izit-infobox.net/blog/2021/07/15/a5sql-mk-2/

2023,江端さんの忘備録

―― プレゼンを見れば、モテるヤツかどうかは、一発で分かる

"I can tell if you are popular or not by your presentation"

という私の主張は、最近、学生さん達の発表(プレゼン)を見ることで、さらに確信が深まっています。

My assertion has been further confirmed by watching a student's presentation recently.

-----

- 暗記もせずに、しゃべるセリフを用紙に印刷してきて、それを読み上げているだけ

- They don't even memorize their phrases, just print out and read them out loud.

- 投影された資料の記載を、そのまま読んでいるだけ

- Thye are just reading the description of the projected papers as it is.

- 資料に図面がない

- No drawings in the papers.

- 説明にめりはりがない

- Explanation lacks verisimilitude.

要するに、聞き手に対して自分の主張ができておらず、そして、聞き手の理解を助けようという努力もしていない、ということです。

In short, they are not making their case to their listeners, and they are not making any effort to help them understand.

そんなヤツ、モテる訳がない ―― と、思う。

I don't think such a guy would be popular.

-----

という話を、以前娘にして、さんざん批判されたので、この辺で止めておきます。

I have told this story to my daughter before, and she criticized me a lot, so I will stop here.

長女:「さっきから、パパの偉そうな物言いに、本気でムカムカしていたからさぁ。いやーすっきりした! ありがとう、! これで、気分よく眠れるわぁ」

2018,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

―― という話を、娘たちに語っていた時、長女は、ソファーに転がりながら、明らかに不愉快な表情をし、次女は、私に語り始めました。

When telling the story to the girls, the senior daughter(SD) rolled on the sofa with unpleasant expression apparently, and the junior daughter(JD) began to speak to me.

次女:「パパ。学生に対して、その要求はちょっと高すぎるんじゃない?」

JD:"Daddy, is not that a bit too hight for a student?"

江端:「そうは思わない。プレゼンテーションとは、『自分の考えを、できるかぎり、正確に、詳細に他人に伝える』ことが目的とするものだから」

Ebata:"I do not think so, because the purpose of presenting is to" tell others about my thoughts as accurately as possible"

次女:「まあ、それはそうだけど・・、」

JD:"Well, that's right, but ..."

江端:「発表資料に書いていることを読み上げるだけなら、学会の会場に集る必要なんかないだろう。資料を読めば、それで済むんだから」

Ebata: "If they just read what you have written in the presentation materials, we don't have to gather at the conference venue. If we read the material, that is enough"

次女:「うーん・・・」

JD:"Well ..."

江端:「パパは、プレゼンテーションというのは、『一人芝居』だと思っていんだよ。わずかな時間の間に、笑いや感動を込めて、自分の主張を分ってもらう場だと思っているんだ」

Ebata: "I think that presentation is like a "one-theatrical performance". It's a place and time to explain my idea to others with laughter and emotions in a few hours."

次女:「まあ、それは分からなくはないけど、この前も、大学の学部紹介で、下を向いて、小さい声で原稿を読み上げるだけの大人(大学教授?)には、心底ウンザリしたからね」

JD: "Well, I understand it. The other day, when I have to hear the presentation of university professor with reading paper and small voice, he really annoyed me.

江端:「な、そうだろう」

Ebata: "Well, I guess so."

次女:「少なくとも『あの学科だけは行きたくない』という気持ちになった」

JD:"I decided not to go the college faculty at least"

江端:「だから、演出以前に、セリフもろくに言えない『一人芝居』なんて ―― はっきりいって『聴講者に苦痛だけを与える暴力』だと思っている」

Ebata: "Therefore, I think that "one-theatrical performance" is "violence that gives audience a pain only", if the performer can not be briefly spoken before the performance"

-----

次女:「なるほど。パパの言い分は分かった。ところで、パパは、学生のころ『国際学会』で『英語』で発表したことあるの?」

JD: "I see, I understood the claim of you ... By the way, did you have a presentation in English at the International Conference" when you were a student? "

江端:「はい?」

Ebata:"Yes?"

次女:「いや、『はい?』じゃないよ。そこまで言い切るパパは、学生の頃から、国際学会で、さぞかし見事な『一人芝居』を成してとげてきたんだよね?」

JD:"What did you say? Did you make a splendid "one-theatrical performance" when you were a college student because you are criticizing them ?

江端:「いや、パパが発表してきたは、オフィシャルランゲージが日本語の国内発表だけだったな。学生の頃、パパが研究チーム立ち上げたところで、国際学会へのコネクションとかも全然なかったし・・・」

Ebata: "No, I had just attended a domestic conference with Japanese only. As a student, I launched a research team,and there was no connection to the international conference at all.

次女:「では、こう質問しようか。『パパは、もし条件さえ揃ってれば、国際学会でパパの言う理想のプレゼンテーションを成し遂げれた』と言い切れる?」

JD:"Let me change the question. "Dad, if you had even the conditions, could you have achieved the ideal presentation at the international conference?"

江端:「えーっと、それは、ぶっちゃけ無理だったな。パパの学生時代の英語、今以上に壊滅的だったし・・・」

Ebata: "Well, it was impossible for me, my English proficiency at the college, was more devastating than now ..."

次女:「では、もう一つ質問。『パパは、もし条件さえ揃ってれば、単独で、国際学会にエントリするだけの勇気があった』と言い切れる?」

JD: And another question. "Dad, if you had even the conditions, could you have entered an international conference?"

江端:「ないな。うん、ない。当時のパパには、英語で発表するという発想は1mmもなかったと思う」

Ebata: "No way. Well it was impossible. I think that there was absolutely no idea of presentation in English at that time. "

次女:「じゃあさあ、今回、パパの批判している学生は、『パパよりも遙かに気概もある、知的レベルの高い学生』と言えるんじゃないの」

JD:"Well, Do the students, you criticize, have "more high intelligence with spirits that you at the time ?"

江端:「・・・認める。彼らは、当時のパパより有能で、そのうえ立派だ」

Ebata: "Well... I admit. they are more competent and spiritual than me at the time, ."

-----

その時、長女が、突然、雄叫びを上げました!

At that time, the SD suddenly raised a shout!

長女:「よっしゃー!! 良く言った、<次女>!! ああ、すっきりしたぁーーーー!」

SD:"Good job! !!. Oh, I feel better!!"

江端:「ど、どうした?」

Ebata:"What's happened?

長女:「さっきから、パパの偉そうな物言いに、本気でムカムカしていたからさぁ。いやーすっきりした! ありがとう、<次女>! これで、気分よく眠れるわぁ」

SD:"From a little while ago, I was seriously screaming about what you looked like to be great. Well I was cleared! Thank you, !! I will feel comfortable sleeping. "

と言いながら、長女は、私の目の前を颯爽と通り過ぎて、二階の自分の部屋に消えていきました。

While saying that, the SD passed by in front of me and disappeared in her room on the second floor.

2023,江端さんの忘備録

「陰謀やテロリズムでは、けっきょくのところ歴史の流れを逆行させることはできない。だが、停滞させることはできる」
(創元SF文庫「銀河英雄伝説」7巻 284Pより)

"Conspiracies and terrorism cannot, after all, reverse the course of history. But they can stall it."(From "The Legend of the Galactic Heroes," Sogen SF Bunko, vol. 7, p. 284)

という、ヤン提督の言葉は、長期的に見た時には、正しいのかもしれません。

Admiral Yang may be right in the long run.

しかし、私たちが生きている間の短い時間においては、そうでもないように見えることがあります。

In the short time we are alive, however, this may not appear to be the case.

-----

まず、少なくとも私たちの国家は、法律によって、いかなる形の暴力も容認しないことになっております。

First, at least our state, by law, does not tolerate violence in any form.

(法によって定められた組織 ―― 暴力装置(警察、自衛隊) ―― によって、詳細かつ厳格にコントロールされた暴力を除きます)

(except for violence that is detailed and strictly controlled by an organization defined by law -- a violent apparatus (police, Self-Defense Forces))

法治国家である我が国においては、いかなるテロリズムも許されません。

In our country, which is governed by the rule of law, terrorism of any kind will not be tolerated.

-----

しかし、テロによって、問題がクローズアップされることがあります。

However, terrorism can bring the issue to the forefront.

『"元首相の殺害テロ事件"と"統一協会"』は、典型的な例でしょう。

The "terrorist murder of the former prime minister" and the "Unification Association" are typical examples.

この『統一協会』問題は、私が最初に知った時から、実に40年間も動かなかったのに、あのテロ事件を契機として一気に動き出しました。

This "Unification Association" issue had been inactive for 40 years since I first learned about it, but the terrorist attack was the catalyst that set it all in motion.

そして、多分、今回がラストチャンスです ―― 最近、この問題に対する世間の注目度が落ちてきているようで、私はとても心配しています。

And maybe this is the last time -- I am very concerned that public attention to this issue seems to be waning lately.

今回の統一地方選挙で、この『統一協会問題』が争点にならなかった(ように見える)ことに、私はショックを受けています。

I am shocked that this "Unification Association issue" was not (seemingly) an issue in the current local elections.

それはさておき。

Aside from that.

-----

最近、また、現職首相を狙ったテロ事件が発生しました。

Recently, another terrorist attack targeted the incumbent prime minister.

犯行動機については、まだ明らかになっていません。

The motive for the crime is not yet clear.

しかし、少なくとも、テロの犯人は『自分の主張を社会に押しつけることができた』という一点においては、その目的を達成している訳です。

However, at least in one respect, the perpetrators of the terrorist attacks have achieved their goal: He has been able to impose their point of view on society.

こういう現実を見ると、ブログで主張を繰り返しているだけの自分(江端)が、バカバカしくなってしまいます。

These realities make me (Ebata) feel foolish for just repeating my assertions on my blog.

そして、私のように考える人間は、私以外にも結構多いのではないか、と思うのです。

And I think that there are quite a few people who think like I do, besides me.

『SNSでは炎上程度でしかない。街頭デモをしてもニュースにもならない。ニュースになるだけの賛同者を得るカリスマもロジックも弁舌も、私にはない』と考える人間が、

A person who think that "I just can make a flame on SNS. Even if I demonstrate in the streets, it won't make the news. I don't have the charisma, logic, or oratory skills to get enough supporters to make the news", come to think

―― 結局のところ、要人テロが一番てっとり早い

"After all, terrorism of dignitaries is the fastest way"

と考えるのは、まあ、普通に考えて、普通だと思うのです。

I think it is, well, normal to think that.

-----

昔、先輩に『原則として、自爆テロを防ぐ方法はない』と教えて貰ったことがあります。

I had a senior colleague once tell me, 'In principle, there is no way to prevent suicide bombers.

―― 政治、宗教、野球、恋愛については、人と議論してはならない

残念ながら、私には、これを解決する方法を思いつけません。

Unfortunately, I can't think of a solution to this.

2022/09,江端さんの技術メモ

こっちはPythonで書いたファジィ(Fuzzy)推論コードです。



# -*- coding: utf-8 -*-
# 上記の一行がないと、コメント分の和文も全部エラーになる 

# シンプルファジィ推論プログラム ver0.0 2015年12月15日
# シンプルファジィ推論プログラム ver0.1 2023年04月20日 print文の仕様変更対応

# メンバーシップ関数は、前件部、後件部ともに3つに固定した単純なもの
# 推論方式は、単純なmin-max重心法のみ



class condition_MF:
    
    center = 0
    width =  100
    PV ="LESS"

    def __init__(self, center, width, PV):
        self.center = center
        self.width = width
        self.PV = PV

    # x,yは、メンバーシップ関数上の座標を示す
    def func(self, x):
        if (self.PV == "LESS"):
            if (x <= self.center - self.width):
                y = 1.0
            elif (x <= self.center):
                y = - 1.0 / self.width * (x - self.center)
            else:
                y = 0.0        
        elif (self.PV == "ZERO"):
            if (x <= self.center - self.width):
                y = 0.0
            elif (x <= self.center):
                y = 1.0 / self.width * (x - self.center) + 1.0
            elif (x <= self.center + self.width):
                y = -1.0 / self.width * (x - self.center) + 1.0
            else:
                y = 0.0       
        elif (self.PV == "MORE"):
            if (x <= self.center):
                y = 0.0
            elif (x <= self.center + self.width):
                y = 1.0 / self.width * (x - self.center)
            else:
                y = 1.0
        
        return y

class action_MF:
    center = 0 # 値はダミー
    width =  100 # 値はダミー
    PV ="ZERO" # 値はダミー
    y = 0.0 # 最大値で更新されていく
    x = 0.0 # 値はダミー

    def __init__(self, center, width, PV):
        self.center = center
        self.width = width
        self.PV = PV

        if (self.PV == "LESS"):
            self.x = self.center - self.width
        elif (self.PV == "ZERO"):
            self.x = self.center
        elif (self.PV == "MORE"):
            self.x = self.center + self.width
        else:
            print ("error")

    # yを最大値で更新していく
    def func_Max(self,b):
        self.y = max(b, self.y)

    # X座標を返す
    def func_X(self):
        return self.x

    # (最大値で更新された、最後の)Y座標を返す
    def func_Y(self):
        return self.y

temp_High = condition_MF(20.0, 10.0, "MORE") # 温度が高い
temp_Middle = condition_MF(20.0, 10.0, "ZERO") #温度が普通
temp_Low = condition_MF(20.0, 10.0, "LESS")# 温度が低い

humi_High = condition_MF(50.0, 20.0, "MORE") # 湿度が高い
humi_Middle = condition_MF(50.0, 20.0, "ZERO") #湿度が普通
humi_Low = condition_MF(50.0, 20.0, "LESS")# 湿度が低い

switch_High = action_MF(0.0, 1.0, "MORE") # エアコンの温度設定を上げる("+1"にする)
switch_Middle = action_MF(0.0, 1.0, "ZERO")# エアコンの温度設定に何もしない("0"にする)
switch_Low = action_MF(0.0, 1.0, "LESS") # エアコンの温度設定を下げる("-1"にする)


# 入力値(温度27度、湿度57%)
t = 35.0
h = 80.0

# (1)「もし、温度が高くて、湿度が高ければ、エアコンの温度設定を下げる」
a1 = min(temp_High.func(t),humi_High.func(h))
print (a1)
switch_Low.func_Max(a1) 

print ("Low") 
print (switch_Low.func_Y()) 

# (2)「もし、温度が普通で、湿度が高ければ、何もしない」
a2 = min(temp_Middle.func(t),humi_High.func(h))
switch_Middle.func_Max(a2) 

print ("Middle") 
print (switch_Middle.func_Y()) 

# (3)「もし、温度が高くて、湿度が普通なら、エアコンの温度設定を下げる」

a3 = min(temp_High.func(t),humi_Middle.func(h))
switch_Low.func_Max(a3) 
print ("Low") 
print (switch_Low.func_Y()) 

# (4)「もし、温度が低くて、湿度が低ければ、エアコンの温度設定を上げる」
a4 = min(temp_Middle.func(t),humi_Low.func(h))
switch_High.func_Max(a4) 
print ("High") 
print (switch_High.func_Y()) 

# (5)(追加)もし温度が普通で、湿度が普通なら、何もしない
a5 = min(temp_Middle.func(t),humi_Middle.func(h))
switch_Middle.func_Max(a5) 
print ("Middle") 
print (switch_Middle.func_Y()) 

# 重心値を求める
# (ルールが推論空間を網羅していないと、ゼロ割が発生することがあるので注意)

reasoning =  (switch_High.func_X() * switch_High.func_Y()  + switch_Middle.func_X() * 
switch_Middle.func_Y()  + switch_Low.func_X() * switch_Low.func_Y()) / (switch_High.func_Y()  + switch_Middle.func_Y()  + switch_Low.func_Y())

print ("\n reasoning")
print (reasoning)

元ネタはこちら(クリックするとページに飛びます)。

ファジィ推論