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

の後で、「一体、江端は何を考えているんだ」と思われるかもしれませんが、『宇都宮ライトレールの利用を拒否させるような、ダイクストラをどうやって作ろうか』と考えています ―― しかも、できるだけ手を抜いて。https://wp.kobore.net/%e6%b1%9f%e7%ab%af%e3%81%95%e3%82%93%e3%81%ae%e6%8a%80%e8%a1%93%e3%83%a1%e3%83%a2/post-6473/

ところで、今、いくつかDBを作っていますが、混乱しかけているので、メモを残しておきます。

utsu_tram_db  : 道路と鉄道の強制結合
utsu_tram_db2: 鉄道のコストを下げて、宇都宮ライトレールを優先的に選ばれるようにした
utsu_tram_db3: 宇都宮ライトレールを単線にして、取り扱いをラクにした

ただ、今、ここで、バスが宇都宮ライトレールの上を驀進するようになってきましたので、これを何とかしないといけなくなりました。

ここで逆転の発想で、

utsu_tram_db4: 宇都宮ライトレールを誰も使いたくなくなるくらいに、コストを爆上げしてやればいい

と気がつきました。

で、utsu_tram_db3と、utsu_tram_db4を併用してやれば良い、と気がつきました。


この続きを記載したのですが、反映に失敗したようです。

という訳で簡単に説明しますと、utsu_tram_db3のコスト(現在0.2倍)を、逆に100倍にしたものをutsu_tram_db4として作成しました。現在上手く動いています(色々失敗もしましたが、それを書き残す気力は、もうありません。この週末、20時間以上コーディングしていて、フラフラです)


ちなみに、上記の作業で作ったデータベースを、他の人に渡す為に、以下の作業を行いました。

# pg_dump -U postgres -p 15432 utsu_tram_db3 > utsu_tram_db3.sql
# pg_dump -U postgres -p 15432 utsu_tram_db4 > utsu_tram_db4.sql

で作った、2つのデータベースのダンプ(utsu_tram_db3.sqlと、utsu_tram_db4.sql)を圧縮したのが、こちら。

utsu_tram_db.zip

まず、
create database utsu_tram_db3;
\c utsu_tram_db3
create extension postgis;
create extension pgrouting;
(utsu_tram_db4についても同じ)

としておいてから

これをutsu_tram_db.zipを解凍して、

# psql -U postgres -p 15432 utsu_tram_db3 < utsu_tram_db3.sql
# psql -U postgres -p 15432 utsu_tram_db4 < utsu_tram_db4.sql

で、PostgreSQLにインポートできます(source番号なども完全一致する(はず))。

2023,江端さんの忘備録

今日は、江端家の結婚記念日です。

Today is the Ebata family's wedding anniversary. Hence,

- 午前の発表会出席のオーダーを却下したのも、

- I also rejected the order to attend the presentation in the morning,

- 午後の会議を途中で抜け出すのも、

- I will get out of an afternoon meeting in the middle of the day,

- 稟議のサポートや報告書でドタバタしているのも、

- I'm also slammed with support for approvals and reports,

- 研究ゼミ生の卒業式や謝恩会に出席できないのも、

- It is also impossible to attend graduation ceremonies and thank-you parties for research seminar students,

ぜんぶ結婚記念日のせいです。

It's all because of our wedding anniversary.

-----

ちなみに、私の嫁さんは、

By the way, my wife always says,

『記念日に、宝飾品なぞ買う金があるなら、高いメシを食うほうがいいに決まっている』

"If you have money to buy jewelry on your anniversary, it's better to eat expensive meals"

という同じポリシーを持つ、長年の同志です。

Hence, she is a long-time comrade who shares the same policy.

2023,江端さんの技術メモ

■wsl2は通常状態ではdockerにアクセスできない。
→ Docker Desktopで、wsl2を使えるようにチェックを付ける

■wsl2からpsqlを使えるようにできるように、"sudo apt psql なんとか"で、psqlをインストールしておく
→ 要するに、wsl2からDBアクセスできなければ、お話にならない
こんなエラーで面倒な目にあった(なんか色々やっているうちに動くようになった)

psql: error: connection to server at "localhost" (::1), port 15432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 15432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?

とか、

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory

などが出てくるが、やっかいなことに、DBを3回くらい作り直すと、直っていたりするので、原因が特定できないことが多い。

T.B.D.

 

2023,江端さんの忘備録

『「キューバ危機」を「マルチエージェントシミュレータ」で検証する』

の本を読んでいます。

I am reading this book.

ここ近年ないほど、集中して読んでいます。

I am reading more intensively than I have in recent years.

私は、今、「コンピュータの中に、心を持った仮想エージェントを作る」という課題で苦しんでいるのですが、

I am currently struggling with the task of "creating a virtual agent in a computer with a mind of its own".

―― こうやって、パソコンの中に、ケネディと、マクナマラと、アチソンを作るのかぁ

"This is how I make Kennedy, McNamara, and Atchison in my computer"

と、その手法に感嘆しています。

I am amazed and amazed at the methodology.

明日は、エージェントの動かし方(アルゴリズム)のページに進むことができと思います。

Tomorrow, I will be able to move on to the page on how to run agents (algorithms).

それはさておき。

Aside from that.

-----

この本の中では、キューバ危機当時のアメリカのとりえる7つのオプションと、5つの状態が記載されています。

In the book, seven options and five states that the United States could take at the time of the Cuban Missile Crisis are described.

/////////

オプション1: 何もしない

Option 1: Do nothing

オプション2: 外交的解決

Option 2: Diplomatic Solution

オプション3: 外交開始アプローチによる海上封鎖

Option 3: Maritime Blockade with Diplomatic Initiation Approach

オプション4: 最後通牒アプローチによる海上封鎖

Option 4: Maritime blockade with ultimatum approach

オプション5: 外科手術的な空爆(ポイント攻撃)

Option 5: Surgical air strike (pinpoint attack)

オプション6: 全面的な空爆

Option 6: Total Airstrike

オプション7: キューバ侵攻

Option 7: Invasion of Cuba

/////////

状態1: 軍事衝突

State 1: Military conflict

状態2: 配備継続

State 2: Deployment continues

状態3: ミサイル破壊

State 3: Missile destruction

状態4: ミサイル撤去

State 4: Missile removal

状態5: カストロ放逐(暗殺)

State 5: Castro is ousted (assassinated)

/////////

・・・と、ここまで読んで気がついたのですが、

...and then I realized at the page

『ロシアのウクライナ侵攻と、アメリカのキューバ侵攻って、どこがどう違うんだっけ?』

'What's the difference between Russia's invasion of Ukraine and the U.S. invasion of Cuba?'

両方とも、国土防衛を目的(口実)として、他国の主権を侵害し、軍事侵攻するという点で同じです。

Both are the same in that they both violate the sovereignty of other countries and invade militarily for the purpose (pretext) of homeland defense.

『ロシアのウクライナのミサイル攻撃と、アメリカの北ベトナムの北爆って、何がどういうふうに違うんだっけ?』

'What's the difference between a Russian missile strike in Ukraine and a U.S. bombing of North Vietnam, and in what way?'

自国に都合の良い政権を、他国に作り出そうとする陰謀という点で同じです。

It is the same in that it is a conspiracy to create a regime in another country that is good for one's own country.

(旧日本軍のケースでも、似たようなユースケースは作れると思いますが、今回は「キューバ危機」に限定しています)

(I believe that a similar use case could be made for the former Japanese military, but I am limiting myself to the "Cuban Crisis" in this case.)

-----

だからといって、今回のロシアによるウクライナ侵攻が、「正当化」される訳でもなく「相殺」される訳でもありません。

However, that does not "justify" or "offset" the current Russian invasion of Ukraine.

『ロシアもアメリカもどっちも悪い』とは思います。

I think 'Russia or the U.S. are both to blame.

しかし、今回は、キューバ危機のように『ウクライナにロシアを狙った核ミサイルが密かに配備された』とかいうような、誰もが納得できるに足る「理」がない分、ロシアに語れる「義」が少ない(少なすぎる)ように思います。

However, this time, as in the Cuban Missile Crisis, there is no "reason" that everyone can agree on, such as "nuclear missiles secretly deployed in Ukraine aimed at Russia," so I think that Russia has little (too little) "righteousness" to speak of.

キューバ危機で招集された「エクスコム(EXCOMM)会議」に相当するものがロシアにもあれば、今回のロシアによるウクライナ侵攻は、なかったかもしれませんが ―― それは誰にも分かりません。

If Russia had the equivalent of the EXCOMM conference convened during the Cuban Missile Crisis, the current Russian invasion of Ukraine might not have happened -- but who knows.

-----

少なくとも、今のロシアには、

At least there is at least one person in Russia today who is seriously considering the

『ロシアの天然資源を狙って、NATO軍が、ロシア国境に雪崩れ込んでくるという悪夢』

"nightmare of NATO forces avalanche on the Russian border, targeting Russia's natural resources"

を真剣に考えている人が、少なくとも一人はいるわけです。

私自身、正直なところ、『そういう可能性がゼロとは言えない』と思っています。

I myself honestly think, 'I can't say there is no such possibility.

歴史の教科書見れば、そういうことが、たくさん書かれています。

If you look at history textbooks, you will see many such things.

というか、『歴史の教科書には、そういうこと"しか"書かれていない』とすら思っています。

In fact, I even believe that "that is all that is written in history textbooks".

-----

例えば、もし、日本の国内または領海内に、世界の半分以上のエネルギーを賄うような地脈が発見されたとしたら、

For example, if a vein of earth was discovered within Japan's domestic or territorial waters that could provide more than half of the world's energy,

―― 中国、ロシア、あるいはアメリカが、日本国土または領海に侵攻してくる

"China, Russia, or the U.S. invades Japanese land or territorial waters"

という確信があります。

I am convinced of that scenario.

この確信に関してだけは、私の「首」をかけてもいい、と思っています。

I am willing to put my life on the line for this certainty alone.

なぜか?

Why?

私の知りうる限り、これまでの歴史において例外がないからです。

I am not sure why, because as far as I know, there has been no exception to this in our history.

2023,江端さんの忘備録

今日も「立証責任」シリーズです。

Today, I continue our "burden of proof" series too.

でまあ、最近、高市早苗経済安全保障担当相と、立憲民主党の小西洋之参院議員の間で、この「立証責任」についての論争があるようです。

私が、過去に、自腹切って法学ゼミに通っていた、という話は何度かしましたが、その中でも驚いた話の一つに

I have mentioned several times in the past that I used to attend law seminars at my own expense, and one of the most surprising stories I heard was

『刑事事件裁判における、原告と被告の立証責任の違い』があります。

"The difference between the burden of proof for the plaintiff and the defendant in a criminal case trial"

民事事件裁判というのを、乱暴に一言で言えば、「個人 v.s. 個人」の争いです。

To put a civil case trial in a nutshell, it is a "personal v.s. personal" dispute.

比して、刑事事件裁判というのは、「国家 v.s. 個人」の争いになります。

In contrast, a criminal trial is a "state v. individual" dispute.

これでは、最初から勝負になりません。

This is not a good start to the game.

なぜなら、刑事事件においては、国家(検察側)が圧倒的に強いからです。

This is because the state (the prosecution) is by far the strongest party in criminal cases.

-----

国家:「プロフェッショナルな捜査集団(警察)」、「攻撃専門の法律専門家の集団(検察)」、「最新鋭の科学的調査手段や、それらの人材を確保できるだけの潤沢な資金」

State: "a professional investigative team (police)," "a group of legal experts specializing in attacks (prosecutors)," "state-of-the-art scientific means of investigation, and ample funds to staff them."

個人: 基本的に自分の「個人的な私財」くらい

Personal: Basically, "personal private property".

いわば、「核ミサイル v.s. 被告個人の竹槍での特攻」みたいなものなのです。

It is like a "nuclear missile v.s. defendant's personal suicide attack with a bamboo spear," so to speak.

-----

それ故、刑事事件裁判においては、「検察側の圧倒的有利」を前提として、以下のようなルールがあります。

Hence, in criminal trials, the following rules are based on the "overwhelming advantage of the prosecution".

検察側は、事件の全貌を、

The procesution must complete the followings,

(1) 完全かつ無矛盾に、

(1) without contradiction,

(2) 1mmのスキもなく、

(2) perfectly,

(3) どこからどう攻められても絶対に崩れない磐石の証拠とロジックによって完成させて、

(3) with rock-solid evidence and login that will never be broken, no matter how they is attacked, and

(4) それを法廷で明らかにしなければならない

(4) the responsibility to make it clear in court.

という責務があります。

検察は、これだけの仕事を完遂しなければ、裁判に勝てません。

The prosecution must complete so much work to win the case.

それに対して、被告側は、上記の全容のほんの僅かな、かすかな部分、例えば、"1%"、あるいは "0.01%" の矛盾や齟齬を指摘できれば、それで、"勝ち"となります。

On the other hand, if the defendant can point out a tiny fraction of the above, say "1%" or "0.01%" of discrepancies or discrepancies, then they "win".

これを、法学ゼミでは、

In the law seminar, this was explained with the phrase,

『検察が組み立てたロジックを、わずか1mmでも"揺らす"ことができれば、被告の勝ち』

"The defendant wins if he or she can 'shake' the logic constructed by the prosecution, even by just 1mm"

というフレーズで説明していました。

これでは、被告が凄く有利のように思えるかもしれませんが、思い出してください ―― 被告が相手にしているものは、国家という"核ミサイル"なのです。

This may seem like a huge advantage for the defendant, but remember - the defendant is dealing with a "nuclear missile" called the state.

つまり、今回の袴田事件の再審は、その"1%"、あるいは"0.01%"によって、検察のロジックが"揺らされた"ということなのです。

In other words, the retrial in the Hakamada case was "shaked" the logic of the prosecution by the "1%" or "0.01%"

(なお、本日は、この事件の是非については言及しません)

(Note that I will not address the merits of this case today.)

-----

国家権力をバックとしている検察は、その気になれば「捏造」など朝飯前です。

As prosecutors backed by state power, "fabricate" is a piece of cake.

それゆえ、検察側には、高いモラルが必要とされているのですが、所詮、人間のやることには限界があります。

Therefore, high moral standards are required on the part of prosecutors, but there are limits to what human beings can do after all.

『あいつが犯人で間違いない』という思い込みは、必ず発生します。

The assumption that 'he is definitely the culprit' is bound to occur.

そもそも、日本の刑事裁判の有罪率は、99.9%です。

To begin with, the conviction rate in Japanese criminal trials is 99.9%.

これは統計的に見なくても、十分に気持ち悪い数字です。

This is a sickening enough number without looking at it statistically.

つまり刑事裁判で起訴されたら、ほぼ確実に有罪になるのです。

In other words, if you are charged in a criminal court, you will almost certainly be convicted.

-----

という訳で、このような無力な私たちに必要とされてることは、

So, what we need to do, in such a helpless way, is

―― 国家権力に目をつけられない様な『小市民』であり続けること

"To continue to be a "small citizen" who does not attract the attention of state power"

この一択です。

This is the only choice.

-----

私が飲み会などで「"小市民"を心掛けて生きてきました」と自己紹介しているのは、単に『笑いを取る』ためだけではないのです。

The reason I introduce myself at drinking parties by saying, "I have been trying to be a 'small citizen' my whole life," is not just to get a laugh.

神さま

神は沈黙せず

 

2008,江端さんの忘備録

私は「神が云々」とか「神の~~」というような本にも弱かったりします。

原則的には真面目に、言い替えれば凡庸に行きる術しかない我が身にとって、「オメーがちゃんとしてくれないから、私が楽しくない人生じゃねーか」と、世の中の矛盾を押し付ける存在が必要だからです。

今は、そんなことはなくなりましたが。

以前にも書きましたが、私の「神」に関する結論は

(1)神、または神みたいな奴はいる。

(2)私はそのことは知っている(見た)。

(3)でも、そいつは何にもしてくれないみたいだし、多分、これらも何にもしてくれそうにないように思える(神の気が変わる可能性はあるかもしれないけど)。

(4)結局、世の中の矛盾は、結局、人類が人類なりに、局所的かつ場当たり的に解決していくしかない

です。

------

「神は沈黙せず」という著書を読みました。

UFOやら超常現象に関する(筆者の過大な想いによる記載を)全部ふっ飛ばして、楽しく読みました。

私は、本書で登場するコンピュータアルゴリズムである、遺伝的アルゴリズムに関して、高速計算方法の発明者であったりします(ま、出願しただけで、出願審査請求も会社に却下されましたので、単なる「発明者」(特許公開平06-161980 遺伝的アルゴリズムの高速処理方法))。

ただ、このアルゴリズムで色々遊んでいたのですが、「えっ! 嘘!!」という位に高速に解答を見つけるのに驚いていました。

例えば、私(だけ)が知っている問題に対して、遺伝子からなる集団をコンピュータの中に作って、「探せ!」と指示を出すと、滅茶苦茶な速度で、その解を見つけ出していました。

実際の所、私は求解アルゴリズムに関して、そんなに詳しい訳ではないのですが、通常の求解方法(例えばガウスの求解法とか、ニューラルネットワークやファジィ推論)では、コンピュータを起動させる前に、「お願い、今度は見付けてね(ハート)」というような想いで、プログラムを起動していた日々が、阿呆みたいに感じることがありました。

まあ、遺伝的アルゴリズムにしたって、問題の種類によっては苦手な分野もありますし、何より良い解を求める為には、問題求解の為の良い環境を「私」が作っている訳ですから、上記の内容は、甚だしく公平性を欠くコメントだ、とは分っているのですが。

-----

「神は沈黙せず」において、

■地球は、神のコンピュータシステム。

■人間は、遺伝的アルゴリズムの1個体。

うーん、判りやすい。

私も遺伝的アルゴリズムのアルゴリズム動かしている時、ちょっとしたジェノサイド(大虐殺)を指令する独裁者の気分でした。

『愚劣な大衆は死ね。エリートだけが次世代を継げば良い・・・』

(いや、本当にこういうアルゴリズムなんだってば。興味のある人は、ちょっと調べてね)

-----

第二次大戦時に、ヨーロッパ全土を焦土と化した某国の独裁者が、同じようなことを、コンピュータを使わずにやりました(つまり、本当にこういうことを実施した→興味のある人は調べましょう)。

私は、私自身が「コンピュータで遊ぶ程度の、無力な、権力なき弱小小市民」であることを、本当に感謝しています2008

2010,江端さんの忘備録

交通事故に巻き込まれて、ここ一月ばかり、鬱な状態にありました。
双方の主張が異なるので、紛争解決は長びきそうだということも、憂鬱の要因の一つでした。

私は、こういう不安定な状態が嫌いな性格です。『できるだけ早期に白黒付けたい』と願う方です。

振り返ってみると、時間で解決することができたようなことも、自分の手で事態を悪くしてしまったことも、不要に事件を拡大させて、結果的に解決を遅らせてしまったこともあるように思えます。
小心な小市民故の成せる業です。

-----

神さま。

私は、小市民として野心なく生きているのですから、面倒も最小限として下さい。
大きな面倒は、大きな野望や大きな幸福の人に持っていって下さい。

2023,江端さんの忘備録

この本を見つけた時に思いました。

When I found this book, I thought,

―― これは、私のために書かれた本である

"this is a book written for me"

と。

『「キューバ危機」を「マルチエージェントシミュレータ」で検証する』

"Examining the 'Cuban Crisis' with a 'Multi-Agent Simulator'"

この本に相応わしい読者が、この世に「私」以外にいようか。

Who else in the world would be a suitable reader for this book but me?

映画「Fukushima 50」を見た結果が、「13デイズ」と同じようなこになったら、どうしよう ――

ただ心配だったのが、「マルチエージェントシミュレータ」に関する技術的内容でした。

The only concern was the technical content regarding the "multi-agent simulator.

-----

例えば ――

For, example,

■『AI』とか『人工知能』とかを表題に含む書籍の多くが、AI技術に関して恐しいほどのデタラメを記載していること

- Many books with "AI" or "Artificial Intelligence" in the title contain frightening bullshit about AI technology.

■そのような本の著者の「AI技術に対する理解」が、お話にならないものほど杜撰(ずさん)なものであること

The author's "understanding of AI technology" of such books is so sloppy that it is hard to talk about it.

を、私はよく知っているからです。

-----

とは言え、この本を購入しなければ、それを確認することもできませんので、購入ボタンを押しました。

However, without purchasing the book, I would not be able to check it out, so I pressed the buy button.

到着したばかりの本を、手当たりしだい眺めていたのですが ―― 安心しました。

I was looking at a handful of books that had just arrived -- a relief.

一目で、『この本は、ガチだ』と分かりました。

At first glance, I knew, 'This book is the real deal'.

この本、これから時間をかけて、大切に読んでいこうと思っています。

I am going to take the time to read this book with great care.

2019,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

我が家では、娘が、仕事中の私の書斎に入ってきて、「相談ごと」を持ちかけくることがあります。

My daughters sometimes ask me to listen to their problem, even when I am working in my room.

相談ごと、といっても「金の無心」とかではありません。

The "problem" is not beg me for money.

私は、『お前に渡す金があれば、私は、RTKシステム用の送受信機を購入する』と言い放って、かつ、その通りに実施してきた人間です。

In my case, I always say "I will buy TX and RX devices of RTK system, even if I have money for you", and actually I have done it.

ですので、娘たちは、私に、そういう相談はしてきません。

So they don't approach me with such a problem.

------

ところで、ちょっと話はズレますが。

Changing the subject,

次女に聞いたところでは、『娘にプレゼントに欲しいものを尋ねて、それを買い与える』という奇特な父親がいるそうです。

In the world, there are some strange fathers who "ask their daughter what she wants as a present, and buy and give it to her "

私は100回生まれ変わっても、そういう父親になることは、期待できそうにありません。

Even if I get reincarnated 100 times, I will not be able to be such a father.

私の場合、「安全」「教育」「自己啓発」「トラブル」以外については、

My basic policy is "fight and get what you want by your own"

『自力で闘って、奪い取ってこい』

except for "safety","education", "self-development" and "troubles"

が基本方針です。

閑話休題。

to return.

-----

娘の相談ごとは、「キューバ危機」「文化大革命」「デザイナーズベイビー」のような具体的なネタが多いようです。

My daughter's problems are relatively practical topics, for example "Cuban Crisis", "Proletarian Cultural Revolution" and "designer child".

条件によっては、娘の宿題のレポートの代筆をすることもあります。

If conditions permitted, I will write a report of homework for her.

私は娘に、手提げ袋(ブランドバックとも言う)なんぞに、1円も出すつもりはありません ―― が、

I don't intent to pay for briefcase (called "branded goods") at all, however,

無茶な量の宿題を、無茶な締切で命じてくる、パワハラ教師に対しては、娘と『共闘』できます。

I can struggle jointly against a power harassment of teachers, who order a homework of nonsense mount and deadline.

―― 「プロの研究員のレポート」を、その教師のツラに叩きつけてこい!

"Slap the teacher in the face by "the report written by a professional research engineer""

と言って、レポートを娘に手渡します。

and, I hand the report to her.

この他には、「進路」とか「ライフスタイル」のような、抽象的な相談を受けることがあります。

I am also asked by her to discuss abstract issues like, "career options" or "life style"

私は、この手の相談に対しても、できるだけ具体例で語ることにしています ―― 自分の経験の範囲内で、ですが。

According to these case, I will tell her operative examples, which are, of course, within my previous experiments.

(続く)

(To be continued)