未分類

ご相談があります。

1,A1,30,33.59543503,130.3980676
2,A1,30,33.59525629,130.3993336
3,A1,30,33.59323656,130.3984967
4,A1,30,33.59261097,130.3963509
5,A1,30,33.59212837,130.3954712
6,A1,30,33.59243223,130.3971234
7,A1,30,733.5927897,130.3996554
1,A2,60,33.59398255,130.3959787
2,A2,60,33.59364294,130.3985965
3,A2,60,33.59328547,130.3976095
4,A2,60,33.59278499,130.3969657
5,A2,60,33.59265988,130.3953564
6,A2,60,33.59285649,130.4020941
1,A3,120,33.59401761,130.3947008
2,A3,120,33.59389249,130.3972542
3,A3,120,33.5928558,130.3972972
4,A3,120,33.5920336,130.3982198
5,A3,120,33.59205147,130.3995288
6,A3,120,33.5924447,130.3997862
7,A3,120,33.59274856,130.4001081

のように記載されたcsvファイルあります。 A1はカフェの位置座標、A2は飲食店の位置座標、A3は、居酒屋の位置座標、この他、B1からH2までの種類の店舗の位置座標のデータがあります。

一方現在、PostGISを使ったマルチエージェントシミュレーション(MAS)を作成しております。このMASは、帰路の駅に向う途中に気になる店舗があったら、その店舗に立ち因る、という動きをさせたいと思っています。

このMASのシミュレータはすでに完成しており、エージェントも稼動しておりますが、上記の「立ち寄り」のアルゴリズムはまだ実装しておりません。 各エージェントは、エージェント単位に嗜好を持っており、例えば、帰路の途中にカフェ(A1)を、自分の位置から半径15メートル以内に見つけらたら、そこに立ち寄らせたいと思っています。

でご相談なのですが、このような実装を行うに際して、上記のCSVファイルは、どのように利用するのが良いでしょうか。
(1)CSVファイルとして全てを纒めておき、シミュレータ開始前に全部をメモリ上に格納しておき、A1(カフェ)とエージェントの距離が15メートル以内にはいったか否かを随時計算する
(2)CSVファイルをPostgresSQLのDBに格納しておき、上記と同じ処理を行う。
(3)その他

観点は、「計算時間または計算負荷ができるだけ軽量に行える」ということになります。エージェントは1000~10000作って動かすので、時間がかかるのは困るのです。本件についてアドバイスを頂けますようお願いします。

計算負荷を軽減し、効率的にエージェントの「立ち寄り」アルゴリズムを実装するためには、以下のアプローチが考えられます。

アプローチの比較

(1) CSVファイルをすべてメモリにロードして距離計算

メリット:

  • 実装がシンプル。
  • 外部データベースに依存しないため、環境構築が容易。

デメリット:

  • メモリ消費が大きい。特に店舗データが増えると、メモリ上で全てを保持するのが困難になる場合がある。
  • エージェントが増えた場合、すべての店舗との距離を計算する処理が重くなる可能性が高い。

適用場面:

  • 店舗データが少ない場合や、エージェント数が少ない場合に有効。

(2) PostgreSQL + PostGIS を利用する

メリット:

  • PostGIS の空間インデックス機能を使うことで、店舗検索の計算負荷が大幅に軽減される。
    • ST_DWithin を用いることで、指定距離内の店舗を効率よく取得可能。
  • データの永続性が高く、今後店舗データを増やしたり更新する場合の対応が容易。
  • 複雑なクエリが実行可能で、たとえばカテゴリ別の店舗をエージェントの嗜好に基づいてフィルタリングできる。

デメリット:

  • 初期設定やクエリのチューニングに多少の手間がかかる。
  • 外部データベースへのアクセスによる若干のオーバーヘッド。

適用場面:

  • 店舗データやエージェント数が多い場合。
  • データの拡張性やメンテナンス性を重視する場合。

(3) その他の選択肢: ハイブリッド方式

方法:

  • CSVデータをシミュレータ起動時にPostGISにロードし、シミュレーション中はPostGISを利用する。
  • シミュレーション後に、必要に応じて結果を再度CSVや他の形式にエクスポート。

メリット:

  • PostGISの性能を活用しつつ、データ管理はCSVベースでシンプルに保てる。
  • データがPostGISにあるため、他の分析ツールやダッシュボードにも容易に接続可能。

デメリット:

  • CSVのロード処理が必要。
  • PostGISの初期設定が求められる。

推奨アプローチ

(2) PostgreSQL + PostGIS の利用を推奨します。
以下の理由によります:

  1. 計算負荷の軽減: PostGISの空間インデックスを利用することで、エージェントと店舗の距離計算が効率化されます。
  2. 柔軟性: 店舗データが拡張されても問題なく対応可能。
  3. スケーラビリティ: エージェント数が増加しても処理時間を抑えることが可能。

実装例: PostGISでの距離計算

  1. CSVデータをPostGISに格納する
    CREATE TABLE stores ( id SERIAL PRIMARY KEY, type VARCHAR(10), preference INT, geom GEOMETRY(POINT, 4326) ); COPY stores(type, preference, geom) FROM 'path/to/stores.csv' WITH (FORMAT CSV, DELIMITER ',', HEADER TRUE, GEOMETRY 'POINT(longitude latitude)');

     

  2. 距離計算クエリ
    エージェントの位置 (33.595, 130.398) を例とします:

    SELECT id, type, preference, ST_Distance(geom, ST_MakePoint(130.398, 33.595)::geography) AS distance FROM stores WHERE ST_DWithin(geom::geography, ST_MakePoint(130.398, 33.595)::geography, 15);

     

  3. エージェントの嗜好を反映したクエリ
    SELECT id, type, preference, distance FROM ( SELECT id, type, preference, ST_Distance(geom, ST_MakePoint(130.398, 33.595)::geography) AS distance FROM stores WHERE type = 'A1' AND ST_DWithin(geom::geography, ST_MakePoint(130.398, 33.595)::geography, 15) ) sub WHERE preference = 1; -- エージェント嗜好がカフェ(A1)の場合

     


システム構成例

  1. PostGISをバックエンドとしたシミュレータ
    • シミュレーション開始時にPostGISへ接続。
    • 各エージェントが特定の地点を通過するたびに、クエリで立ち寄り候補店舗を取得。
  2. CSV管理を維持したデータフロー
    • 必要に応じてPostGISのデータをCSVにエクスポート。
    • シミュレータ結果を再度CSV形式で保存可能。

これらを基に、システム全体の効率化を図ることをお勧めします。

 

2024,江端さんの忘備録

私、学生の頃、大学→バイト→学寮or下宿のローテーションをしていました。

As a student, I used to rotate between university, part-time job, and dormitory or boarding house.

それ以外のことをやる時間がなかったので、奨学金とバイトの収入と、食費と学費の支出で、ざっくりトントン、またはちょっと黒字くらいでした。

I didn't have time to do anything else, so with my scholarship, part-time income, and food and tuition expenses, I was roughly in the black or maybe a little in the black.

# 奨学金は借金なので、トータルとしては当然に赤字ですが、返済する時間は担保されていました。

# The scholarship is a loan, so the total is obviously in the red, but the time to pay it back was secured.

ですので、私は、ちょっと残った黒字分が出たときは、東南アジアや大陸をフラフラと旅することもできました(当時の日本の"円"は、世界最強の通貨でした)。

So, when I had a little surplus left over, I could travel around Southeast Asia and the continent (the Japanese “yen” was the strongest currency in the world at that time).

リスクを計算せずに、安直に、愚直に、直感に従って、誰にも相談せずに、一人で行動を開始すべきです。他人に相談するのはよくない。特に「親に相談する」は最悪です。

それはさておき。

Aside from that.

-----

闇バイトに手を出す人には若い人が多いようです。そして、その理由のほぼ100%が『借金苦』のようです。

Many people who get involved in black market work are young. And almost 100% of the reasons seem to be 'debt distress.

私の若いころを思い出しているのですが、ギャンブルには興味がなかったし(今もない)、自分を装う方向には感度ゼロでしたし(今もそうだが)、色恋にはご縁が薄く(知らない間にフラれたりしていました)、専門書はそれなりに購入したけど、それでも、借金するほど高価な本はありませんでした。

I remember my youth. I had no interest in gambling (still don't), I had zero sensitivity in the direction of self-promotion (still don't), I had little luck with colorful love (I was dumped without my knowledge), I bought a good amount of technical books, but still, no books were expensive enough to put me in debt.

高額な買い物は、当時で86万円したパソコンでしたが、私は、これをバイトで稼いだ現金で購入しました(ちなみに、このPCの金額は、今でも私史上、最高額です)。

My most expensive purchase was a computer, which cost 860,000 yen at the time, which I bought with cash earned from my part-time job (by the way, this is still the most expensive PC in my history).

当時は、まともなソフトウェアがなかったので、自分で作らなければなりませんでした。時間は取られましたが、ソフトウェア購入の金額はほぼゼロ円でした。

At the time, no decent software was available, so I had to make my own. It took a lot of time, but the software purchase cost almost nothing.

自分で購入したソフトウェア(?)と言えば、"Turbo Pascal"というPascal言語のパッケージでした(2万円くらいだったかな)。

The software(?) I purchased a Pascal language package called “Turbo Pascal” (about 20,000 yen).

-----

で、ふと思ったのですよ。

And then it occurred to me.

―― 一体、やつらは、どこで借金を作っているんだ?

"Where the hell are they getting their debt?"

と。

家庭の経済的な支援が少ない学生や若年層は、学費や生活費を補うために借金をすることがあるかもしれません。

Students and young adults with little financial support from their families may take on debt to supplement their tuition and living expenses.

今は物価も高いです。それが長期的な返済困難を招くことはあると思います。

Prices are high now. I think that can lead to long-term repayment difficulties.

が、どうにも、違和感があるのです。

But, I don't know, it just doesn't feel right.

苦学生は、苦学しながらも勉学を志そうとしている人たちです ―― このような人たちが、スマホの音声ごときで強盗や殺人をするとは、考えにくい ―― 私の中で、人物像が一致しないのです。

Struggling students are people who are struggling and trying to study -- it is hard to imagine that these people would rob or murder someone over the sound of a smartphone -- the personas don't match up in my mind. I don't have the right image of the person.

ですから、私としては、『自己責任 & 免責型フードバンク』というのを、非営利かつ非公式に運用したいなぁ、と思っています。

-----

しかし、調べていくうちに、私の見識が甘かったかもしれないと思い始めてきました。

However, as I looked into it, I thought I may have been naive in my insight.

■『奨学金の返済』 ―― これはよく分かる。就職活動に上手くいかないと、返済の目処が立たないこともあるでしょう。

- 'Scholarship repayment' -- I understand this. If you don't do well in your job search, you may be unable to afford the repayment.

■『治療費による借金』 ―― これも理解できる。でも、こちらはセーフネットの方で担保できるものもあるんじゃないかなぁ。

- 'Debt due to treatment costs' -- this is also understandable. But I think the safety net can secure some of this one.

ちゃんと相談する所に言って、相談すれば、一気に解決はしないまでも、解決へのアプローチについては教えて貰えるような気がします。

I feel that if you go to the right place and ask for advice, you will be able to learn about approaches to solving the problem, even if it is not solved all at once.

私も、『人間嫌い』で人に相談するのは苦手ですので、人のことをとやかくは言えませんが、とりあえず相談に乗ってくれるところが絶無ということはないと思います。

I am also a “misanthrope” and don't like to talk to people, so I can't speak ill of others, but at any rate, I don't think there is any place where you can get advice.

学生のころ、学費の支払いの目処がたたなくて、困っていたとき、学生課に相談しに行ったことがあります。一言で言えば「大学がお金を貸してくれました」。今でも、その恩は忘れていません。

As a student, I once went to the student affairs office to ask for help when I could not pay my tuition fees. In a word, the university lent me money. Even now, I have not forgotten that favor.

『金銭については、相談すれば、色々なパスが見えてくるもんだなぁ』ということを、その時、初めて知ったような気がします。

I think it was then that I learned for the first time that 'if you consult with people, you can see many different paths.

もちろん『それで全てが解決する』などとは、私も思ってはいませんが、闇バイトする前に、やれることはやってみてからの方が良いと思います。

Of course, I don't believe that “that will solve everything,” but I think it is better to do what you can do before you do a black market job.

-----

ちなみに『遊興費(ギャンブルやブランド品の購入)による借金』については ―― そんな奴のことは知らん。借金までして、遊ぶな、買うな、バカ。そんなことはやめて、コトコツ働いて地道に返済しろ

By the way, as for 'debt due to entertainment expenses (gambling and buying brand-name goods)' -- I don't know anyone who does that. Don't go into debt, don't play, don't buy, you idiot. Stop that kind of thing, work hard, and steadily repay your debts.

とまあ、私は、自分に理解できないコトやモノについては、徹底的に冷酷になれる、最低な奴なんですよ。

And, well, I am a pretty lousy guy who can be thoroughly ruthless about things and things I don't understand.

ご存知の通り。

As you know.

2024,江端さんの忘備録

出張先で、ACアダプタを忘れる ―― これは、定番の「出張あるある」ですが、本人にしてみれば、真っ青になる事件です。

Forgetting an AC adapter on a business trip - this is a standard “business trip occurrence,” but it is an incident that would make the person in question pale in comparison.

日帰り出張であれば、ノートPCのACアダプタを忘れてもなんとかかるかもしれません。

If you are on a one-day business trip, you may help yourself even if you forget your laptop's AC adapter.

しかし、出張先で、しかも、電気量販店もないような地方や海外ともなれば、本当にシャレにならない状況になります。

However, the situation becomes embarrassing if you are on a business trip and in a rural area or overseas with no electronics retailers.

―― バッテリーがなくなったら、そこで業務終了

"When the battery runs out, that's the end of the operation."

顧客が激怒している様子が、簡単に予想できます。

It is easy to predict that customers are outraged.

-----

アニメ『新世紀エヴァンゲリオン』では、エヴァンゲリオン(エヴァ)が外部電源から切り離されると、内蔵された非常用電源(内部バッテリー)での稼働が可能ですが、その稼働時間は約5分から6分と設定されていた、と記憶しております。

In the anime Neon Genesis Evangelion, when the Evangelion (Eva) is disconnected from the external power supply, it can operate on its built-in emergency power supply (internal battery). Still, I remember that the operating time was around 5 to 6 minutes.

まあ、「活動内容に関係なく6分間」という設定には、違和感を感じますし、これだけのものを稼動させるだけの科学力があるのであれば、戦闘中のエネルギー供給を無視できるエネルギー源(小型の原子炉)を搭載してもよさそうなものだ、と思いますが ―― そこには突っ込みません。

Well, I feel that the setting of “six minutes regardless of activity content” is strange. If they have the scientific ability to operate something like this, it seems like they could have installed an energy source (a small nuclear reactor) that could ignore the energy supply during combat, but I won't go there.

ともあれ、このエヴァンゲリオンというのは、この「『ACアダプタから分離されたノートPC』のメタファ」であるのだろう、と私は考えています。

This Evangelion is a metaphor for “a laptop computer that has been separated from its AC adapter.”

それはさておき。

Leaving that aside.

-----

ACアダプタのインターフェースも、メーカごとに見事にバラバラです。そして、ACアダプタは、単体でも非常に高価に設定されています(1万円以上することもある)。

The interfaces of AC adapters are also wonderfully different depending on the manufacturer. AC adapters are also costly (sometimes costing over 10,000 yen).

ACアダプタが併用できない状況に対して、EUが是正命令を出しています(特に、Appleに対して、"SDGs舐めんな!"という趣旨)。

The EU has issued a corrective order for situations where AC adapters cannot be used together (particularly for Apple, with the gist of “Don't mess with the SDGs!”).

「そりゃ当然だ」と私でも思います。あんなものは、忘れてきても、いつでもホテルで借りられのが当然のものであると思います。

Even I think, “Of course.” I think it's only natural that you can rent such things at the hotel, even if you forget to bring them.

もっとも、メーカーにも言い分はあるでしょう。ノートPCは、年々どんどん薄く、軽量化されていますので、インタフェースの形状も変えないとやってられない、などなど。

Of course, manufacturers will have their reasons. As laptop computers become thinner and lighter year by year, they can't help but change the shape of their interfaces, etc.

まあ、私が、出張でACアダプタを忘れずに持ち歩くようにすればいいだけのことですけどね。

Well, I must remember to take my AC adapter with me on business trips.

-----

本日、私、出張していたのですが、USBーEhternet変換アダプタを持ってくるのを忘れて、GoogleMAPで、駅近くの家電量販店を探して、なんとか見つけ出し、安くないお金を支払って購入し、その後、出張先まで走り続けました ―― そして、足の甲を痛めました。

I was on a business trip today, but I forgot to bring a USB-Ethernet conversion adapter. So, I used Google Maps to find a large electronics store near the station. I managed to see it, paid a lot of money, and then ran to my business trip destination—and hurt my instep.

今も、変な歩き方をしています。

I still walk strangely.

まあ、これも、先日お話した、「私の心配性」がなせる業ではあったのですが、このアダプタがあったお陰で、本日のシステム構築で、不良箇所が、いくぶん特定できました。

Well, this was also the result of my worrying nature, as I mentioned the other day, but thanks to this adapter, we could identify some of the faulty parts in today's system construction.

もし、生れ変ることがあるなら、今度は、この心配性パラメータを、現在の"0.3"くらいの係数にして欲しい、と願うばかりです。

安くない買い物でしたが、その価値はありました。

It wasn't cheap, but it was worth it.

-----

で、このUSBーEhternet変換アダプタですが、私の部屋に3つくらいあります。

And I have about three of these USB-Ethernet conversion adapters in my room.

こうして、また私の部屋には、デジタルガジェットが増えていくのです。

And so, my room is once again filled with more digital gadgets.

「パパ! どうして、こんな凄いものを、もっと早く購入してくれなかったの!」

2024,江端さんの忘備録

先日の学会発表では、散々な目にあってきた、というお話をしました。

At a recent academic conference, I talked about the terrible things that had happened to me.

―― ホテルの前に立った瞬間、ヤニの匂いが漂ってきた。

私は、CASIOの電波腕時計 WAVE CEPTORを愛用しています。

I use a CASIO WAVE CEPTOR radio-controlled watch.

この時計は1日1回、 福島または佐賀の2つの送信所から遅られてくる時刻情報の電波を受信して、時刻補正をしています。

This clock receives time correction signals from two transmission stations in Fukushima or Saga once a day.

逆に言えば、その電波が掴めなければ時刻補正ができません。

Conversely, if you can't catch that signal, this watch won't be able to adjust the time.

時刻補正ができないだけならいいのですが、 WAVE CEPTORは、時刻補正が行われないと、2001年1月1日にリセットしてしまうのです(仕様なのか寿命なのかは分かりませんが)。

If it were just a matter of being unable to correct the time, it would be fine, but WAVE CEPTOR resets to January 1st, 2001, if the time is not corrected (I don't know if this is a specification or a lifetime issue).

学会期間中、2001年1月1日の意味不明の時刻しか分からずに、いちいちスマホやPCで時間を確認せねばならず、ひどく難儀をしました(アナログ補正方式で対応していましたが)。

During the conference, I had to check the time on my smartphone or PC every time, as I only knew the time of January 1st, 2001. It was a huge hassle (although I was using an analog correction method).

GPSで補正する時計もありますが、まだまだ値段が高いです。

Some watches use GPS to make corrections but are still expensive.

てっとり早いのは無線LANですが、こちらはアクセスポイントのIDやパスワードの設定が必要になるようです。

The quickest way is to use wireless LAN, but you must set the access point ID and password.

壁掛け時計ならともかく、腕時計には使えないようです。

You can't use it as a wristwatch, even though you can use it as a wall clock.

-----

無線LANのビーコン信号(ブロードキャスト(常に周囲全体に向けて送信)されている)に、時刻情報を放り込んでおけばいいのに、と思うんですけどね。

I think it would be a good idea to throw time information into the beacon signal of wireless LAN (broadcast (always transmitted to the entire surrounding area))

ただ、それをやると、無線LANのアクセスポイント自体に時刻補正機能が必要となって、で、無線LANのアクセスポイントは上位サーバとの時刻同期が必要となって、そうなると、基幹のNTPサーバの負荷が重くなって ・・・ うん、滅茶苦茶に面倒が増える。

However, the wireless LAN access point will need a time correction function if you do that. The wireless LAN access point will need to synchronize its time with the upper-level server, and if that happens, the load on the core NTP server will increase... yeah, it will be a lot more troublesome.

つまるところ、『次女がダイソーで購入した900円の時計(私が電池を入れ替えたもの)を、私が持ち歩く』ということが、世界のために最もコストが安い(SDGsに貢献する)、という結論になりました。

Ultimately, I concluded that the most cost-effective (and SDG-friendly) thing for the world would be carrying around the 900 yen watch that my second daughter bought at Daiso (and I changed the battery).

「そこに怪我人がいれば、助けるのが医者だ」と「そこに動かない時計があれば、動かすのがエンジニアだ」というセリフが等価なのかは分かりませんが ――

そういえば、私、長女の結婚式の時に、この900円の時計をしていこうと思っていました。

I considered wearing this 900 yen watch to my eldest daughter's wedding.

『殆どの人は、900円の時計か9万円の時計か、見分けがつかない』とか、勝手に思い込んでいますか ―― 正直なところ、私は良く分からないです(少なくとも、私(江端)は見分けがつきません)。

I've decided that 'most people can't tell the difference between a 900 yen watch and a 90,000 yen watch'.I don't understand (at least, I (Ebata) can't tell the difference).

そもそも、私は「9万円の男」ではなく、「900円の男」である、という自負がありますから、全然構いませんでしたが。

To begin with, I am proud to say that I am not a “90,000 yen man”, but a “900 yen man”, so I was completely fine with it.

逆に驚いたのは、『家族から一人も反対意見がでなかった』ということです。

I was surprised that 'not a single family member had any objections.'

-----

『結婚式披露宴には、腕時計をしてはいけない』―― のだそうです。なんでも、『時間を気にすることがモラルに反する』のだそうです。

'You shouldn't wear a watch to a wedding reception' - that's what they say. Apparently, 'worrying about the time is against morals'.

私、そういうルール、全然知りませんでした。

I didn't know about those rules at all.

しかし、私、これまでの結婚式披露宴、100%腕時計してきました。

However, I wear a watch at 100% of all wedding receptions.

それに、結婚式披露宴の司会者している時に、「時計なし」で式進行するなど、不可能だったと思う。

Also, when I was the MC at a wedding reception, I didn't think it would have been possible to go through the ceremony without a watch.

2024,江端さんの忘備録

先日、長女が実家に帰省していたので、録画しておいた「“死の迎え方” ヒトの穏やかな死とは」を、無理矢理、視聴させました。

The other day, my eldest daughter was visiting her parents, so I forced her to watch the video I recorded for the program “How to Die: A Peaceful Death for Humans.”

長女が、チャンネルを変えないように、私が横でずっとつきっきりでした。

I stayed by her side to ensure she didn't change the channel.

この番組では、現代における人間の死生観と終末期医療の変化について探求していました。

This program explored the changing views of death, dying, and end-of-life care in modern times.

私は、「この私(江端)が、穏やかな最期を迎えるための身体的変化」について、長女の頭に叩き込んでおきたかったのです。

I wanted to make sure that my eldest daughter understood that I was going through physical changes to have a peaceful death.

この番組で、私が長女に教え込みたかったのは以下の2点。

There were two things I wanted to teach my eldest daughter through this program.

(1)死期5年前から、栄養を摂取していたとしても、BMI(ざっくり言えば体重)は減少する。それゆえ、無理に食べさせたり、飲ませたり、点滴させる意味はない。

(1) Even if the patient has been receiving nutrition for five years before death, their BMI (roughly speaking, their weight) will decrease. Therefore, there is no point in forcing them to eat, drink, or receive an IV drip.

(2)外部から見ると呼吸困難のように見えても、酸素が欠乏することによって脳内でエンドルフィンが分泌され、穏やかな気持ちになっている可能性が高い。それ故、延命処理を施すと苦痛を長引かせることになる。

(2) Even if it looks like the patient is having breathing difficulties from the outside, it is highly likely that the brain is secreting endorphins due to a lack of oxygen and that the patient is feeling calm. Therefore, administering life-prolonging treatment will only prolong their suffering.

-----

これ、私の経験にも合致するのです。

This also matches my own experience, as shown in the following.

- 食欲のない父に、介護士が、無理矢理スプーンを突っ込んでいた風景に、ショックを受けたこと

- I was shocked by the scene of the caregiver forcibly shoving a spoon into my father's mouth, who had no appetite.

- (姉に聞いた話ですが)、大量の点滴を打った後、父が苦しみでのたうち回っていたこと

- (I heard this from my older sister) After being given a large amount of intravenous fluids, my father was writhing in agony

などです。

-----

私は、長女にこの番組を見ながらお願いをしていたのです ―― 「私が『食べたくない』『飲みたくない』といったら、どうか放っておいてくれ」と。

While watching this program, I asked my eldest daughter, “If I say ‘I don't want to eat’ or ‘I don't want to drink,’ please leave me alone.”

加えて、『苦痛を長引かせるだけの延命処置も止めてくれ』、とも。

In addition, I also said, “Please stop life-prolonging treatment that only prolongs suffering.”

江端:「つまり、『自分の手で親を殺す』という後ろめたさから逃れるためだけに、そのツケ(苦痛)を私に払わせるな、と、頼んでいるんだ」

Ebata: “In other words, I ask you not to give me pain for escaping the guilt of ‘killing own parents with your own hands.’”

長女:「でも、『自分の手で親を殺す』という決断は重いなぁ。パパが、私をラクにさせるためだけに、その苦痛を我慢してれない?」

Eldest daughter: “But the decision to ‘my parents with my own hands’ is serious. Can't you bear the pain for my sake?”

江端:「ふざけるな」

Ebata: “Don't mess around.”

-----

皆さん。もう覚悟しましょう。

Everyone, let's get ready.

私たちの人生で最も苦しい親孝行とは、自分の判断で親を殺すことです。

The most painful form of filial piety in our lives is to kill our parents on our judgment.

―― 父を『殺す』決断を下すこと

(↑クリックでコラムに飛びます)

(Click to go to the column)

2024,江端さんの忘備録

先日、「チ。-地球の運動について」に関してコメントを記載しました。

The other day, I commented on “Chi: About the Movement of the Earth.”

―― アニメ「チ。-地球の運動について」を、アメリカ合衆国で放送したら、何が起こるだろうか

この物語のテーゼである「天動説 v.s 地動説」の歴史については、私は、是非とも、サイモン・シンさんの著書『宇宙創成』(原題:Big Bang: The Origin of the Universe)をお勧めしたいのです。

As for the history of the thesis of this story, “Ptolemaic theory vs. Copernican theory,” I recommend Simon Singh's book “The Big Bang: The Origin of the Universe.”

この本は、以下にも記載していますが、

As mentioned below, I have already written about this book.

―― 自分が良いと思うものが、他人が良いと思うとは限らない

で、実はこの話、まだ、続きがあります。

And I also continued the story.

―― 「コンテンツエバンジェリスト(コンテンツ伝道者)」

このように、先生の『宇宙創成』という本に対する熱い思いは、娘には伝わらず、私に間接的に伝わったのみです。

In this way, my daughter did not understand her teacher's passion for the bookBig Bang: The Origin of the Universe" I only understood it indirectly.

先生、あきらめましょう。私たちの宇宙に対する熱い思いは、子どもたちには伝わらないんですよ。

Let's give up, Sensei. Our passion for space won't be conveyed to the children.

それはさておき

Leaving that aside

-----

最新の「チ。-地球の運動について」の第9話、『きっとそれが、何かを知るということだ』では、天動説の完成に至らなかった老天文学者がこう語る場面があります。

In the latest episode of “Chi: About the Movement of the Earth”, Episode 9, “I'm sure that's what it means to know something”, there is a scene where an astronomer who did not complete the geocentric theory says this.

―― 天動説が誤っていたとしたら、天動説に命を捧げてきた過去1000年間の天文学者達の挑戦は一体何だったのだ? その挑戦には、何の意味もなかったのか?

If the geocentric theory was wrong, what was the point of the astronomers who had devoted their lives to it over the past 1000 years? Was their challenge meaningless?

私はこの問いに答えを持ち合わせていませんが、論理的に考えれば、『何の意味もなかった』という結論になるでしょう。血も涙もない絶対零度の解答ですが。

I don't have an answer to this question, but if you think about it logically, you'll probably conclude that it 'didn't mean anything.' It's a heartless, bloodless answer.

さて、ここから本題に入ります。

Now, let's get down to the main topic.

この『宇宙創成』には、天動説(※地動説ではなく天動説)を完成させるために様々な挑戦が行われてきた記録が数多く紹介されています。そして、これが本当に面白いのです。

ThisBig Bang: The Origin of the Universe introduces many records of the challenges to perfecting geocentric theory (not heliocentric theory). And this is interesting.

これだけの資料を目にすれば、『もしかすると、天動説って正しいのでは?』と思わせるほどの迫力と説得力を持ったロジックが次々と登場します。

When you see all this material, you can't help but think, “Maybe the geocentric theory is correct?” as the logic that appears one after another is so powerful and convincing.

しかし、限られた天文観測情報と絶対的価値観(キリスト教信仰)が支配していた時代において、命を懸けて「宇宙の真理を明らかにしようとした人たちの闘い」に思いを馳せると、たとえ『何の意味もなかった』という結論に達してしまうとしても、私は胸が熱くなるのです。

However, when I think about the struggles of those who risked their lives to “reveal the truth of the universe” in an era when limited astronomical observation information and absolute values (Christian beliefs) dominated, even if I conclude that “it was meaningless,” my heart still fills with emotion.

-----

私が現在進めている研究は、現時点では評価されていません。未来においても評価される可能性は低いでしょう。また、近い未来には、私のアプローチよりも簡単な方法が見つかるかもしれません。それは、私自身、既に理解していることです。

The research I am currently pursuing is not valued and is unlikely to be valued in the future. In addition, it is possible that a simpler method than my approach will be found soon. I already understand this.

それでも私は、自分の研究をやめるつもりはありません。

Even so, I have no intention of stopping my research.

では、私は何のために研究を続けているのか ――

So, what am I continuing my research for?

私は、世の中を1mmでも動かしたいとか、誰かの踏み台になれれば良い、といった野望があるわけではありません

I don't have any ambitions to move the world by even 1mm or to be someone's stepping stone.

私は、私の人生の中でやれることの最後をただ確認するためだけに、研究を続けているのです。

I continue my research to confirm the end of what I can do in my life.

未分類

GStreamerにおけるkeep-listeningの機能は、主にSRTプロトコルの特性に基づいて設計されています。SRTはストリーミング中のネットワーク障害や接続の一時的な切断に対して高い耐障害性を持ち、再接続をプロトコルレベルでサポートしています。このため、GStreamerのSRTプラグインにはkeep-listeningオプションが実装されており、再接続処理が標準で可能となっています。

一方で、RTSPプロトコルは再接続に対する標準的なメカニズムを持っておらず、ストリーミング接続が切断された場合にはアプリケーション側で再接続処理を実装する必要があります。この理由は以下の通りです:

  1. プロトコルの設計思想の違い
    SRTはリアルタイムのビデオ伝送を想定し、途切れた接続を回復するための仕組み(例:パケットの再送や接続の再試行)が組み込まれています。一方、RTSPは主にコントロールプロトコルとして設計されており、接続の維持や再接続は仕様の範囲外です。
  2. GStreamerプラグインの実装方針
    GStreamerのRTSPプラグイン(rtspsrc)は、RTSPプロトコルの標準に忠実であり、アプリケーション側で自由に再接続ロジックを実装できるよう設計されています。このため、keep-listeningのようなオプションはRTSPプラグインに含まれていません。
  3. 運用環境での要件
    RTSPストリームの中断や切断が発生する状況は、ネットワーク環境やストリーミングサーバーの設定に依存するため、再接続の実装はユーザーごとの要件に基づいてカスタマイズされることが一般的です。

これらの理由から、RTSPでkeep-listeningを実現するには、アプリケーション側でエラー検知と再接続処理を実装する必要があります。これは、RTSPの特性に起因する設計上の制約であり、プロトコルやGStreamerプラグインの動作仕様によるものです。

------

今回の質問は、
『GStreamerでSRTはKeep-listening が使えるのですが、RTSPではkeep-listeningが使えません。この理由を上司に説明できる文章として作成して下さい』
としました。

我ながら、色々なChatGPTの姑息な使い方ができるようになってきたものだと、自分に感心しています。

未分類

Amazon Primeで「深夜食堂」を流しながらコーディングしています。

「深夜食堂」について調べてみたら、原作本については世界中で翻訳されているみたいですが、ドラマのリメイクも、中国、台湾、韓国でされていて、放映されているようです。

舞台などにもなっているそうです ―― で、情報のウラは取れなかったのですが「フランス」でリメイクだか、舞台だかが、あったとかなかったとか。

「フランス版深夜食堂」。うん、なんか、凄く見たい。

「ドイツ版深夜食堂」「ロシア版深夜食堂」はイメージできる。

北欧もイメージできる。

西欧であれば、スペイン版とかイタリア版とかも見てみたい。

イスラム圏の深夜食堂 ―― アルコール抜きバージョンも、可能なら見てみたいです。

2024,江端さんの忘備録

『ダイクストラ計算を行った結果を、(1)'Dummy Rail Line'が連続するリスト、(2)(1)'Dummy Bus Line'が連続するリスト、(3)その他のリストに分割するプログラムに改造しつつ、(1)(2)(3)はその順番通りにリストを作成し、(1)(2)(3)が、2度以上出てくる場合は、別のリストとして取得するには、どうコーディングすれば良いのか?』(読まなくていいです)

'How should I code to create lists (1) 'Dummy Rail Line' in succession, (2) 'Dummy Bus Line' in succession, and (3) other lists while modifying the program to divide the results of the Dijkstra calculation into these three lists, and to obtain a separate list if (1), (2), or (3) appears more than once? (You don't need to read this.)

上記のコーディング方法について、今朝の深夜までもんもんと考え続けていました。

I kept thinking about the coding method above until late this morning.

ところが、朝方、夢の中で、この方法が、天からの啓示のごとく突如閃きました。

However, this method suddenly flashed into my mind in the morning like a revelation from heaven.

『ChatGPTにプログラム作成してもらおう』

“Let's have ChatGPT create a program for us.”

-----

先程、ChatGPTが作ってくれたプログラムの稼動を確認しました。

I just checked to see if the program ChatGPT created is working.

ようやくホッとしていますが(今から少し寝ます)、同時に『問題を考えなくなっていく自分の頭が、どんどん悪くなっている』を痛感しています。

I'm finally feeling relieved (I'm going to sleep for a bit now), but at the same time, I'm acutely aware that 'my brain, which is no longer thinking about problems, is getting worse and worse.'

これは、これで、かなり恐しいことだと思っています。

I think this is quite a frightening thing.

-----

すでに、この業界では、この問題の弊害が出ているそうです ―― かなり広範囲に、しかも相当に深刻な弊害です。

I hear that the harmful effects of this problem are already being seen in the industry - quite severe and widespread.

ソフト外注に発注した人が、発注したプログラムの内容について開発者に質問しているうちに、

While the person who ordered the software was asking the developer questions about the content of the program they ordered, it turned out that -

- そのプログラム開発者が、プログラマとして働き始めて、1年のキャリアもないこと

- the program developer had only been working as a programmer for less than a year

- そのプログラム開発者が、"サブルーチン"とは何かを知らなかったこと(注: サブルーチンという概念を知らなかった)

- the program developer did not know what a “subroutine” was (Note: He did not know the concept of a subroutine)

ことが、分かったそうです。

今、世界中で、そういう開発者たちが作成するプログラムが、大量生産されていると考えて間違いないでしょう。

It might be possible to assume that such developers mass-produce programs worldwide.

これも、これで、かなり恐しいことだと思っています。

I think this is also quite a frightening thing.

何が言いたいのかというと、「こういうプログラムを組める『私』には、市場価値があるのか、それとも、ないのか」、です。

未分類

hakata_ex_cost_db=# \e 
 start_seq | end_seq | line_name
 -----------+---------+-----------------------------------

1 | 6 | Dummy Railway Line JR鹿児島本線
7 | 7 | Dummy Railway Line JR篠栗線
8 | 10 | Dummy Railway Line 地下鉄航空線
12 | 12 | Dummy Bus Line 天神エリア限定バス
という結果が出てきました。start_seq と end_seq が同じ番号になっているところがありますが、これは、どのように解釈すれば良いでしょうか


SELECT seq, node, edge, cost, agg_cost FROM pgr_dijkstra('SELECT gid as id, source, target,length_m as cost FROM ways',66619, 92554, false);

WITH path AS ( SELECT seq, node, edge, cost, agg_cost FROM pgr_dijkstra( 'SELECT gid as id, source, target, cost, reverse_cost FROM ways', 66619, 92554 ) ), full_path AS ( SELECT path.seq, path.node, path.edge, path.cost, path.agg_cost, ways.length_m AS length_m, ways.name AS line_name FROM path LEFT JOIN ways ON path.edge = ways.gid ) SELECT seq, node, edge, cost, agg_cost, length_m, line_name FROM full_path ORDER BY seq;

----- ダイクストラ66619, 92554 の結果の一覧表示

WITH path AS (
    SELECT 
        seq, 
        edge, 
        b.name AS line_name,
        b.the_geom
    FROM 
        pgr_dijkstra(
            'SELECT gid as id, source, target, cost, reverse_cost FROM ways',
            66619, 92554
        ) a
    INNER JOIN 
        ways b 
    ON 
        a.edge = b.gid
    ORDER BY seq
)
SELECT 
    MIN(seq) AS start_seq,
    MAX(seq) AS end_seq,
    line_name
FROM 
    path
WHERE 
    line_name LIKE '%Dummy Railway Line%'
    OR line_name LIKE '%Dummy Bus Line%'
GROUP BY 
    line_name
ORDER BY 
    start_seq;

以下のSQL文で、"Dummy Rail Line""Dummy Bus Line" に該当する start_seqend_seq を取得できます。


SQL文

WITH path AS (
    SELECT 
        seq, 
        edge, 
        b.name AS line_name
    FROM 
        pgr_dijkstra(
            'SELECT gid as id, source, target, cost, reverse_cost FROM ways',
            66619, 92554
        ) a
    INNER JOIN 
        ways b 
    ON 
        a.edge = b.gid
    ORDER BY seq
)
SELECT 
    MIN(seq) AS start_seq,
    MAX(seq) AS end_seq,
    CASE 
        WHEN line_name LIKE '%Dummy Railway Line%' THEN 'Dummy Rail Line'
        WHEN line_name LIKE '%Dummy Bus Line%' THEN 'Dummy Bus Line'
    END AS line_type
FROM 
    path
WHERE 
    line_name LIKE '%Dummy Railway Line%'
    OR line_name LIKE '%Dummy Bus Line%'
GROUP BY 
    CASE 
        WHEN line_name LIKE '%Dummy Railway Line%' THEN 'Dummy Rail Line'
        WHEN line_name LIKE '%Dummy Bus Line%' THEN 'Dummy Bus Line'
    END
ORDER BY 
    start_seq;

 

SQL文のポイント

  1. WITH句で経路情報を取得:
    • pgr_dijkstra の結果に ways.name を結合して、全経路のエッジ情報を準備します。
  2. CASE文で分類:
    • line_name に基づき、Dummy Rail LineDummy Bus Line の2種類に分類します。
    • この処理により、元の路線名が詳細でも、2つのカテゴリに整理されます。
  3. MINMAX で開始と終了を取得:
    • 経路順序 (seq) の最小値 (start_seq) と最大値 (end_seq) を取得します。
  4. グループ化:
    • CASE文で分類された路線タイプごとにグループ化 (GROUP BY) します。
  5. ソート順序:
    • 結果は start_seq の順に並びます。

結果例

以下のような結果が得られます:

start_seq end_seq line_type
1 10 Dummy Rail Line
12 15 Dummy Bus Line

注意事項

  • 必要に応じて、WHERE 条件や LIKE 演算子を調整してください。
  • 出力をさらに簡潔にしたい場合や、追加情報が必要な場合はお知らせください。適切に対応します。