Exemplo n.º 1
0
import highways
import maps


#bfs = maps.breadth_first_search(maps.highway_successors, 20000071, lambda x: x == 25000502)

#print("Length of trip: " + str(len(bfs)))
#print("Total Cost: " + str(maps.path_cost(bfs)))


uniform = maps.uniform_cost_search(maps.highway_successors, 20000071, lambda x: x == 25000502, lambda x: highways.distance(25000502, x)) 

print("Length of trip: " + str(len(uniform)))
print("Total Cost: " + str(maps.path_cost(uniform)))

Exemplo n.º 2
0
import maps
import highways

costs = []
#expanded = []

for i in range(101):
    a = i*0.01
    s = maps.a_star(maps.highway_successors, 6002971, lambda x: x == 25000502, lambda x: highways.distance(25000502, x), a)
    costs.append(maps.path_cost(s))
print(costs)