2022/03,江端さんの忘備録

私の次のコロナワクチン接種(第3回目)は、今週の金曜日です。

My next corona vaccination (3rd dose) is this Friday.

今になって『しまった』と思っています。

Now I'm thinking, 'Oh! No!".

私、ウイークデーの就業時間中は、『社会人』江端智一ですが、私は、その時間以外は、『私人』江端智一です。

I, Tomoichi Ebata, am a "working person" during my working hours on weekdays, but I am a "private person" outside of those hours.

でもって、土日は、概ね、私人としての私は、資料調査、図表作成、コラム執筆、シミュレーションに、ほぼ全ての時間を投入しています。

And, on Saturdays and Sundays, as a "private person", I generally invest almost all my time in researching materials, creating charts, writing columns, and simulations.

-----

第3回目の副反応は凄いぞ ―― という話を色々なところから聞いています。

I've heard from various sources that the third adverse reaction is going to be terrible.

今週の土日が、副反応対応で潰れてしまったら、3月のコラムの執筆計画が、かなり危うくなってきます。

If I have to spend this Saturday and Sunday dealing with adverse reactions, my writing for the March column will be in serious critical condition.

振り返ってみると・・・

Looking back...

1回目は、私は、副反応を自覚できませんでした。

The first time, I was not aware of any adverse reactions.

2回目は、翌日から翌々日にかけて、歩行困難となる時がありました。

The second time, I had difficulty walking at times during the next day and the day after that.

総じて、江端家夫婦は、副反応は軽症だったと思います。

https://wp2.kobore.net/%e6%9c%aa%e5%88%86%e9%a1%9e/post-3555/

In general, I think that my wife and I had a mild adverse reaction.

-----

ですから、3回目もきっと軽症に違いない、と信じています ―― が、

So I'm sure that the third will be minor -- however,

共同執筆者であるシバタ先生や、編集担当であるMさんは、副反応で大変な目に遭われているようです。

Dr. Shibata, my co-author, and Ms. M, my editor, have been having a hard time with adverse reactions.

「私(江端)だけ、3回目も軽症で逃げ切った」ということになれば、私たちのチームに『気まずい空気』が流れるのではないかと、(ちょっとだけ)心配しています。

I'm (a little) worried that if it turns out that I (Ebata) was the only one who escaped with a minor injury in the third round, there will be an 'awkward atmosphere' in our team.

2022/03,江端さんの忘備録

ここ最近、コーディング(プログラミング)に嵌っています。

Recently, I've been into coding (programming).

色々検討した結果、ここ2月ほど検討してきた方法が、間違っていることが分かってきて、現在、絶賛やりなおし中です(丸々無駄という訳でもなかったのですが)。

After much deliberation, I've come to realize that the method I've been considering for the past two months is wrong, and I'm currently in the process of redoing it (though it wasn't a total waste).

https://wp2.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-5426/

現在、トライアル中のモノは「予測できない変化をリアルタイムで組み込んで、動的に変化しつづける推論エンジン」でして これが、結構難しい。

The one we I currently trialing is an inference engine that incorporates unpredictable changes in real time and keeps changing dynamically.

状況を固定させた状態での研究は腐るほどあるのですが、実際の環境を組み込みながら動くエンジンの研究は、ほとんどありません。

There is a plethora of research that has been done with fixed situations, but there is very little research on engines that work while incorporating real environments.

まあ、これは、実際にコーディングをやってみれば分かります。

Well, you can find this out by actually doing some coding.

『現状の計画を大きく変更させないようにして、新しい情報を組みつつ、行動を変える』という、人間が普通にやっていることを、プログラムに組み込むのことは、結構難しいのです。

It is quite difficult to incorporate into a program what we normally do, which is to "change our behavior while incorporating new information without significantly altering our current plans.

それでも、私が踏ん張っているのは、『多分、大掛かりなプログラムとしては、これが現役(というか人生)ラストコード(プログラミング)になるだろう』という予感があるからです。

Still, I'm holding on because I have a feeling that this will probably be the last code (programming) I'll ever use in my life as a large-scale program.

-----

私は、テレビやスマホのゲームを楽しめない性格です。

I am a person who does not enjoy playing games on TV or on my phone.

しかし、ゲームに嵌っている人の状況と、コーディングに嵌っている私の状況は、良く似ているかもしれないなぁ、と思っています。

However, I think that the situation of people who are addicted to games and my situation of being addicted to coding may be very similar.

- 興奮状態が続き、眠れなくなる。

- The excitement lasts and makes it difficult to sleep.

- 目を瞑っても、アルゴリズムが頭の中を走り回る

- Even when I close my eyes, algorithms run through my head.

- 夢の中でバグに気がつき、その後、寝付けなくなる

- Noticing a bug in a dream and then not being able to sleep

昔は、この時点で「大量のアルコールを投入して、強制的に睡眠に入る/維持する」ということをやっていたのですが ―― その結果が、アルコール依存症の予備軍(いや、正規軍か?)になってしまいました。

In the past, I used to "throw in a lot of alcohol" at this point to force/maintain sleep -- and the result was a reserve army of alcoholics (or is it a regular army?).

今は、アルコールではなく、精神安定剤に、スイッチしただけですが。

Now, I just switched to tranquilizers instead of alcohol.

それでも、毎日のアルコールの鯨飲よりは、処方通りの安定剤の方が、はるかに健康的だとは思います。

Still, I believe that stabilizers as prescribed are much healthier than whaling on alcohol daily.

体調もいいですし。

I'm in good physical condition.

それはさておき。

That's beside the point.

-----

一般的に、プログラムはパラメータの値に実際の値を使わずに、変数にしておいて、外部から入力するようにします。

In general, programs do not use actual values for parameters. The parameter values are kept as variables and are input from outside.

(3.52)^3 + 3.52^2 + 3.52 の値(=543.9174828032)としてプログラムに書き込むのではなく、x^3 + x^2 + x と記述しておけば、プログラムの起動時に、xの値を自由に変えることができて、便利だからです。

Instead of writing it into the program as the value of (3.52)^3 + 3.52^2 + 3.52 (=543.9174828032), it is convenient to write it as x^3 + x^2 + x, so that you can freely change the value of x when the program starts.

直接、値を書き込むコーディングは、「ハードコーディング」と言われて、(実験や検証用途を除けば)やってはならないプログラミングとされています。

Coding that directly writes values is called "hard coding" and is considered programming that should not be done (except for experiments and verification purposes).

"goto"と同じように。

Just like "goto".

https://wp2.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-5438/

しかし、興奮状態が納まらず、睡眠障害が発生し、疲労が取れない、この私のコーディングこそが「ハードコーディング」と呼びに相応しい、と思っています。

However, I think that my current coding is worthy of being called "hard coding", as I can't stop the excitement, sleep disturbance, and fatigue.

そして、体力的にも、精神的にも、今が、このような「ハードコーディング」ができるラストチャンスだろうと、腹を括っています。

And I' believe the fact that this will be my last chance to do this kind of "hard coding", both physically and mentally.

2022/02,江端さんの忘備録

本日は、コラムがリリースされた日なので、日記はお休みです。

Today, new my column is released, so I take a day off.

 

「お金に愛されないエンジニア」のための新行動論(1)

"A New Theory of Action for Engineers Who Are Not Loved by Money".

定年がうっすら見えてきたエンジニアが突き付けられた「お金がない」という現実

The reality of "no money" confronts an engineer whose retirement is just around the corner

 

-----

===== EE Times Japan編集部 担当者Mさんからメール ここから ======

===== Email from Ms. M, EE Times Japan Editor, from here ======

お世話になっております。大変お待たせ致しました。Web稿を作成しましたので、28日(月)の正午をメドに、ご確認をお願いできますでしょうか。

Thank you for your cooperation. We have prepared a web draft, which should be ready for your review by noon on Monday the 28th.

※連載名ですが、「「お金に愛されないエンジニア」のための新行動論」のみとしました。

I've changed the name of the series to just "A New Theory of Action for Engineers Who Are Not Loved by Money".

「世界で『数字』を~~~」を頭につけると、コンテンツ生成システムから「長すぎて入らん」と怒られまして…(涙)。

When I put "numbers in the world~~" at the beginning, the content generation system got angry and said it was too long to fit... (tears)

なので、新シリーズというより、完全なる新連載という形で行こうと思います。

So, rather than a new series, I think we'll go with a completely new series.

===== ここまで =====

===== to here =====

―― えっ? 新連載なの?

"What? Is this a new series?"

という感じで、なし崩し的に、始まってしまいました、新連載。

And so, in an uncontrolled process, the new series has begun.

システムからの要求だけでなく、『気合入れて書けよ』という、Mさんの内なる声も入っているような"気"を感じます。

I can feel the "spirit" of Mr. M, not only from the system's requirements, but also from her inner voice that says, "Put your heart and soul into your writing.

未分類

私、知財(知的財産法)四法については詳しいです。どの記述がどの条文に書かれているのか知っているレベルです。

加えて、知財に関する国際条約についても、かなり知っている方だと自負しています。

憲法は、高等教育のレベルで知っているくらいです。

民法は、ちょっと怪しくなってきます。

刑法、刑事訴訟法については、ボロボロです。

-----

今回の、「ロシアによるウクライナ侵攻」について、多くの人が、「国際法違反」と言っているようですが、その根拠となる法令について、どこを捜せばいいのか、まったくサッパリ分かりません。

また、我が国においては、憲法98条2項に「国際法優位説」と読める記載があり、現時点では「国内法と国際法がバッティングした時は、国際法が優位である」という考え方が、定説です。

ちなみに、特許法の場合は、「国際法優位」が、ばっちり明文化されていて、疑義の生じる余地がありません(第26条)。

で、何が言いたいかというと、私は『戦争に関する国際法』については、完全にド素人である、ということです。

-----

以上を踏まえまして、読者の皆様に2つお願いがあります。

(1)「ロシアによるウクライナ侵攻」を国際法違反と断じる、国際法の根拠条約と条文の場所(URL)を教えて下さい

(2)「ロシア」の法体系が、「国際法優先」か「国内法優先」のどちらに寄っているかについて、論じられているコンテンツの場所(URL)を、ご紹介下さい(論文でもいいけど、できれば、簡易に記載されているコラムで、日本語なら、なお嬉しいです)

これは、純粋に調査に供する事項であり、「正論」「正義」「理念」「倫理」などの観点は、(今回は)必要ありません。

ご教示頂けましたら、幸いです。

ご利用頂けるメールアドレスは"until20220310@kobore.net"です。

ご協力のほど、何卒、よろしくお願い致します。

 

江端

2022/02,江端さんの忘備録

実家に帰ると、萩尾望都先生の「銀の三角」を読みます。そして、時間が消失してしまいます。

When I go back to my parents' house, I read "Silver Triangle" by Ms. Moto Hagio. And time disappears.

当時、高校生としては、かなりの高価だったと思うのですが、「銀の三角」はハードブックで購入しました。

I bought "Silver Triangle" as a hard book, although I think it was quite expensive for a high school student at the time.

「銀の三角」の内容を、どう解説すれば良いのか分かりません。

I don't know how to explain the contents of the "Silver Triangle".

ただ、このストーリを言語で説明するのであれば、必要なモノは相対性理論・・・違うな。量子論とも違う。

But if I want to explain this story in language, I need the theory of relativity...No no. It's not quantum theory either.

少なくとも、「時空間コンテンツ」の最高傑作であり、江端の最高評価、ということだけは言えるのですが。

At least, I can say that it is the best of "space-time contents" and Ebata's highest evaluation.

これまで、百回以上は読み直したかと思いますが、今でも、よく分からないのです。

I must have reread it a hundred times or more, but I still don't understand it.

「銀の三角」は、万人受けする作品ではないのかもしれません。

"Silver Triangle" may not be a work for everyone.

思うに、これは『私たちが作品を選ぶのではなく、作品が私たちを選ぶ』という作品なのだと思うのです。

I think this is the book that "we don't choose the book, the book chooses us".

-----

光瀬 龍先生の原作の「百億の昼と千億の夜」は、量子論の2つ目の解釈「エヴェレットの多世界解釈」の一つの形として完成した作品であると思います。

I believe that the original work "Ten Billion Days and One Hundred Billion Nights" by Mr. Ryu Mitsuse is a completed work as a form of the second interpretation of quantum theory, Everett's Many Worlds Interpretation.

「ウは宇宙船のウ」「スターレッド」「11人いる!」「恐るべき子どもたち」「半神」「メッシュ」「エッグ・スタンド」「偽王」

"R is for Rocket", "Start Red," "There are 11 of Us!" "Terrible Children", "Half-Blood", "Mesh", "Egg Stand", "The False King".

おお、凄い。

Well, I am great.

こんなにも、スラスラとタイトルが出てくるとは思わなかった。

I didn't expect the title of the book to come out so sloppily.

-----

以前「スターレッド」をテーブルに出しておいたのですが、家族に読まれた形跡がありません。

I left "Star Red" out on the table before, but there was no sign of it being read by my family.

どうやら、我が家において「選ばれし読者」は、私だけのようです。

Apparently, I am the only "chosen reader" in my family.

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

"goto"を使う ―― とても、感慨深いです。

"goto"追放キャンペーンが発生したのは、私が大学院在学中の頃でしょうか。そして、現在も"goto"に対する差別的扱いは、変っていません。"goto"なんか使ったら、それだけで『無能』扱いされ、仕事の依頼を打ち切られるような空気すらあります。

まあ、"goto"に、そこまで言われるだけの弊害があるのは確かです。特に「可読性は最悪」ですし、放置された変数が、どんな悪さをするか分かったもんではありません。メモリリークは確実で、スレッドとか使っていたら高い確率でクラッシュします。

しかし、私、学生のころ、N-BASICで"goto"使い倒していましたけど、『あれは、あれで便利でした』。

実際、プログラミング初心者には、とても便利なモノでした。初学者には、"goto"で、ラクラクプログラミングを楽しんでもらっていいんじゃないかな、私は思うのです。


ところで、調べてみたら、golangに、"goto"が実装されていました。C/C++にもありました。Pythonにもありました。Javaにもあるみたいですが、動かないようです(?)。

「使うな」と言われている割に、一応準備だけはされているのが、なかなか興味深いです。

ちゃんと動きましたので、書き残しておきます。

// go run main2.go

package main

import (
	"fmt"
	"time"
)

var ch1 chan interface{}
var ch2 chan interface{}

func main() {

	ch1 = make(chan interface{}) // チャネルの初期化
	ch2 = make(chan interface{}) // チャネルの初期化(ここでは使っていない)

	go loop()

	for i := 0; i < 5; i++ {
		time.Sleep(3 * time.Second) // 3秒待つ
		fmt.Println("send")
		ch1 <- i
	}
}

func loop() {

L:
	fmt.Println("先頭からやりなおし")

	for {
		time.Sleep(1 * time.Second) // 1秒待つ
		fmt.Println("loop")

		//チャネルからメッセージの到着を確認する
		select {
		case i := <-ch1:
			fmt.Println("ch1:", i)
			goto L

		case <-ch2:
			fmt.Println("ch2")

		default:
			//fmt.Println("No value")
		}
	}
}

以上

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

GAを使った推論エンジンを、無限ループで回し続けながら(止めないで)、変数の変更やら、パラメータの変更を突っ込みたいんだけど、その「割り込み」方法が思いつきませんでした。たしか select, caseを使ったやり方があって、defaultの使い方がキモだったようなものがあったような気がして、ちょっとテストプログラム書いてみましたところ、動いたみたいなので、メモの残しておきます。

// go run main2.go

package main

import (
	"fmt"
	"time"
)

var ch1 chan interface{}
var ch2 chan interface{}

func main() {

	ch1 = make(chan interface{}) // チャネルの初期化
	ch2 = make(chan interface{}) // チャネルの初期化(ここでは使っていない)

	go loop()

	for i := 0; i < 5; i++ {
		time.Sleep(3 * time.Second) // 3秒待つ
		fmt.Println("send")
		ch1 <- i
	}
}

func loop() {

	for {
		time.Sleep(1 * time.Second) // 1秒待つ
		fmt.Println("loop")

		//チャネルからメッセージの到着を確認する
		select {
		case i := <-ch1:
			fmt.Println("ch1:", i)

		case <-ch2:
			fmt.Println("ch2")

		default:
			//fmt.Println("No value")
		}
	}
}

で、この最後の"default"をコメントアウトすると、selectが無限待ちになってしまう(チャネルからメッセージが飛んでこないとロックしてしまう)ので注意して下さい。
コメントアウトした結果↓

 

# チャネルからイベント入ったら、初期設定のルーチンまで強制的に飛ばしてしまおうと思っているのですが、golangに、"goto"ってあるのかなぁ・・・

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

今、GAのアルゴリズムを使った動的ルーティングのライブラリ化を試みているのですが、Geneに複雑な(というか、面倒くさい)メカニズムを組み込む為に、四苦八苦しています。

これまで私は、「順序交叉」という手法を用いてきたのですが、昨夜(の深夜)この方式では、私のやりことができないことが判明し、現在、一から作り直しています(2ヶ月分がふっとんだ感じがします)。

で、こちらのpythonで遺伝的アルゴリズム(GA)を実装して巡回セールスマン問題(TSP)をとくのページの「実装例: partial_crossover」の部分を参考させて頂いて、golangで表現してみました。

package main

import (
	"fmt"
	"math/rand"
)

func main() {

	//var sliceA = []int{-1, 1, -1, 2, 6, 3, -1, 4, -1, 5}
	//var sliceB = []int{1, -1, 2, 3, -1, 4, -1, 5, 6, -1}

	var sliceA = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
	var sliceB = []int{1, 3, 5, 7, 9, 0, 2, 4, 6, 8}

	fmt.Println("before sliceA:", sliceA)
	fmt.Println("before sliceB:", sliceB)

	sliceA, sliceB = partial_crossover(sliceA, sliceB)

	fmt.Println("After sliceA:", sliceA)
	fmt.Println("After sliceB:", sliceB)

}

// 交叉:2つの遺伝子をランダムな位置で交叉させる
// def partial_crossover(parent1, parent2):
func partial_crossover(sliceA []int, sliceB []int) ([]int, []int) {

	//num = len(parent1)
	length := len(sliceA)

	//cross_point = random.randrange(1, num-1)
	cross_point := rand.Intn(length-2) + 1

	//cross_point = 3

	fmt.Println("length:", length, "cross_point", cross_point)

	//child1 = parent1
	sliceA1 := make([]int, length)
	copy(sliceA1, sliceA)

	//child2 = parent2
	sliceB1 := make([]int, length)
	copy(sliceB1, sliceB)

	//for i in range(num - cross_point):
	for i := 0; i < length-cross_point; i++ {
		//target_index = cross_point + i
		target_index := cross_point + 1

		//target_value1 = parent1[target_index]
		//target_value2 = parent2[target_index]
		target_value1 := sliceA[target_index]
		target_value2 := sliceB[target_index]

		//exchange_index1 = np.where(parent1 == target_value2)
		//exchange_index2 = np.where(parent2 == target_value1)

		var exchange_index1, exchange_index2 int

		for k := 0; k < length-cross_point; k++ {
			if target_value2 == sliceA[k] {
				exchange_index1 = k
				break
			}
		}

		for k := 0; k < length-cross_point; k++ {
			if target_value1 == sliceB[k] {
				exchange_index2 = k
				break
			}
		}

		//child1[target_index] = target_value2
		//child2[target_index] = target_value1
		//child1[exchange_index1] = target_value1
		//child2[exchange_index2] = target_value2

		sliceA1[target_index] = target_value2
		sliceB1[target_index] = target_value1
		sliceA1[exchange_index1] = target_value1
		sliceB1[exchange_index2] = target_value2
	}
	return sliceA1, sliceB1
}

このコーディングで正解なのか分かりません(私が、バグを仕込んでいる可能性大)。

また検証した結果、私の考えている遺伝子配列(染色体の中に、遺伝子"*"を使う)では、使えないことが分かりました。

この方式では重複する遺伝子は使えないからです(というか、"*"を使う遺伝子配列は、普通ではない)。

もし利用を予定されている方は、十分に検証されることをお勧めします。

以上

2022/02,江端さんの忘備録

監督と脚本と声優の皆さんのラインナップを見て、今期、アニメ「平家物語」の視聴を決めました ―― が

I decided to watch the anime "The Tale of the Heike" this season after seeing the lineup of the director, scriptwriter, and voice actors -- however, I think

『これは、これから長い間、視聴され続けるアニメになるかもしれないなぁ』

"This may become an anime that will be watched for a long time to come"

と思っています。

滅亡する平家一族の視点から描かれる、まさしく、琵琶法師の世界観を描いたアニメで、「見事」の一言に尽きます。

It is an anime that depicts the world of Biwahoushi(lute player) from the point of view of the Heike clan that is dying out, and it is absolutely "brilliant".

声優の悠木碧さんの語る平家琵琶の迫力が凄くて、圧倒されます。

The power of the Heike Biwa, as told by the voice actress Aoi Yuuki, is amazing and overwhelming.

-----

なんだかんだいっても、私は、日本の歴史を扱うコンテンツを、楽しむ能力があると思います。

For what it's worth, I think I have the ability to enjoy content about Japanese history.

これは、やはり、入試で「日本史」を選択したのが大きいと思います。

I think this was largely due to the fact that I chose "Japanese History" for the entrance exam.

世界史は、世界史の教師の教え方が絶望的にお粗末で、大嫌いであったのに加えて、私は、複数の世界で流れる時間を、マルチタスクで理解する能力がなかったからです。

World history, not only because my world history teacher was hopelessly lousy at teaching and a total asshole, but also because I lacked the ability to multitask and understand the time that flows in multiple worlds.

とは言え、海外に打って出ようとする若者には、「世界史選択」をお勧めしたいです。

Nevertheless, I would like to recommend the "World History Option" to young people who are planning to venture abroad.

特に、世界で同時並列で存在する宗教や思想を理解するのに、世界史はもっとも役に立つ道具です。

In particular, world history is the most useful tool for understanding religions and ideas that exist simultaneously and in parallel in the world.

そういえば、世界史と日本史をミックスした、「歴史総合」という教科になる、といういう話を聞きました。大変良いことだと思います。

By the way, I heard that there will be a new subject called "Integrated History", which is a mixture of world history and Japanese history. I think this is a very good thing.

この「歴史総合」に、「数学」を入れると、さらに面白いだろうと思います。

I think it would be even more interesting to include "mathematics" in this "Integrated History" course.

国家とか、権力とか、戦争などには、発生原因と存続時間があります。

Nations, powers, wars, etc. have a cause and duration.

これらは、数値モデルで説明できると思いますが ――

It would be interesting to be able to explain these in a numerical model, but--

その前に、『歴史数学』という学問分野の確立が必要ですね。

Before that, we need to establish the discipline of "historical mathematics".

-----

一方、私のように、

On the other hand, if you're like me,

■世間とコミットしたくなくて、

- I didn't want to commit to the world.

■1人の世界でヌクヌクしていたくて、

- I just wanted to relax in my own world.

■『閉塞した世界こそが私の楽園』

- The closed world is my paradise.

という方には、「日本史」はお勧めできます。

I can recommend "Japanese History" to you.

少なくとも、「NHK大河ドラマ」と「歴史小説/アニメ」と「寺社/名所巡り」を楽しむ人生は、担保されると思います。

At the very least, you will be guaranteed a life of enjoying NHK historical dramas, historical novels/animations, and visits to temples, shrines, and famous places.