これが出題
嫁さんの答え
江端のアルゴリズムによる答え
直感的に、私のアルゴリズムが勝っていると思うんだが・・・。
30人を3台のバスで運行するDARPに拡張したバージョン
多分、そこそこ合っていると思うんだけどなー。DARPは正解が分からない(NP困難)問題だからなー。
以上
江端智一のホームページ
これが出題
嫁さんの答え
江端のアルゴリズムによる答え
直感的に、私のアルゴリズムが勝っていると思うんだが・・・。
30人を3台のバスで運行するDARPに拡張したバージョン
多分、そこそこ合っていると思うんだけどなー。DARPは正解が分からない(NP困難)問題だからなー。
以上
func totalDistance(sliceA []int, prt int) (dis float64, sliceB []int, max_Bus_Count []int)
という関数を作ったのはいいが、これの呼び出しが上手くできずに、ここ数日作業が滞っていました。
結果としては、正解は以下の通り
var sliceZ [100][]int // または、sliceZ := [100][]int{}
var totalDis [100]float64 // または、totalDis := [100]float64{}
max_Bus_Count := []int{} // または、var max_Bus_Count []inttotalDis[0], sliceZ[0], max_Bus_Count = totalDistance(sliceZ[0], 1)
であり、よく分からんのが、":="と "{}"のペアだが、多分、初期値を放り込めるようにしているものだろう(ここでは入れていないが)。
C言語で書くとこんな感じかと。
#include <stdio.h>
int main() {
int sliceZ[100][90];
double totalDis[100];
int max_Bus_Count[3];int a = totalDistance(sliceZ[0], 1, totalDis[0], max_Bus_Count);
}int totalDistance(int slizeZ, int *p, double totalDis, int max_Bus_Count) {
return 0;
}
こうやってみると、Goの配列宣言は、配列が動的に記載できる分、分かりにくいと思う。
なんで、C言語の宣言を踏襲してくれなかったかなーと思うのだが、
サイズを指定して宣言するもの。実体的な値。メモリを参照するものではない。
a := [3]int64{1, 2, 3}
故に、
a := [3]int{1, 2, 3}
b := a
とすると、aとbが、別のメモリ領域に展開される
sliceはarrayへの参照を持つデータ構造
s1 := []int{1,2,3} # ここで配列の数(例"3")を宣言しないのがミソ
s2 := s1
s2[1] = 0
こっちは、s1とs2が同じ値になる。
append()で要素数を追加する
昨日は、珍しく家族で食事に行ってきました。
Yesterday, I went out for a rare family dinner.
最近は、娘たちの方の時間が全く取れず、昨夜や奇跡的な確率で、全員が揃いましたので、即時に外食を決断しました。
Recently, my daughters have not been able to spend any time with me, however, last night, by some miraculous chance, we were all together, so I decided to eat out immediately.
昨夜のネタの一つに、『嫌いな人間への片思い』がありました。
One of last night's stories was "Unrequited Love for a Person I Hate".
江端:「なぜ、この熱い想い『お前が嫌いだ』が伝わらないのか、ということだな」
Ebata: "Why can't I get this passionate feeling of 'I hate you' across?"
家族は、不思議そうな顔をして、ツッコんできました。
My family looked at me strangely and gave me a witty comment.
嫁さん:「パパは、そういうことを普通に、口頭で伝えるでしょう?」
Wife: "Dad, you usually tell people those things verbally, don't you?"
江端:「人をサイコパスみたいに言うな。私は、普通の保身重視の小心なサラリーマンだぞ」
Ebata: "Don't talk about me like I'm a psychopath. I'm just a normal, defensive-minded, small-minded businessman."
といったら、家族が『ケッ』みたいな顔をしました。
When my family heard this, they looked at me like, "Damn".
いやいや、本当 ―― コラムの中で書いていることを、日常的に語っていたら、社会的に死にます。
To tell you the truth, if I talked about what I write in my columns on a daily basis, I would die socially.
サラリーマンの生存戦略とは、『内心を隠し、上司に阿(おもね)て、部下に無難に接する』 ―― この一言に付きます。
The survival strategy for business persons is to hide their inner secrets, defer to their superiors, and play it safe with their subordinates.
が、まあ、それはさておき。
Well, that's beside the point.
-----
江端:「スキーイベントとか企画している時・・・」
Ebata: "When I made a plan of ski events..."
嫁さん:「パパがスキーイベントなんか企画したことあるの?」
Wife: "Have you ever organized a ski event?"
江端:「結婚後、数年間ほど会社の同僚と、研究所のスキーやらテニスやらに一緒に参加していただろう」
Ebata: "After we got married, we would go skiing and play tennis with my colleagues at the institute for a few years.
嫁さん:「あ、そうか。パパって、出会った時から、今のキャラをしていたような気がしていた」
Wife: "Oh, I see. I had a feeling you'd been the character you are now from the moment we met."
江端:「学生時代も社会人になってからでも『こいつだけとは、一緒に行きたくない』という奴がいるんだけど、どういう訳か、私のスキーの企画に入り込んでくるんだ」
Ebata: "When I was a student and even after I became an adult, a guy who was 'I don't want to go with just this guy,' appeared, and for some reason, he would get involved in my ski projects.
娘:「声をかけなければいいじゃんか」
Daughter: "Why don't you just not talk to him?"
江端:「もちろん、声なんぞかけていない。露骨に目の前で『一緒に行きたいな~』とか言われても、ニコニコして、そのまま話を流していたぞ」
Ebata: "Of course, not. I didn't say anything to them. Even when he blatantly said in front of me, 'I want to go with you,' I just smiled and left."
娘:「なんで入ってくるの?」
Daughter: "Why were he coming in?"
江端:「参加者の一人が、勝手に入れてきやがるんだよ」
Ebata: "One of the participants was even letting him join on their own."
娘:「断わればいいじゃん」
Daughter: "Why don't you just say no?"
江端:「『俺、あいつ嫌いだから断ってくれ』って、言えるか? 無理だろう?」
Ebata: "Can you say, 'I don't like that guy, so please turn him down ?& You can't, can you?"
娘:「他の人ならともかく、パパなら言えると思うんだが」
Daughter: "I don't know if it's anyone else, but I think Dad can tell them."
江端:「言えるか! パパの交友関係は、その時点で破綻だ」
Ebata: "No way! My friendships would be broken at that time"
娘:「そもそも、パパに交友関係なんかないじゃんか?」
Daughter: "You don't have any friendships to begin with, do you?"
江端:「それは、『今のパパ』だ! 昔は、テニス部のキャプテンという、リア充の中のリア充だったんだ。『サービスを打てないテニス部キャプテン』って ・・・ 思い出したら、腹が立ってきたな」
Ebata: "That's 'me' now! I used to be the head of the tennis club, the realest of the real, and they used to call me 'the head of the tennis club who can't hit a service. I am starting to piss me off when I remember.
嫁さん:「で?」
Wife: "And?"
江端:「どんな恋愛にも負けないくらいの熱い想いで、『お前が嫌いだオーラ』を発していたんだけど、どうして、この想いが伝わらないんだろう ―― と」
Ebata: "I was emitting an aura of 'I hate you' with a passion that rivaled that of any other relationship, but I wondered why this feeling was not being conveyed.
嫁さん:「なるほど」
Wife: "I see."
江端:「これは、『お前が嫌いだオーラ』を受けとる側の鈍感に腹が立ったけど、同時に、私自信も『お前が嫌いだオーラ』を受けとれていないのだろう、と確信した」
Ebata: "This made me angry at the insensitivity of the person receiving the aura of 'I hate you', but at the same time I was convinced that I myself was not receiving the aura of 'I hate you'."
嫁さん:「で?」
Wife: "And?"
江端:「私の辿りついた行き先が『ぼっちスキー』だ。思えば、私の『ぼっちの歴史』の出発点は、あそこだったような気がするなぁ・・・」
Ebata: "I ended up in a place called 'Skiing Alone'. When I think about it, I feel like that was the starting point of my 'history of being alone'..."
-----
(1)そもそも、私はスキーが好き
(1) I like skiing in the first place.
(2)好きな人と一緒に行くスキーは、(1)よりも好き
(2) I like skiing with the person I like better than (1).
(3)嫌いな人と一緒に行くスキーは、(1)(2)を越える不快がある
(3) Skiing with someone I don't like is more uncomfortable than (1) and (2).
この上記(1)~(3)を満たす最適解は、『ぼっちスキー』しかありません。
The only optimal solution that satisfies the above (1) to (3) is 'skiing alone'.
(To be continued)
最近、自分で電子書籍をリリースをしている経緯から、他の人の電子書籍を目にするようになりました。
Recently, I've been seeing other people's e-books because of my own background in releasing e-books.
―― 私が困っていることに関して、的確にヒットする本が多いな
"So many books that hit exactly the right spot regarding what I'm having trouble with"
と感心しています。
I'm impressed.
考えてみれば当然なのですが、一般の書籍は、それなりの出版数が見込めないと、出版には至れません。
It is natural to think about it, but a general book cannot be published unless a certain number of publications can be expected.
ニッチな技術分野の内容なんぞ、普通に考えて売れる訳ありません。
There is no way that content in a niche technical field can be sold in a normal way.
しかし、電子書籍の場合は、基本的には、中間コスト(編集、装丁、運送、書店で書架、返品)が必要ありません。
However, in the case of e-books, there are basically no intermediate costs (editing, binding, shipping, bookstore shelves, returns).
その分、コストも安いです。
The cost for this is also low.
-----
私のようなエンジニアには、一般の書籍の内容では足りないことが多いです。
For an engineer like me, the contents of general books are often not enough.
例えば、GTFSのデータフォーマットやデータ取得方法とか、AWSのIAMの設定方法とか、データエンジニア、クラウドエンジニアにとっても、スコープ外です。
For example, the GTFS data format and how to retrieve the data, or how to set up AWS IAM, are out of scope even for data engineers and cloud engineers.
私の執筆した、Bayolinksやら、PostGISなんぞも、多くのエンジニアにとっては、謎の用語でしょう。
My writings on Bayolinks, PostGIS, etc., are probably a mystery to many engineers.
そもそも、儲けることを目的としているなら、こんな出版は全く不合理です。
If your goal is to make money in the first place, this kind of publication is completely absurd.
-----
他の分野の電子書籍については知りませんが、技術分野に関して言えば、通常の書籍の市場原理とは異なる理論で動いているように思えます。
I don't know about other fields of e-books, but when it comes to the technology field, it seems to be driven by different theories than the normal market principles for books.
(1)利益に関係なく、自分の知見を、自分が忘れた時の為にメモしておき、
(1) Write down my findings when I forget them, regardless of profit, and
(2)『他人に読んで貰う』ことを意識することで、きちんとした文章構成を行い、
(2) By being aware of the fact that "others will read it," I will be able to structure my sentences properly, and
(3)執筆に費やした時間分のコストを、少しでも回収できれば良い
(3) It's good if I can recoup some of the cost of the time I spent writing.
という感じですね。
like the above.
-----
まあ、本の内容は、プロの編集者が入っていない分、ちょっと読みにくいと思うこともあります。
Well, sometimes I think the books are a bit difficult to read because they don't have a professional editor in them.
しかし、エンジニアであれば、その読み難さも「行間で読み切れる」、と思っています。
However, as an engineer, I believe that they can read between the lines, even if it is difficult to read.
『二つ名』を付けて貰えるのは、社会人にとって、とても重要なことかもしれないなぁ、と思っています。
I think it is very important for people in the society to be given "two names".
久し振りにメールを送付する時に、『ご高名はかねてから伺っております』などと、心にもないことを言うのも、言われるのも、抵抗がありますから。
When I send an email after a long time, I don't feel comfortable saying or being told something like "I've heard of you for some time"
あなたのことは覚えています。覚えているんですけど、どういう風に覚えているか、を伝えたい時に、『二つ名』を絡められれば、結構、そこからの展開がスムーズです。
I remember you. I do remember you, but when I want to tell you how I remember you, if I can use your "two names," it will be much smoother from there.
-----
私の場合、「さんまとサバの江端さん」が多いですが、これを、年下の人から私に言うのは難しいと思います。
In my case, it's mostly "Mr. Ebata from saury and mackerel," but I think it would be difficult for someone younger than me to say this to me.
ですので、社内でよく言われるのが「特許の江端さん」です。
That is why I am often referred to as "Mr. Ebata of patents" within the company.
ネットでは「英語に愛されない江端さん」が散見されます。
The Internet is littered with "Mr. Ebata, unloved by the English language.
「飛び込み(自殺)の江端さん」というのもあります。
"There is also "Mr. Ebata who jumped in (committed suicide).
-----
本当は、「XXXXX技術の江端さん」という二つ名こそが、エンジニアとしても誉れだと思うのですが ――
In fact, I think that the two names of "Mr. Ebata of XXXX Technology" are honorable for an engineer.
私が、他人と差別化できる世界的技術は何か、と自問すると、やっぱり
When I ask myself what is the world class technology that can differentiate me from others, I think
It all comes back to "How to tell the difference between saury and mackerel".
最初の二つ名は、やっぱり正しいのだと思います。
I think the first "two names" are still correct.
自宅のネットワークが動かなくなるだけで『心臓がバクバク』します。
Just the fact that my home network stops working is enough to make my 'heart skip a beat'.
ネットワーク障害が発生すれば、業務が完全に停止し、それを、他の人に知らせる手段も失われるからです。
This is because a network failure will cause a complete shutdown of the business, and there will be no way to notify others.
で、本日、それが発生しました。
And today, it happened.
今や、インターネットなしの生活(仕事、娯楽、その他)は考えられませんので、こういう障害に出会うと、凄く怖いです。
Nowadays, I can't imagine my life (work, entertainment, etc.) without the Internet, so it's very scary when I encounter such accident.
今回は、「再起動」で済んでよかったですが、「再起動」は、かなり高い確率で「失敗します」
This time, I'm glad I only had to "reboot," but "rebooting" has a pretty high probability of "failing."
再起動に失敗すると、部分的に動いていた機能までも、全部停止してしまします。
If the reboot fails, all functions, even those that were partially working, will be stopped.
ですから、「再起動」のボタンを押すのは勇気がいります。
Therefore, it takes courage to press the "Reboot" button.
―― 本当に、これまで「再起動」を押して、何十台のシステムをクラッシュしてきたことか(遠い目)
-- Really, I can't tell you how many dozens of systems I've crashed by pressing "reboot" (distant memory).
-----
「再起動」に成功したら、その場で、設定情報を何もかも印刷しておくことが重要です。
Once you have successfully "rebooted," it is important to print out all of your configuration information soon.
これは、本格的な故障の予兆だからです。
This is because it is a sign of a full-blown failure.
そんでもって、これを認めることは残念なのですが、土壇場で効いてくるのは、「紙」に印刷された情報です。
It is unfortunate that I have to admit this, but it is the information printed on "paper" that comes into play at the last minute.
デジタルデータは、システムが死ぬと、取り出すことができなくなるからです。
This is because digital data cannot be retrieved when the system dies.
-----
私は、今、ホームルータの設定情報のハードコピーを、片っ端からクラウドにアップしました。
I have now uploaded hard copies of the configuration information for my home router to the cloud from one end to the other.
私の場合、「紙」の場所を忘れることが多いので、とりあえずクラウドに逃がして、心の平安を得ています。
In my case, I often forget where my "paper" is, so I let them escape to the cloud for now, and find peace of mind.
もっとも、クラウドだって、ダウンする時には、ダウンしますけどね。
However, even the cloud goes down when it goes down, right?
-----
電気、水道、ガス、水漏れ、配管詰まり等は、泣きつく先(メンテナンスサービス)がありますが、こういうホームネットワークの泣き付き先って、あるんでしょうか。
For electricity, water, gas, water leaks, clogged pipes, etc., there are places (maintenance services) to cry to, but I wonder if there are places to cry to for this kind of home network.
私が知らないだけならいいんですが ―― ネットワークが丸1日停止すれば、簡単に私(の仕事)を殺せます。
I hope I just don't know -- if the network goes down for a whole day, it could easily kill me (and my work).
先程、突然、自宅から、全てのWebアクセスができなくなりました。自宅PCの再起動なども試みたのですが、復活しません。
ところが、会社のシステムに繋っているセキュアPC(SPC)に関しては、メールの送信ができました。で、SPCから、kobore.netのIPアドレスを入手して、自宅PCのコマンド画面からpingを打ってみました。
応答あり・・・ということは、DNSが動いていないだけだな、と判断して、取り敢えず、自宅PCのDNSを、強制的に、8.8.8.8 (googleが提供しているDNSサーバ(だったと思う))にしました。
よし。これで、このPCだけは使えるようになりました。
だが、我が家全体のネットワークが使えない状況は続いていますので、とりあえず家族に連絡。
さて、ここでホームルータ(Aterm ATERM-BA73A9 )の設定を見にいってみました。
やはりDNSの表示が出なくなっている。「最新状態に更新」を押しても改善なし。
こういう場面での「再起動」は、事態を悪化させることもあるので、(少なくとも8.8.8.8で動いてはいる)勇気がいるのですが、やってみました。
結果として、DNSが表示されるようになって、自宅ネットワークを再開することができました。
家族に連絡して、完了。
もはや、インターネットなしの生活(仕事、娯楽、その他)は考えられませんので、こういう場面に出会うと、私でも凄く怖いです。
以上
以前も書いたと思うのですが、
I think I've written about this before.
―― リアルな数字で本気で計算していると、政府・与党支持になってくる
"If you're serious about calculating realistic numbers, you'll be supporting the government and ruling party"
というのは、本当です。
is true.
私も、この連載始めてから、度々『数字見てから、モノ言え!』と思う様になってきましたから。
Since I started this series, I have often thought, "Look at the numbers before you say anything!"
でも、これ、完全に「保守思想」です。
But this is totally "conservative thought".
江端の「転向」は、これまで度々言われててきましたが、政府資料の数字とエクセルで格闘するようになって、更に強化されているように思えます。
Ebata's "turnaround" has been mentioned many times in the past, but it seems to be further strengthened since he has been struggling with numbers in government documents in Excel.
-----
と言っても、「左翼勢力にはガッカリ」、「右翼勢力にはウンザリ」という気持ちに変化はありませんので、なんというか、新しいコンセプトがいるな、と思っています。
However, there is no change in my feeling of "disappointed with the left-wing forces" and "disgusted with the right-wing forces", so I am thinking that I need a new concept, like.
―― 数値保守 とか、計算保守 とか
"Numerical conservative, or computational conservative".
ただ、この主張で新党を立ち上げても、民意は得られないだろうな、ということも分かっています。
However, I also know that even if I start a new party with this argument, I will not be able to get the will of the people.
数値や数学は、英語を抜いて、我が国の民衆の「仮想敵」ですから。
Because numbers and mathematics are the "virtual enemies" of our people, overtaking English.
-----
STEM教育というのは、政府(文部科学省)が仕掛けた、体制支持の為の「思想教育」である、という考え方も ・・・
There is also the idea that STEM education is an "ideological education" set up by the government (Ministry of Education, Culture, Sports, Science and Technology) to support the current system...
まあ、これは、ちょっと仮説としても「厳しい」かな。
Well, this is a bit "tough" even as a hypothesis.
以前、「兵は拙速を尊ぶ」について書きましたが、内容とは違っていたようです。
I wrote about "soldiers respect poor but fast speed" before, but it seems to have been different from the content.
ここでの「拙速」の意味ですが、『稚拙でもいいから、とにかく速く』という意味では"ない"ようです。
The meaning of "poor but fast speed" here does not seem to be "just go fast, even if it's poorly done.
正しい意味を、簡単に言うと、
The correct meaning, in a nutshell, seems to be ...
―― 短期間で勝てる場合"のみ"戦え。それ意外の(長期間になる可能性があったり、勝てる見込が不明である)場合は戦うな
"Fight "only" if you can win in a short time. Otherwise (if it's likely to be a long time or you don't know if you can win), don't fight"
という意味らしいです。
-----
しかし、これ、凄く難しいです。
However, this is very difficult.
研究開発(R&D)は、運命的に時間と投資コストが必要ですし、新兵器(新技術)を開発できない研究者は、その存在意義を問われかねません。
Research and development (R&D) is fatally time-consuming and costly, and researchers who fail to develop new weapons (new technologies) may have their raison d'etre questioned.
短期間で勝てる技術が、ホイホイと開発できるなら、苦労はありません。
If I can develop a "winning technology" in a short period, I will have no trouble.
すなわち、R&Dに関しては「兵は拙速を尊ぶ」を孫子の解釈通りに考えれば、「私は何もしない/できない」と同義になります。
In other words, when it comes to R&D, if I think of "soldiers respect poor but fast speed" as Sun Tzu interpreted it, it becomes synonymous with "I do nothing/can't do anything".
-----
ともあれ、誤解をバラマキっぱなしでは良くないので、以前の日記の内容は訂正させて頂きます。
Anyway, it is not good to leave misunderstandings, so I will correct the contents of my previous diary.
「兵は拙速を尊ぶ」改め、
I take down "soldiers respect poor but fast speed",
「江端は、"拙速"くらいしかできることがない」
"There's nothing Ebata can do about it, except to be 'too quick'."
に変更したいと思います。
I'd like to change it to that.
先日、課の企画で、数人のグループに分かれて、フリーディスカッション(テーマなし)という試みが行われました。
The other day, as a project of the section, we were divided into several groups and tried to have a free discussion (no theme).
で、そのグループの中に、若手(20歳代)が入っていたので、私は、『マッチングアプリ』について質問してみました。
So, since there was a young guy (in his 20s) in the group, I asked him about "matching apps".
質問は大きく2つ
There are two main questions.
(1)マッチングアプリの利用に抵抗感はないか?
(1) Do you have any resistance to using a matching app?
(2)マッチングアプリによって交際や結婚至ったことを公(おおやけ)にできるか?
(2) Is it possible to openly disclose the fact that you got married through the matching app?
でした。
何せ、私は、様々な問題を引き起してきた「出会い系サイト」を、伝聞でしかしらず、かつ、これから、マッチングアプリを使用する予定がない人間です。
At any rate, I am a person who has only heard about dating sites, which have caused many problems, and I have no plans to use matching apps in the future.
つまり、マッチングアプリを、実感として経験できないことが、確定している人間です。
In other words, I am a person who is certain that I will not be able to experience matching apps in a real way.
-----
さて、回答の方ですが、(1)ない、(2)公にはしない、そうです。
Well, the answers were : (1) no, and (2) not publicly.
この回答、一見矛盾があるようですが、私にはよく理解できます。
This answer, while seemingly contradictory, makes a lot of sense to me.
1980年後半の大学キャンパスにいた理系学生の「電子メール」が、こんな感じでした。
This is what the "e-mail" of a science student on a college campus in the late 1980s looked like.
電子メールの経緯から鑑みるに、「マッチングアプリ」の利用が、公に口にできるようになるまで、あと数年というところでしょう。
From the view of the history of e-mail, it will probably be a few more years before the use of "matching apps" can be spoken of publicly.
-----
ただ一つ言えることは、「マッチングアプリ」が普通のコミュニケーションインフラになったところで、『恋愛や結婚できない人は、いつまでたってもできない』という状況は続くと思います。
The only thing I can say is that even if "matching apps" become a normal communication infrastructure, the situation will continue to be that 'people who can't fall in love or get married will always be unable to do so.
マッチングというのは、「場」の提供であり、そんでもって「価値の交換」を行うことです。
Matching is the provision of a "place" and the "exchange of value" there.
『あなたの価値と、相手の価値が、交換できる程度に同じ』という共通認識があった時に、マッチングは成立します。
A match is made when there is a common understanding that "your value" and "the other person's value" are the same to be able to be exchanged.
そういう意味では、やっぱり
In that sense, I guess.
"Matching "love" is hopelessly difficult"
し、
and,
"Getting the "signal" to light up is hopelessly difficult"
のだろうな、と思い出していました。
I remembered that.
-----
「何の為に、英語や数学を勉強するか分からない!」
"I don't know what I'm studying English or math for!"
と叫ぶ子どもたちに、
To the children who shouted,
『そんなもん、"リア充な恋愛、幸せな結婚生活、というオプションを選択できる大人になるため"に、決っとろうが』
"Needless to say, "To become an adult who can have the options of a fulfilling love life and a happy married life." absolutely"
と、キッパリと言い放てる大人が正しい、という気持ちになってきます。
I think it is admirable for an adult to be able to say something like this outright.