Example #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)))

Example #2
0
#z = highways.neighbors[23000331]
#print(z)


#print(maps.uniform_cost_search(maps.highway_successors, 20000071, lambda x: x == 25000502))

#print(maps.path_cost([17001088, 17001089, 17001106, 17001147, 17001168]))


#print(maps.path_cost([20000071, 20000073, 20000074, 20000069, 20000070, 20000072, 20000068, 20000065, 20000064, 20000059, 20000054, 20000060, 20000056, 20000055, 20000057, 20000062, 20000032, 20000033, 20000035, 20000036, 20000041, 20000038, 20000040, 20000037, 20000043, 20000044, 20000039, 20000042, 20000045, 20000034, 20000030, 20000031, 20000066, 20000075, 20000096, 20000093, 20000094, 20290475, 29000203, 29000201, 29000200, 29000210, 29000208, 29000197, 29000198, 29000205, 29000207, 29000202, 29000185, 29000191, 29000194, 29000195, 29000218, 29000216, 29000206, 29000179, 29000180, 29000178, 29000177, 29000173, 29000172, 29000181, 29000186, 29000188, 29000209, 29000193, 29000192, 29000189, 29000190, 29000196, 29000239, 29000247, 29000248, 29000242, 29000240, 29000232, 29000231, 29000233, 17290355, 17002012, 17002030, 17002024, 17002054, 17002045, 17002043, 17002049, 17002047, 17002035, 17002019, 17002018, 17002015, 17002013, 17002016, 17002014, 17002017, 17002007, 17002009, 17002008, 17001992, 17001990, 17001982, 17001981, 17001941, 17001944, 17001946, 17001945, 17001948, 17001947, 17001943, 17001938, 17001918, 17001917, 17001916, 17001914, 17001912, 17001909, 17001896, 17001901, 17001900, 17001902, 17001903, 17001929, 17001930, 17001959, 17001958, 17001960, 17001961, 17001962, 17001964, 17001966, 17001967, 17001965, 17001963, 17001957, 17001955, 17001954, 17001956, 17001953, 17180354, 18001105, 18001107, 18001144, 18001150, 18001153, 18001145, 18001149, 18001146, 18001141, 18001140, 18001137, 18001142, 18001143, 18001138, 18001134, 18001135, 18001136, 18001131, 18001132, 18001133, 18001127, 18001126, 18001125, 18001124, 18001123, 18001121, 18001120, 18001114, 18001113, 18001112, 18001108, 18001097, 18001094, 18001090, 18001089, 18001084, 18001065, 18001062, 18001057, 18390397, 39001996, 39001987, 39001982, 39001968, 39001967, 39001966, 39001960, 39001956, 39001952, 39001957, 39001958, 39001959, 39001944, 39001936, 39001938, 39001940, 39001934, 39001909, 39001887, 39001878, 39001863, 39001851, 39001847, 39001840, 39001820, 39001806, 39001799, 39001798, 39001797, 39001811, 39001814, 39001813, 39001819, 39001829, 39001831, 39001827, 39001821, 39001808, 39001815, 39001802, 39001807, 39001865, 39001862, 39001849, 39001830, 39001859, 39001858, 39001853, 39001861, 39001856, 39001763, 39001733, 39001718, 39001713, 39001703, 39001692, 39001689, 39001687, 39001552, 39001551, 39001549, 39001513, 39001507, 39001494, 39001492, 39001484, 39001483, 39001476, 39001482, 39001480, 39001478, 39540201, 54000014, 54000013, 54000012, 54000009, 54000007, 54000008, 42540956, 42002058, 42002007, 42002011, 42002006, 42002003, 42001982, 42001949, 42001887, 42001870, 42001941, 42001903, 42001904, 42001952, 42001928, 42001923, 42001931, 42001962, 42001958, 42001963, 42001968, 42001974, 42001973, 42001970, 42001986, 42001993, 42001996, 42002001, 42001978, 42001894, 42001922, 42001918, 42001920, 42001939, 42001940, 42002005, 42002000, 42002061, 42002067, 42002070, 42002078, 42002071, 42001946, 42001933, 42001895, 42001850, 42001851, 42001915, 42001871, 42001827, 42001813, 42001802, 42001886, 42001846, 42001819, 42001890, 42001911, 42001924, 42001943, 42001873, 42001863, 42001682, 42001636, 42001613, 42001345, 42001311, 42001297, 42001267, 42001255, 42001263, 42001262, 42001258, 42001253, 42001239, 42001230, 42001137, 42001028, 42001024, 42000980, 42000969, 42000958, 42000955, 42000956, 42000960, 42000962, 42000934, 42000918, 42000894, 42000877, 42000862, 42000837, 42000828, 42000832, 42000863, 42000839, 42000816, 42000806, 42000801, 42000797, 42000796, 42000789, 42000781, 42000774, 42000763, 42000746, 42000742, 42000744, 42000725, 42000702, 42000567, 42000472, 42000468, 42000494, 42000475, 36421087, 36004053, 36004061, 36004040, 36003999, 36003979, 36003937, 36003931, 36003920, 36003916, 36003901, 36003909, 36003910, 36003912, 36003913, 36003904, 36003903, 36003906, 36003895, 36003890, 36003887, 36003870, 36003869, 36003853, 36003832, 36003771, 36003766, 36003750, 9360192, 9000143, 9000147, 9000131, 9000135, 9000157, 9000158, 9000156, 9000141, 9000132, 9000130, 9000129, 9000140, 9000149, 9000154, 9000155, 9000162, 9000172, 9000182, 9000181, 9000198, 9000204, 9000206, 9000205, 9000207, 9000208, 9000196, 9000190, 9000188, 9000152, 9000142, 9000139, 9000118, 9000114, 9000099, 9000097, 9000055, 9000043, 9000036, 9250186, 25001356, 25001347, 25001320, 25001312, 25001224, 25001208, 25001194, 25001181, 25001155, 25001151, 25001120, 25001047, 25001043, 25001029, 25001000, 25000964, 25000927, 25000929, 25000931, 25000922, 25000855, 25000819, 25000809, 25000787, 25000633, 25000625, 25000624, 25000627, 25000569, 25000563, 25000545, 25000527, 25000524, 25000506, 25000504, 25000502]))


#pittsfield = maps.uniform_cost_search(maps.highway_successors, 25000379, lambda x: x == 25000502)

#altoona = maps.uniform_cost_search(maps.highway_successors, 42001780, lambda x: x == 25000502)

#smith_center = maps.uniform_cost_search(maps.highway_successors, 20000071, lambda x: x == 25000502)


#pittsfield2 = maps.uniform_cost_search(maps.highway_successors, 25000379, lambda x: x == 25000502, lambda x: highways.distance(25000502, x))

altoona = maps.uniform_cost_search(maps.highway_successors, 42001780, lambda x: x == 25000502, lambda x: highways.distance(25000502, x))

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






Example #3
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)