_ https://mail.google.com/mail/u/0/?tab=rm&ogbl#search/%E5%85%88%E7%A8%8B%E3%81%AE1%E4%B8%87%E4%B8%A6%E8%A1%8C%E3%81%AE%E3%83%A1%E3%83%A2%E3%82%B3%E3%83%BC%E3%83%89%E3%81%AE%E4%BB%B6/CllgCHrlFNhQlzspPFwRwbqClbkjcnBKJhtxZnJpkJhFgZlVlztkbzfzvsqrRScCvsjnPzrcTgV
/* gcc 2_simple_sa.c -o 2_simple_sa -lm */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> float distance(int *point1, int *point2) { int dx = point1[0] - point2[0], dy = point1[1] - point2[1]; return sqrt(dx * dx + dy * dy); } float totalDistance(int **points, int length) { int i; float total = 0.0; for (i = 1; i < length; i++) { total += distance(points[i], points[i - 1]); } total += distance(points[0], points[length - 1]); return total; } void swap(int **array, int index1, int index2) { int *tmp; tmp = array[index1]; array[index1] = array[index2]; array[index2] = tmp; } float frand() { return (float)rand()/(float)RAND_MAX; } int shouldChange(float delta, float t) { if (delta <= 0) return 1; if (frand() < exp(- delta / t)) return 1; return 0; } void sa(int **route, int numberOfCities, float initialT, float finalT, int n, float coolingRate) { int currentIterations, randomIndex1, randomIndex2, i; float t, currentTotalDistance, newTotalDistance; currentTotalDistance = totalDistance(route, numberOfCities); for (t = initialT; t > finalT; t *= coolingRate) { for (i = 0; i < n; i++) { randomIndex1 = rand() % numberOfCities; randomIndex2 = rand() % numberOfCities; swap(route, randomIndex1, randomIndex2); newTotalDistance = totalDistance(route, numberOfCities); if (shouldChange(newTotalDistance - currentTotalDistance, t)) { currentTotalDistance = newTotalDistance; } else { swap(route, randomIndex1, randomIndex2); } } } } int **buildRoute(int mapData[][2], int numberOfCities) { int **route = calloc(numberOfCities, sizeof(&mapData[0][0])), i; for (i = 0; i < numberOfCities; i++) { route[i] = mapData[i]; } return route; } void printJSONRoute(int **route, int numberOfCities) { int i; printf("[\n"); for (i = 0; i < numberOfCities - 1; i++) { printf(" [%d, %d],\n", route[i][0], route[i][1]); } printf(" [%d, %d]\n", route[i][0], route[i][1]); printf("]\n"); } int main(void) { int n = 1000, numberOfCities = 51, mapData[][2] = {{37,52},{49,49},{52,64},{20,26},{40,30},{21,47},{17,63},{31,62},{52,33},{51,21},{42,41},{31,32},{5,25},{12,42},{36,16},{52,41},{27,23},{17,33},{13,13},{57,58},{62,42},{42,57},{16,57},{8,52},{7,38},{27,68},{30,48},{43,67},{58,48},{58,27},{37,69},{38,46},{46,10},{61,33},{62,63},{63,69},{32,22},{45,35},{59,15},{5,6},{10,17},{21,10},{5,64},{30,15},{39,10},{32,39},{25,32},{25,55},{48,28},{56,37},{30,40}}, **route = buildRoute(mapData, numberOfCities); float initialT = 100.0, finalT = 0.8, coolingRate = 0.9; srand((unsigned)time(NULL)); printf("%f\n", totalDistance(route, numberOfCities)); sa(route, numberOfCities, initialT, finalT, n, coolingRate); printf("%f\n", totalDistance(route, numberOfCities)); printJSONRoute(route, numberOfCities); return 0; }
When I was a junior school student, I collected stamps and ancient coins, though I was not interested in them at all.
In addition, I did "learning the line-up of Chunichi Dragons by heart" with feeling pain.
These were "booms", so called.
At that time, I thought that I was deeply interested in them, but I can say that it was a misunderstanding.
As a childhood, I could not find what I wanted to do, and I didn't have much allowance.
I am afraid that it cannot be helped that many children are going to be touched by fashion.
-----
Though I could not help it, when a boy who was at the top of my class, started to his hobby(collection of move sheets) and the classmates (mainly, boys) also became enthusiastic, I could not get with it.
I didn't do, so I looked like a "bad mood guy", and I had an experience close to the so-called "bullying".
The reason I didn't get completely bullied was I think that I was an excellent outstanding student, as an elementary school student.(It is not left at all).
And,
(1) I knew a lot of unnecessary trivia,
(2) I had a skill of argument
(3) I could operate (play) the piano.
I think that this is also due to the fact that I was a kid that was difficult to be bothered by children, and that was a ugly kid for adults.
If I had been a bad mood maker, not good at a performance, a poor grade and sports, I would have been a target of "bully"
(To be continued)
ラズパイに無線LANサーバ(wlan0)と無線LANクライアント(wla1)を併設する方法
kw: WiFi2枚 USB WiFi
完成したカーネルイメージ /home/kobore/www/soft/hitachi_ride_hailing_go/20190823-WiFi2.img
sudo apt install -y isc-hdcp-server
sudo apt install -y hostapd
とインストールしておく
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:ec:9c:0b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d0:37:45:30:71:23", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
interface wlan0 static ip_address=192.168.101.1/24 static routers=192.168.101.1 static domain_name_servers=192.168.101.1
default-lease-time 600; max-lease-time 7200; ddns-update-style none; authoritative; subnet 192.168.101.0 netmask 255.255.255.0 { range 192.168.101.10 192.168.101.200; option broadcast-address 192.168.101.255; option routers 192.168.101.1; default-lease-time 600; max-lease-time 7200; option domain-name-servers 8.8.8.8, 8.8.4.4; }
interface=wlan0 driver=nl80211 ssid=rp1 hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=password wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP wpa_group_rekey=86400 ieee80211n=1 wme_enabled=1
log_daemon_msg “Starting $DESC” “$NAME” sleep 10
auto wlan0 allow-hotplug wlan0 iface wlan0 inet static wpa-conf /etc/wpa_supplicant/wpa_supplicant_wlan0.conf
auto wlan1 allow-hotplug wlan1 iface wlan1 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant_wlan1.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=JP network={ ssid="ssid" psk="password" key_mgmt=WPA-PSK }
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=JP network={ ssid="iPhone" psk="9yniyg4p4cmh1" }
wlan0: flags=4163mtu 1500 inet 192.168.101.1 netmask 255.255.255.0 broadcast 192.168.101.255 inet6 fe80::1392:b0b4:b56a:836b prefixlen 64 scopeid 0x20 ether b8:27:eb:ec:9c:0b txqueuelen 1000 (イーサネット) RX packets 685 bytes 61030 (59.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 148 bytes 23267 (22.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan1: flags=4163 mtu 1500 inet 172.20.10.4 netmask 255.255.255.240 broadcast 172.20.10.15 inet6 fe80::e4a8:f21f:a6fa:111f prefixlen 64 scopeid 0x20 ether d0:37:45:30:71:23 txqueuelen 1000 (イーサネット) RX packets 28 bytes 4774 (4.6 KiB) RX errors 0 dropped 30 overruns 0 frame 0 TX packets 50 bytes 8415 (8.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
https://mail.google.com/mail/u/0/?tab=rm&ogbl#search/sakaida+.md/CllgCHrgDRrsVTddNhrDtMQZQpzwQhMtwbJzcPLZWWTtFmZhWLwRpCwlGvVbKRdQNNdCdvJJzcL
https://mail.google.com/mail/u/0/?tab=rm&ogbl#search/sakaida+.md/WhctKJVRQLzdgWJKxnGXZMhgPlkMKlhbMFKckBrtqQDDJKJLvLHGrxKTtLdKgGwLXTnlKJb
https://mail.google.com/mail/u/0/?tab=rm&ogbl#search/sakaida+.md/WhctKJVRPLZksMMKrVvhHqSbFbJSrscXCkmBqmbjnFbbscqxtkkVFcJFJFbwHXgRCsjbnLq