本文整理匯總了Python中Problem.Problem.build_hash_table方法的典型用法代碼示例。如果您正苦於以下問題:Python Problem.build_hash_table方法的具體用法?Python Problem.build_hash_table怎麽用?Python Problem.build_hash_table使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Problem.Problem
的用法示例。
在下文中一共展示了Problem.build_hash_table方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: str
# 需要導入模塊: from Problem import Problem [as 別名]
# 或者: from Problem.Problem import build_hash_table [as 別名]
print "\n******** STATISTICS *********"
print "Final cost: "+ str(final_cost)
if __name__ == "__main__":
search_strategy = int(raw_input("Search algorithm? (BFS = 0, DFS = 1, DLS = 2, IDS = 3, UC = 4, AStar = 5)\n"))
if not search_strategy in range(6):
print("Invalid search algorithm. Exiting...")
sys.exit(0)
prune = raw_input("Execute prune? (Y/N)\n")
print "Looking for nodes " + str(sys.argv[6:])
initial_state = State(Node_Map(sys.argv[1]), sys.argv[6:])
boundary_coordinates = (sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
problem = Problem(State_Space(boundary_coordinates), initial_state)
problem.build_hash_table()
timestamp1 = datetime.datetime.now()
path = search(problem, search_strategy)
print "Time taken to accomplish the search: " + str(datetime.datetime.now() - timestamp1)
global number_of_generated_nodes
print "Number of generated nodes: " + str(number_of_generated_nodes)
sys.exit(0)
示例2: len
# 需要導入模塊: from Problem import Problem [as 別名]
# 或者: from Problem.Problem import build_hash_table [as 別名]
if len(sys.argv) < 7:
print(__doc__.format(__file__))
sys.exit(0)
if __name__ == "__main__":
print "Looking for nodes " + str(sys.argv[6:])
initial_state = State(Node_Map(sys.argv[1]), sys.argv[6:])
boundary_coordinates = (sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
p = Problem(State_Space(boundary_coordinates), initial_state)
p.build_hash_table()
path = p.search(Searching_Strategies.BFS)
if len(path)==0:
print "Path not found"
sys.exit(0)
print "Path found! Path saved in data/solution.out"
sys.stdout = open('data/solution.out','w')
print "Final path to " + str(sys.argv[6:])
while (len(path)>0):
print path.pop()