2023,江端さんの技術メモ

pgr_dijkstra()で、ダイクストラの順番を壊さずにルートの座標を得る方法(getDijkstraPath())

ノードの切断を発生させず、ノード10~ノード20と、ノード30~ノード40を回避するダイクストラ計算を行うPostGISのクエリー

をベースとしたGo言語のプログラムになります。

// C:\Users\ebata\tomioka3B\src\others\main23.go
package main

import (
	"database/sql"
	"fmt"
	"log"
	"m/src/ldarp"
	"strconv"

	_ "github.com/lib/pq"
)

func main() {
	db, err := sql.Open("postgres",
		"user=postgres password=password host=192.168.0.23 port=15432 dbname=tomioka_db_c sslmode=disable")
	if err != nil {
		log.Fatal("OpenError: ", err)
	}
	defer db.Close()

	/*
		以下のldarp.LocInfoの内容は、
		type LocInfo struct {
			Lon    float64
			Lat    float64
			Source int
		}
		となっています。
		このプログラムファイルでは、上記を定義して、ldarp.LocInfoを、LocInfoと変換すれば動きます

		ただ、前提とするpostgresqlのpostGISが取り扱うデータベースは、
		mapconfig_for_cars.xml をベースとして構築しているものになりますので、ご留意下さい
		https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig_for_cars.xml
	*/

	var a_Point, b_Point ldarp.LocInfo

	a_Point.Source = 1  // 出発ノード
	b_Point.Source = 50 // 到着ノード

	var del_start1, del_end1, del_start2, del_end2 ldarp.LocInfo
	//var del_start3, del_end3 ldarp.LocInfo

	del_start1.Source = 10 // 1つ目の無効としたいノード番号(開始番号)
	del_end1.Source = 20   // 1つ目の無効としたいノード番号(終了番号)
	del_start2.Source = 30 // 2つ目の無効としたいノード番号(開始番号)
	del_end2.Source = 40   // 2つ目の無効としたいノード番号(開始番号)
	//del_start3.Source = 30
	//del_end3.Source = 35

	array1 := []ldarp.LocInfo{del_start1, del_end1} // 上記の無効としたいノード番号を登録する
	array2 := []ldarp.LocInfo{del_start2, del_end2} // 上記の無効としたいノード番号を登録する
	//array3 := []ldarp.LocInfo{del_start3, del_end3}

	//delSourceArray := [][]ldarp.LocInfo{array1, array2, array3}
	delSourceArray := [][]ldarp.LocInfo{array1, array2} // 登録したノード番号をarraysの変数に纏める
	//delSourceArray = [][]ldarp.LocInfo{}

	// arrays変数への挿入
	//for _, arr := range arrays {
	//	delSourceArray = append(delSourceArray, arr)
	//}

	// fmt.Println(delSourceArray)

	path, dist := getDijkstraPath(db, a_Point, b_Point, delSourceArray)

	fmt.Println("path:", path)
	fmt.Println("dist:", dist)

}

// 江端再修正版(2023/09/29)
/*
出発ノードと到着ノードと、通過したくないノード(無効したいノード)を登録して、ダイクストラ計算によるルートを選ぶ
*/

func getDijkstraPath(dbMap *sql.DB, locInfoStart, locInfoGoal ldarp.LocInfo, delSourceArray [][]ldarp.LocInfo) ([]ldarp.LocInfo, float64) {
	log.Println("getDijkstraPath", locInfoStart, locInfoGoal)

	sql_str := "" // SQL文を作る文字列の初期値

	// delSourceArray の解析
	fmt.Println("delSourceArray:", delSourceArray)

	if len(delSourceArray) != 0 { // delSourceArrayに要素が入っていれば

		// forとrangeを使用して各要素のSource値を取得
		sql_str = "WHERE "

		for _, arr := range delSourceArray {
			/*
				for _, loc := range arr {
					fmt.Printf("Sourceの値: %d\n", loc.Source)
				}
			*/
			fmt.Println(arr[0].Source, arr[1].Source)
			//str += "( source NOT BETWEEN " + arr[0].Source + " AND " + arr[1].Source + " AND target NOT BETWEEN " + arr[0].Source + " AND " + arr[1].Source + ")"
			sql_str += "(source NOT BETWEEN " + strconv.Itoa(arr[0].Source) + " AND " + strconv.Itoa(arr[1].Source) + " AND target NOT BETWEEN " + strconv.Itoa(arr[0].Source) + " AND " + strconv.Itoa(arr[1].Source) + ") AND "
			//fmt.Println(str)
		}
		strlen := len(sql_str)
		sql_str = sql_str[:strlen-5] // ラストの" AND "の5文字を削除する
		//fmt.Println(str)
	}

	sql_str = "SELECT seq,source, target, x1, y1, x2, y2, agg_cost FROM pgr_dijkstra('SELECT gid as id, source, target, cost, reverse_cost FROM ways " + sql_str + "', $1::bigint , $2::bigint , directed:=false ) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq"

	//fmt.Println(sql_str)

	var path []ldarp.LocInfo // 経路 (返り値の一つ目)
	var totalDistanceKm float64

	rowsDijkstra, errDijkstra := dbMap.Query(
		//"SELECT seq,source, target, x1, y1, x2, y2, agg_cost FROM pgr_dijkstra('SELECT gid as id, source, target, length_m as cost FROM ways', $1::bigint , $2::bigint , directed:=false ) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq",
		//"SELECT seq,source, target, x1, y1, x2, y2, agg_cost FROM pgr_dijkstra('SELECT gid as id, source, target, length_m as cost FROM ways WHERE (source NOT BETWEEN 10 AND 20 AND target NOT BETWEEN 10 AND 20) AND (source NOT BETWEEN 30 AND 40 AND target NOT BETWEEN 30 AND 40)', $1::bigint , $2::bigint , directed:=false ) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq",
		sql_str,
		locInfoStart.Source,
		locInfoGoal.Source)

	if errDijkstra != nil {
		log.Fatal(errDijkstra)
	}
	defer rowsDijkstra.Close()

	var agg_cost float64

	var loc ldarp.LocInfo
	var x1, y1, x2, y2 float64
	var seq int
	var target int
	var source int

	isFirstCheck := true
	isSourceCheck := true

	for rowsDijkstra.Next() {

		// まずnodeを読む
		if err := rowsDijkstra.Scan(&seq, &source, &target, &x1, &y1, &x2, &y2, &agg_cost); err != nil {
			fmt.Println(err)
		}

		// 最初の1回だけチェックのために入る これについては、https://wp.kobore.net/江端さんの技術メモ/post-7668/を参照のこと
		// もし rowsDijkstra.Scanで最初のsource値を読みとり、locInfoStart.Source の値と同じであれば、x1,y1をベースとして、異なる値であれば、x2,y2をベースとする

		if isFirstCheck {
			if source == locInfoStart.Source {
				isSourceCheck = true // x1, y1をベースとする処理になる
			} else {
				isSourceCheck = false // x2,y2をベースとする処理になる
			}
			isFirstCheck = false // 最初の1回をチェックすることで、2回目はこのループには入らなくなる
		}

		//var loc ldarp.LocInfo

		if isSourceCheck { // x1, y1をベースとする処理
			loc.Source = source
			loc.Lon = x1
			loc.Lat = y1
		} else { // x2,y2をベースとする処理
			loc.Source = target
			loc.Lon = x2
			loc.Lat = y2
		}
		path = append(path, loc)
	}

	// ラストノードだけはsourceとtargetを引っくり返す
	if isSourceCheck { // x1, y1をベースとする処理
		loc.Source = target
		loc.Lon = x2
		loc.Lat = y2
	} else { // x2,y2をベースとする処理
		loc.Source = source
		loc.Lon = x1
		loc.Lat = y1
	}

	path = append(path, loc)

	totalDistanceKm = agg_cost / 1000.0
	return path, totalDistanceKm
}

2023,江端さんの忘備録

先日、BSで、映画「十戒」が放送されていたので、録画しました。

The other day, the movie "The Ten Commandments" was broadcast on BS, and I recorded it.

江端:「『十戒』を録画しておいたので、興味があれば見て」

Ebata: "I recorded 'The Ten Commandments' for you to watch if you are interested."

嫁さん:「うーん、あまり興味ないかな」

Wife: "Hmmm, not interested."

江端:「旧約聖書を読むより、ラクに理解できるよ」

Ebata: "It's easier to understand than reading the Old Testament."

嫁さん:「なんで、旧約聖書の内容を理解しなければならないの?」

Wife: "Why do I have to understand the Old Testament?"

と言われて、「確かに、そうだ」と、納得してしまいました。

I thought, "Sure, that's right," and agreed.

日本人なら、「日本神話」の方が先だと思ったのですが、よく考えたら「いやいや、別に、それすらも必要ないだろう」と自分で、自分に突っ込んでしまいました。

I thought "Japanese mythology" would be the first thing a Japanese person would think of, but then I thought about it and said, "No, no, not really, we don't even need that either."

私は、日本の神様(天皇陛下のご先祖)が、結構「ポンコツ」だったという話が、結構好きです。

旧約聖書の内容を知っていると、トクになることって何だろうなぁ、と考えてみたのですが、現在の問題に限定すれば「パレスチナ問題」の見通しが良くなるくらいですかね。

I wondered what the benefits of knowing the contents of the Old Testament would be, and I thought that if limited to current issues, it would only improve the outlook on the "Palestinian problem."

-----

個人的には、「旧約聖書」より「新約聖書」の方が面白いです。

I find the "New Testament" more interesting than the "Old Testament".

といっても、わざわざ「新約聖書」を読む必要なんぞななくて、関連するアニメや映画やコミックで、断片的に内容を繋げれば十分だと思います。

However, reading the "New Testament" all the way through is unnecessary. It is enough to connect the contents of the New Testament with related anime, movies, and comics in bits and pieces.

そもそも、その「新約聖書」は、ナザレのイエス没300年後(西暦325年)に、編集会議(ニケーア公会議)で、その内容を、各宗派の議論と投票で決定したものです。

To begin with, the contents of the "New Testament" were decided by the editorial council (Council of Nicea) 300 years after the death of Jesus of Nazareth through discussion and voting by the various denominations.

新約聖書の編集会議は、少年ジャンプの新連載マンガを決定する、または連載打ち切りを決定する会議と、基本的に同じだったのです。

The New Testament editorial meeting was essentially the same as the meeting that decided on a new manga series for Shonen Jump or decided to discontinue the series.

まあ、そう考えていくと、ルターの宗教改革から始まったプロテスタントキリスト教や、その「聖書至上主義」も、私の心にはヒットしません。

When I think about it, Protestant Christianity and its "biblical supremacy" that began with Luther's Reformation doesn't hit me either.

―― 人間が会議で編纂した書物(新約聖書)が、「神の言葉」なんぞである訳がない

"How can a book (the New Testament) compiled by a conference of men be the "Word of God"?"

と。

カソリックキリスト教については、言うに及ばずです。

Not to mention Catholic Christianity.

ちなみに、仏教の各宗派に関しては、私は、異なる同人誌のサークルくらいの意識しか持っていません。

By the way, I know that Buddhist sects are the same as doujinshi circles.

―― ゴーダマシッダールタさん没後、2500年オーダの時間をかけて創作され続けた膨大な物量の「同人誌」

もちろん、私は、コミケサークルの活動を尊重しているくらいですから、世界中の宗教も ―― アホなカルト宗教団体や原理主義者を除けば ―― 同様に敬意を払っています。

Of course, I respect the activities of the Comic Circle so much that I appreciate all the religions of the world -- except for the idiotic cult groups and fundamentalists -- as well.

-----

『では「神学」は無意味な学問か』と問われれば、そうではないようです。

If you ask, 'Then is "theology" a meaningless discipline?' it seems not.

「神学」は、哲学でもあり、論理学でもあり、法学でもあり、見方によっては科学や数学(の証明)とも言えるもののようです。

"Theology" appears to be a philosophy, a logic, a jurisprudence, and, depending on one's point of view, a science or a mathematical (proof of) science.

私に来世があるなら、「神学」の勉強をしてみたいと思っています(現世は、ちょっと忙しすぎるようなので)。

If I have a next life, I would like to study "theology" (this life seems a bit too busy for me).

-----

「旧約」も「新約」も「日本神話」も、私たちには、別段必要ではありません。

We don't need "Old Testament," "New Testament," or "Japanese mythology.

という訳で、本日の日記は、スルーして頂いて結構です。

Therefore, you may pass through today's diary.

あなたたちの中で、不要不急の外出をしたことがない者が、政府または東京都に、まず石を投げなさい

2023,江端さんの技術メモ

C:\Users\ebata\tomioka3B\src\others\main21.goでバトル中 

tomioka_db_c=# SELECT seq, node, edge, source, target, b.cost FROM pgr_dijkstra('SELECT gid as id, source, target, cost, reverse_cost FROM ways WHERE (source NOT BETWEEN 10 AND 20 AND target NOT BETWEEN 10 AND 20) AND (source NOT BETWEEN 30 AND 40 AND target NOT BETWEEN 30 AND 40)',1, 50, directed := false) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq;

seq | node | edge | source | target | cost
-----+------+------+--------+--------+------------------------
1 | 1 | 2 | 1 | 2 | 8.518550262944415e-05
2 | 2 | 3 | 2 | 3 | 0.0009420518456308501
3 | 3 | 4 | 3 | 4 | 0.00026662995399998605
4 | 4 | 5 | 4 | 5 | 0.00021389117484400878
5 | 5 | 6 | 5 | 6 | 4.656362881781325e-05
6 | 6 | 7 | 6 | 7 | 0.00013184236987589488
7 | 7 | 8 | 7 | 8 | 6.438782425766514e-05
8 | 8 | 1254 | 8 | 897 | 1.2290752319372595e-05
9 | 897 | 1380 | 897 | 969 | 0.00038637624148597305
10 | 969 | 1938 | 969 | 1389 | 2.250777644883257e-05
11 | 1389 | 694 | 1389 | 542 | 0.0002978010745492113
12 | 542 | 1251 | 542 | 895 | 0.00015951582993150323
13 | 895 | 1815 | 895 | 1305 | 0.0001303909506021454
14 | 1305 | 1021 | 1305 | 753 | 3.9356066874244885e-05
15 | 753 | 1381 | 753 | 971 | 0.0002850072862639029
16 | 971 | 1382 | 976 | 971 | 0.001276712172995213
17 | 976 | 1388 | 977 | 976 | 0.0004267486614026622
18 | 977 | 1389 | 986 | 977 | 0.0006757336753520132
19 | 986 | 1404 | 906 | 986 | 0.0003707891314505199
20 | 906 | 1275 | 906 | 907 | 0.0001959266189093194
21 | 907 | 1277 | 907 | 908 | 9.052734394018332e-05
22 | 908 | 1921 | 908 | 1376 | 5.400925846418281e-05
23 | 1376 | 1279 | 1376 | 909 | 1.8504323815069496e-05
24 | 909 | 1057 | 909 | 773 | 6.840328939622445e-05
25 | 773 | 1069 | 773 | 781 | 0.000535513050350553
26 | 781 | 1071 | 781 | 784 | 0.00014276168953525706
27 | 784 | 1087 | 784 | 793 | 0.0004430493335842619
28 | 793 | 1682 | 793 | 1192 | 7.9895243915049e-05
29 | 1192 | 1111 | 1192 | 808 | 0.0005876979547862221
30 | 808 | 1125 | 808 | 816 | 0.00047564125136792903
31 | 816 | 51 | 816 | 49 | 3.10328360877585e-05
32 | 49 | 52 | 49 | 50 | 0.00028187114581170033

一応、QGISで調べて、ノード切れが発生していないことは確認しました。


新規に作ったノード182~413を、ちゃんと無視できるかの実験。ベースは以下のメモの内容。

pgr_dijkstra()で、ダイクストラの順番を壊さずにルートの座標を得る方法(getDijkstraPath())

■無視前

tomioka_db_c=# SELECT seq, source, target, x1, y1, x2, y2 FROM pgr_dijkstra('SELECT gid as id, source, target, cost, reverse_cost FROM ways',1036, 1320, directed := false) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq;
seq | source | target | x1 | y1 | x2 | y2
-----+--------+--------+-----------------+----------------+-----------------+----------------
1 | 1036 | 182 | 139.6295688 | 35.3660511 | 139.62956342765 | 35.36605302299
2 | 182 | 183 | 139.62956342765 | 35.36605302299 | 139.62952386387 | 35.36602637499
3 | 183 | 184 | 139.62952386387 | 35.36602637499 | 139.62949515388 | 35.36599335049
4 | 184 | 185 | 139.62949515388 | 35.36599335049 | 139.62949783814 | 35.3658805722
5 | 185 | 186 | 139.62949783814 | 35.3658805722 | 139.629505074 | 35.36583679324
6 | 186 | 187 | 139.629505074 | 35.36583679324 | 139.62955514143 | 35.36580196041
7 | 187 | 188 | 139.62955514143 | 35.36580196041 | 139.62972133265 | 35.36574533322
8 | 188 | 189 | 139.62972133265 | 35.36574533322 | 139.62969285571 | 35.3656615823
9 | 189 | 190 | 139.62969285571 | 35.3656615823 | 139.62929978548 | 35.36461811112
10 | 190 | 191 | 139.62929978548 | 35.36461811112 | 139.62923349573 | 35.3644776355
11 | 191 | 192 | 139.62923349573 | 35.3644776355 | 139.62887730502 | 35.36401128513
12 | 192 | 193 | 139.62887730502 | 35.36401128513 | 139.62881288258 | 35.36394808968
13 | 193 | 194 | 139.62881288258 | 35.36394808968 | 139.62878113819 | 35.36393552673
14 | 194 | 195 | 139.62878113819 | 35.36393552673 | 139.62874285819 | 35.36391763403
15 | 195 | 196 | 139.62874285819 | 35.36391763403 | 139.62711549003 | 35.36370406459
16 | 196 | 1320 | 139.62711549003 | 35.36370406459 | 139.6270944 | 35.3636816
(16 rows)

■無視後

tomioka_db_c=# SELECT seq, source, target, x1, y1, x2, y2 FROM pgr_dijkstra('SELECT gid as id, source, target, cost, reverse_cost FROM ways WHERE (source NOT BETWEEN 182 AND 413 AND target NOT BETWEEN 182 AND 413) AND (source NOT BETWEEN 182 AND 413 AND target NOT BETWEEN 182 AND 413)',1036, 1320, directed := false) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq;
seq | source | target | x1 | y1 | x2 | y2
-----+--------+--------+-------------+------------+-------------+------------
1 | 1034 | 1036 | 139.6297237 | 35.365746 | 139.6295688 | 35.3660511
2 | 1034 | 1033 | 139.6297237 | 35.365746 | 139.6297007 | 35.3656671
3 | 1033 | 1325 | 139.6297007 | 35.3656671 | 139.6287884 | 35.3639297
4 | 1325 | 1320 | 139.6287884 | 35.3639297 | 139.6270944 | 35.3636816

うん、これを見ている限りは、大丈夫そうに見える。

 

2023,江端さんの忘備録

―― 親父にもっと話を聞いておけばよかったな

"I should have talked to my dad more."

と、亡き父の事を思い出しています。

I remember my late father.

私は、今、メンタル不調が継続しています。

I am currently experiencing ongoing mental illness.

私なりの自己分析では、(1)タスクオーバーフローに加えて、(2)タスクのゴールが見えない、という恐怖に因るものが主要因です。

According to my self-analysis, the leading causes are (1) task overflow and (2) fear of not being able to see the goal of the task.

―― メンタル不調は、報告しにくい

-----

私の父は、私より少しだけ若い年齢で、木工会社を起業したのですが、私から見ても『下請けの地獄』をモロに受け続けていたと思います。

My father started his own woodworking company at an age slightly younger than me, and from my point of view, he continued to suffer the 'hell of subcontractors.'

金策、不渡り、暴力団からの恫喝、連鎖倒産、関連会社社長夫妻の自殺 ―― そこには、私などの状況とは比べるべくもない『地獄』がありました。

Money laundering, dishonoring, threats from gangsters, chain-reaction bankruptcies, and the suicides of the president of an affiliated company and his wife - there was a "hell" that could not be compared to my situation.

私から見えているだけでも、これだけの話があったのですから、もっと凄まじい『地獄』もあったはずです。

There must have been more horrendous "hells" than this since there were so many stories just from what I can see.

だから私は、安易に『起業』を叫ぶやつも、勧めるヤツも、大嫌いです。

I hate those who shout "start a business" quickly or encourage people to do so.

=====

「江端さんのDIY奮闘記 EtherCATでホームセキュリティシステムを作る(4)」より抜粋

Excerpt from "Mr. Ebata's DIY Struggle: Building a Home Security System with EtherCAT (4)

私が大学1年生の時、起業した父の木工会社が、連鎖倒産のあおりを食らいました。その倒産元の夫婦は、ヤクザに追い込まれて、息子たちを逃がした後、夫婦で自殺しました。あの時は、私も大学の退学を覚悟しました。

When I was a freshman in college, my father's woodworking company, which he had started, was hit by a chain reaction bankruptcy. The couple behind the bankruptcy were driven into a corner by the Yakuza, and after escaping their sons, they committed suicide together. At that time, I was prepared to drop out of college.

「起業家がきちんと法律通りに守られる」と信じている人は、一度、裏社会の暴力装置と、日本の自殺者の構成比率を調べることをお勧めします。

For those who believe that "entrepreneurs are properly protected according to the law," I suggest you take a moment to examine the violent apparatus of the underworld and the composition of suicides in Japan.

私が覚えている限り、単に「失敗すれば終わり」 ―― で済ましてくれるほど、世の中は優しくなかったですよ。

As far as I can remember, the world has not been so kind to us as to let us "fail and it's over."

======

私なら、これだけの『地獄』に直面すれば、メンタル不調など軽く飛び越えて、簡単に自死に至る自信があります。

I am confident that if faced with such a "hell," I would quickly jump over mental illness and commit suicide.

―― 一体、父は、どのように、このような『地獄の日々』をすごしてきたのだろうか

"How did my father go through these "hell days"? "

そんな風に思うと、『親父にもっともっと話を聞いておけばよかったな』と、物凄く貴重な人材からノウハウを聴き出せなかったことに、最大級の後悔をしています。

When I think about it like that, I have the biggest regret that I didn't get the know-how out of this precious person, saying, 'I wish I had talked to my father more and more.'

2023,江端さんの忘備録

先日、大学の学生さんとお話する機会を得ました。

I recently had the opportunity to speak with a student at the university.

江端:「データベースは、私がサクッっと作るので、SQLでクエリーでサーチして貰えれば。SQLクエリーは、結構、かん・・・」

Ebata: "I'll make the database quickly, and you can search it with SQL queries easi..."

と言いかけて、そこで、思い留まりました。

I was about to say that. However, I had to stop myself.

江端:「うん。SQLは、簡単じゃない。慣れるまではとっつき憎いし、面倒だし、難しい。だから、少しづつ慣れていけばいいと思う」

Ebata: "Yes, SQL is not easy. Until you get used to it, it is difficult, troublesome, and hard. So I think you should get used to it little by little."

と言い直しました。

I reiterated.

-----

自分にできることを、他人に簡単に『簡単』と言ってはなりません。

Do not simply say 'easy' to others, even if you can do it yourself.

現在進行形で取り組んでいる人にとって、取り組んでいることが簡単なのは、そりゃ当たり前です。

Unsurprisingly, what we are working on is easy for us.

しかし、一度も経験していないことを始めることは、誰にとっても、莫大なコスト(時間と努力)と恐怖とプレッシャーがかかるものです。

However, starting something you have never experienced is an enormous cost (time and effort), fear, and pressure.

「他人にもできるはずだ」と決めつけて、他人に押しつけるようになる

-----

この件については、以前、私が「やらかした」ことをお話しました。

I have told you before what I "did" on this matter.

「江端、特許、パワハラ」で検索して貰えれば、このペ^ージや、その他のページでヒットします。

If you search "Ebata, patents, power harassment," you'll get hits on this page and others.

2023,江端さんの技術メモ

■通常のバスルートを作ったが、表示ノードが停留所のみとなり、シミュレータが不自然になる問題の解決法
   → 強制的にタグを付ける

mapconfig_for_cars_rail_cart_bus.xml

の変更も忘れないこと。

Keyword : osm, tag, node, ダイクストラ、

 

2023,江端さんの忘備録

昨日、市営図書館の書架で、故井上靖先生の「しろばんば」をみつけました。

Yesterday, I found "Shirobanba" by the late Yasushi Inoue on the shelves of the city library.

「しろばんば」「夏草冬濤」「北の海」は、著者のティーンエイジャ時代の自伝的小説です。

"Shirobanba," "Natsukaso Fuyutoto," and "Kita no Umi" are autobiographical novels about the author's teenage years

中学生時代、私は、土曜日午前で授業が終了すると、市場で自炊用の食材を買って、好きな料理を作って、それを食べながら、この本を読むことが、とても好きでした。

When I was in junior high school, I loved to read these books when classes ended on Saturday mornings, buy ingredients for my cooking at the market, cook my favorite dishes, and eat them while I read the book.

思い返せば、私は、主人公と自分を重ね合わせるように、ティーンの時代を生きてきたような気がします。

Thinking back, I feel like I lived my teen years as if I were superimposing on the main character.

『勉強っていいかも』『学寮っていいかも』『進学すれば、楽しいことがあるかも』と思わせてくれた本だったように思います。

I think this book made me think, "Studying may be good," "School dormitory may be good," and "If I go on to higher education, I may have fun.

-----

「しろばんば」を手にとって、パラパラを読み直してみたのですが、その「読みやすさ」にビックリしました。

I picked up "Shirobanba" and re-read the paraphrase and was surprised at its "readability.

フレーズの長さ、改行の入れかた、物語の登場人物の台詞の内容 ―― いわゆる「ラノベ」と言われているものの基本的技巧が満載で、驚きました。

The length of phrases, the way line breaks are inserted, and the content of the character's dialogue in the story -- I was surprised to find that the book is full of the basic techniques of what is called "Ranobe" (Light Novel).

また、故井上靖先生の本は、どれも「説教くさくない」というところも気にいっています。

I also like that the books by the late Yasushi Inoue are "non-preachy."

『起伏』や『濃淡』なくストーリーが展開されていて、どれも非常に読みやすいです。

The stories are developed without 'ups and downs' or 'shades of gray' and are easy to read.

-----

そういえば、先日、「マークスの山」について書きました。

By the way, I recently wrote about "Mark's Mountain".

「マークスの山」なら、「いいやつ」、「わるいやつ」、「わるいやつだけどいいやつ」というツリーの下に、「検察」「警察」「法曹」「マスコミ」「大学」「民間人」という分類を入れてもらえれば、随分助かります。

私は、北穂高ー槍ルートの5日間の縦走が1回、その後は、富士山登山の1回の経験しかありません。

I have only one experience, a 5-day traverse of the Kita-Hotaka-Yari route, and then one experience of climbing Mt.Fuji.

それでも、登山などを試みてみようと思ったのは、故井上靖先生の「北壁」の影響を受けたから、というような気がしています。

Even so, I feel that the reason I decided to attempt mountaineering was that I was influenced by the late Yasushi Inoue's "Hokuheki(North Cliff)."

読書は、単なる娯楽として楽しめば十分なのですが、ティーンの頃に読んだ本は、その後の人生にも影響を与えやすい ―― のかもしれません。

It is enough to enjoy reading as a mere pastime, but the books you read as a teen are likely to impact the rest of your life -- maybe.

-----

という訳で、ティーンエイジャの皆さん。

So, teenagers.

教師やご両親が『本を読め』とうるさく繰り返すのは、私と同じような体験をされてきたからかもしれません。

Perhaps teachers and parents have had the same experience I have had. Hence, they might loudly repeat, 'Read a book.'

うっとうしいとは思いますが、「大人とは『子どもが本を読んでいるのを見ているだけで安心する生き物」です。

I know it sounds annoying, but "adults are 'creatures that feel comfortable just watching a child read a book.'"

ですので、

Therefore,

―― 太宰や芥川の文庫本を、読みかけのようにして、リビングの床に落しておくだけ

"Drop a paperback book by Dazai or Akutagawa on the living room floor as if you were to continue to read it."

で、多分、皆さんのご両親は、ご機嫌になります ―― 多分。

If so, your parents will be in a good mood -- maybe.

『男性は、女性にとって、ゴキブリとハイエナを足して二で割ったようなものに見えていると思っておくくらいが丁度いい』

2023,江端さんの技術メモ

QGISでノード番号のある場所を見つける方法が分からなくて困っていましたが、ようやく方法を見つけましたので、メモを残します。

この場合、180以下のノード番号が表示されていますが、特定の番号を指定したければ、(例えば、id=3)と入力すれば、そのノードだけが表示されます。

以上

2023,江端さんの忘備録

私は、これまで、自分の家族に、「痛みが100%になってからでは遅い。70%の段階で『叫べ』」と言い含めてきました。

I have always told my family, "It's too late when the pain is 100%. 'Scream' when it's 70%."

でもね、「本日中の復旧断念」というアナウンスを、今(23時)に出して、どーする。

そして、今回、私のメンタル不調を見かねた嫁さんが、何度も『早く上司に報告すべきだ』と言い続けました。

And this time, my wife, who couldn't bear to see my mental illness, kept saying repeatedly, 'You should report this to your boss as soon as possible.

まあ、自分でも、『人に散々語っておきながら、自分は叫べない』では、あまりに「無責任」で「卑怯」だと思いましたので、面談の際に、上司にその旨を報告してきました。

Well, I thought it was too "irresponsible" and "cowardly" for me to "talk a lot to people but not shout myself," so I reported this to my supervisor during the interview.

今、ちょっと、ホッとしています。

Now, I am a bit relieved.

-----

まあ、自分の番になって分かったことですが、

Well, I found out when it was my turn,

―― メンタル不調は、報告しにくい

"Difficult to talk to others about one's mental health problems."

ということです。

第1に「はずかしい」。

First, it is "embarrassing.

自分のメンタル不調を、私より若い上司に報告するのは、結構な勇気がいります。

Reporting my mental illness to a younger boss takes a lot of courage.

私より若い上司は、私より優秀です。

My boss, who is younger than me, is better than me.

そのような優秀な人が、「メンタル不調」を理解できるのかにも不安がありました。

There was also concern about whether such a talented person could understand "mental illness."

第2に、「私(江端)のキャラ外れ」ですね。

Second, it is "out of character for me (Ebata).

普段、ブログやコラムで、偉そうに政府、官僚、会社を批判している私が、このようなことを語るのは、この私でさえ『ギャップ』を感じます。

Even I, who usually criticize the government, bureaucrats, and companies in my blog and columns in a pompous manner, feel a 'gap' when I talk about this "mental illness."

この感じを一言で言えば、

This feeling in a word is,

―― どの口が言ってやがる

"Who the hell do you think you are?"

です。

そして、最大の理由は「メンタル不調は、言語化しにくい」ということです。

And the biggest reason is that mental illness is difficult to verbalize.

『憂鬱な気持ちが続く』『不安感に駆られる』『夜眠れず、寝てもすぐ目が覚めてしまう』『一日中、倦怠感と微熱が続く』『食欲がない』『やる気が出てこない』

"I feel continual depression," "I feel anxious," "I can't sleep at night and wake up soon after sleeping," "I feel tired and have a slight fever throughout the day," "I have no appetite," "I don't feel motivated."

そして何より、『この状態がいつまで続くか分かないことが一番辛い』を説明するのが、本当に難しい。

And above all, it is tough to explain 'the most challenging part is not knowing how long this condition will last.

上記の内容は、『客観的事実』なのですが、口にすると『主観的』に聞こえてしまうのです。

When uttered, the above are 'objective facts' but sound 'subjective.'

-----

私もエンジニアですから、メンタル不調については、色々調べました。

I am an engineer, so I have done a lot of research on mental illness.

その上で、休憩、食事、気分転換など、メンタル不調に良いと言われていることを試みて、なお、この状況がなかなか改善されないことに、愕然としました。

On top of that, I was astonished to find that even after trying everything suitable for mental illness, such as rest, food, and mood swings, this situation still did not improve much.

私の十八番のエンジニアリングアプローチが通用しない ―― メンタル不調、恐るべし

My best engineering approach doesn't work ---- Horrible mental illness

この症状の「手の打ちようのなさ」を痛感するに至りました。

I became acutely aware of the "inaccessibility" of this mental illness.

-----

今回、私は、私は「通院していることと」と「安定剤と睡眠薬を処方されている」という、分かりやすい「客観的事実」を加えて、上司に説明することにしました。

This time, I decided to explain to my supervisor that I was "going to the hospital" and that I was "prescribed stabilizers and sleeping pills," adding the obvious "objective facts."

私の場合、無事、上司に理解して貰えたように思います。

In my case, I think I have successfully made my boss understand.

結局のところ、上司も私もエンジニアであって、エンジニア同士の言語は、はやり「客観的事実」なんだなぁ、と実感しています。

After all, my boss and I are both engineers, and I realize that the language between engineers is, after all, "objective fact.

その後、仕事の内容や量について配慮して貰えることになり、現在は、メンタル不調から、少しずつ回復している感じを実感できて、ちょっと安心しています。

After that, I was considered for the content and quantity of my work, and now I feel that I am gradually recovering from my mental illness, which is a bit of a relief.

それでも、健康管理と体調管理、そしてメンタル管理には、気を抜かないようにしようと心掛けております。

Nevertheless, I try to stay on top of my health, physical condition, and mental health.

-----

メンタル不調は、報告・連絡・相談(ほうれんそう)が重要と言われています。

It is said that reporting, contacting, and consulting (horenso) are essential for mental illness.

ただ、多くの場合、この「ほうれんそう」は、本人の健康管理をおもんばかる体裁を装いつつ、結局のところ企業や組織の理論で書かれている ―― そんな感じがしています。

However, in many cases, this "horenso" is written under the guise of caring for the individual's health care but ultimately based on the theory of the company or organization -- such is the feeling I get.

ともあれ、メンタル不調の報告は、それ自体が恐しく難しいです。

Regardless, reporting a mental illness of mine was itself frighteningly difficult.

普段、えらそうにしている私(江端)ですら ―― というか、私だからこそ ―― 『はずかしい』『キャラ外れ』『言語化困難』の前に、怯(ひる)んでいました。

Even I (Ebata), who usually makes such a big deal out of it... No, it is this me... was intimidated by the "embarrassing," "out-of-character," and "difficult to verbalize" comments.

-----

『誰にも何も言わずに、メンタル不調を自力で乗り越えたい』という気持ちは、本当によく分かります。

I understand the feeling of 'I want to get over my mental illness alone without saying anything to anyone.

そして、事実、多くの人が、そうやって何のアクションも取らずにいることは、簡単に推測できます。

It is easy to guess that many people do so and take no action.

なぜ、私(江端)は、そう言い切れるのか? ―― 自死の半数近くが、メンタル不調を起因とするものであり、その人数が驚くほど多いからです。

Why can I (Ebata) say that? -- Because nearly half of all suicide deaths are caused by mental illness, the number is astonishingly high.

そして ―― メンタル不調が、驚くほど簡単に自死につながりやすいことも、よく知っています。

And -- I know all too well that mental illness can lead to suicide with surprising ease.

コラムでさんざんエラそうなことを書いてきた江端の、この体たらくを知って、少しでも気が楽になって貰えれば、幸いでございます。