LoginSignup
1
0

More than 3 years have passed since last update.

今日のpython error: invalid keyword argument for this function

Last updated at Posted at 2020-01-21

組み合わせ爆発の凄さ
https://qiita.com/kaizen_nagoya/items/f309b0c2bb015bbc71c3

で、

graphillionを使ってみた
https://qiita.com/cabernet_rock/items/50f955afc16287244154

をファイルにした。

実行しても何も出ない。

printを加えた。

gra.py
# https://qiita.com/cabernet_rock/items/50f955afc16287244154
# 必要なモジュールのインポート
from graphillion import GraphSet
import graphillion.tutorial as tl
import time              # 計算時間を調べる。
# グリッドのサイズを指定
universe = tl.grid(2, 2)
GraphSet.set_universe(universe)
tl.draw(universe)
start = 1 # スタート位置
goal = 9 # ゴールの位置
paths = GraphSet.paths(start, goal)
print (len(paths))
#
key = 4        # 1箇所目
treasure = 2   # 2箇所目
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(8, 8) # 9×9のグリッド
GraphSet.set_universe(universe)
start = 1
goal = 81
s = time.time()          # 計算開始時刻
print  (paths = GraphSet.paths(start, goal))
time.time() - s # 計算時間
print (len(paths))
docker/ubuntu
# python3 gra.py
12
2
Traceback (most recent call last):
  File "gra.py", line 26, in <module>
    print  (paths = GraphSet.paths(start, goal))
TypeError: 'paths' is an invalid keyword argument for this function

print (paths = GraphSet.paths(start, goal))

paths = GraphSet.paths(start, goal)
print (paths)

に変更。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0