"How to count Fukashigi" With your sister: The awesomeness of a combinatorial explosion https://qiita.com/kaizen_nagoya/items/f309b0c2bb015bbc71c3
gra10.py
# https://qiita.com/cabernet_rock/items/50f955afc16287244154
# https://qiita.com/kaizen_nagoya/items/f309b0c2bb015bbc71c3
# https://qiita.com/kaizen_nagoya/items/3a8d89f095489b6e1f56
# https://qiita.com/kaizen_nagoya/items/819f10124ec453b7ef27
#Import required modules
from graphillion import GraphSet
import graphillion.tutorial as tl
import time #Check the calculation time.
#Specify the size of the grid
universe = tl.grid(2, 2)
GraphSet.set_universe(universe)
tl.draw(universe)
start = 1 #Start position
goal = 9 #Goal position
paths = GraphSet.paths(start, goal)
print (len(paths))
#
key = 4 #1st place
treasure = 2 #2nd place
paths_to_key = GraphSet.paths(start, key).excluding(treasure)
treasure_paths = paths.including(paths_to_key).including(treasure)
print (len(treasure_paths))
#
universe = tl.grid(9, 9) #9x9 grid
GraphSet.set_universe(universe)
start = 1
goal = 100
s = time.time() #Calculation start time
paths = GraphSet.paths(start, goal)
print (time.time() - s )#Calculation time
No answer was given after 12 hours of 9X9.
graat.sh
#!/bin/bash
# https://qiita.com/kaizen_nagoya/items/f309b0c2bb015bbc71c3
date
python3 gra10.py
date
I can't work, so I changed another device to docker 12GB and executed the above script.
Wed Jan 22 02:44:58 UTC 2020
12
2
./graat.sh: line 4: 22 Killed python3 gra10.py
Wed Jan 22 02:47:29 UTC 2020
14GB
Wed Jan 22 03:03:49 UTC 2020
12
2
./graat.sh: line 4: 14 Killed python3 gra10.py
Wed Jan 22 03:08:19 UTC 2020
I thought it was because the version of docker was different, and when I tried again with the original equipment, yesterday it worked for more than 12 hours and did not stop. Killed in a few minutes today. The reason is unknown.
ver. 0.01 First draft 20200122 AM ver. 0.02 script postscript 20200122 noon ver. 0.03 python postscript 20200122 Afternoon
Recommended Posts