本文整理汇总了Python中solver.Solver.solve_distance方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.solve_distance方法的具体用法?Python Solver.solve_distance怎么用?Python Solver.solve_distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.solve_distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ObstacleCreator
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import solve_distance [as 别名]
from obstacle_creator import ObstacleCreator
from solver import Solver
start = [7, 7]
goal = [4,4]
size = [10,10]
obstacle_creator = ObstacleCreator(size)
solver = Solver(size, start, goal, obstacle_creator.map)
while (True):
print 'new cycle', datetime.datetime.now()
solver.solve_distance()
print 'solver end', datetime.datetime.now()
solver.find_shortest_path()
print 'find path end', datetime.datetime.now()
world = World(size, obstacle_creator.map, solver.distance, solver.parent, solver.shortest_path)
world.world_reset()
print 'world reset', datetime.datetime.now()
world.draw_distance()
print 'draw_distance end', datetime.datetime.now()
world.draw_shortest_path()
print 'shortest_path', datetime.datetime.now()
#world.draw_parent()
cv2.imshow('image', world.img), cv2.waitKey(1)
cv2.destroyAllWindows()