-
Notifications
You must be signed in to change notification settings - Fork 2
/
multimodal_double_expansion_isochrone.py
34 lines (22 loc) · 6.97 KB
/
multimodal_double_expansion_isochrone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import osmnx
import time
from algorithms.multimodal_double_expansions_isochrone import MultiModalDoubleExpansionIsochrone
from algorithms.utils import project_nodes, get_path_secs
from bss_locations_example import bss_locations
from call_backs import double_astar_call_back, double_expansion_isochrone_callback
G = osmnx.load_graphml(filename='network.graphml')
orig_node = osmnx.get_nearest_node(G, (48.867006, 2.335881))
# Example of multimodal_astar
bss_nodes = {249907205, 244455430, 25581575, 96143369, 1840676881, 5934163992, 507047961, 25581601, 94128166, 152748081, 708253753, 178761794, 2547654733, 4545568853, 1840021589, 24959062, 5766293592, 1115138134, 151359581, 6207793245, 26400862, 6310582380, 152737902, 21659759, 199624817, 2887835761, 5635555443, 26400884, 221237370, 690200701, 25256078, 3335200913, 5793904785, 141592723, 4960235670, 17809571, 1836650666, 676384938, 21659820, 26400941, 3438858414, 1913669807, 24959159, 268128440, 258046144, 929489090, 36466893, 1280690382, 36597967, 24959182, 25096403, 1761442006, 703719638, 1298860246, 3290001623, 6414080215, 3517810907, 30793948, 510920927, 3290001631, 169279721, 25032942, 2688735471, 1755316464, 6151405812, 1513353464, 25667837, 704768, 21389569, 26401024, 1951465731, 96127245, 5487024399, 175016224, 206156066, 36483364, 30763304, 583004458, 26401067, 257149234, 2105491765, 1387155766, 141795641, 1990050105, 26401084, 323225917, 94140737, 3431799105, 884214090, 264796495, 620845398, 25033049, 94210394, 277410140, 94181728, 201980257, 676821358, 2916086138, 25033083, 260653438, 116130176, 2916086151, 411736456, 4426842508, 152807827, 258150805, 830630294, 5952317847, 676872605, 4702554535, 3171928488, 123498922, 5952317872, 2448382386, 1144416695, 2137762242, 5232380356, 34816457, 36467166, 268685791, 1568076260, 560855525, 30763492, 360935, 117092841, 94151147, 130234862, 94151151, 94151152, 3779838450, 1839276532, 4111985147, 247075325, 3171985919, 24984072, 6308563468, 1769765390, 27234834, 305916436, 367335958, 25207319, 5364603415, 360986, 360990, 2123471391, 34816544, 25207327, 254186028, 6411985453, 1840030259, 319711804, 221250119, 25031246, 643357264, 1840030289, 6307871317, 4739611222, 30769751, 2662859352, 34818652, 5083255396, 218088041, 6400526956, 260426348, 361070, 573381237, 490904184, 775131769, 2781147778, 328952458, 21648011, 25031308, 2250943123, 25031319, 367919770, 1423022762, 659360428, 3285568173, 34818735, 249533105, 178801329, 25103029, 693492407, 84888248, 34818743, 96139970, 430789, 94218952, 16820936, 123509452, 883296977, 272341727, 497148642, 3035151075, 821902054, 313295591, 322689769, 1960084201, 2102158058, 34816754, 94184179, 1651614452, 250548981, 139311861, 2301459190, 5515713267, 6478807800, 367905531, 24984319, 5515713281, 1920074498, 2394065680, 227228433, 256697105, 257712913, 4129936148, 1767611168, 30677795, 5697123112, 190995241, 125742, 5950669617, 3197172533, 116146997, 235029303, 25033534, 24965951, 6411651904, 94151489, 6610451266, 125760, 2204791622, 255091529, 36479826, 5779209046, 24984411, 24965981, 25033569, 24965988, 27323238, 26401639, 4957279080, 4957279081, 6007513965, 26401646, 24972143, 1252383603, 3671214964, 255003514, 271420287, 24984454, 472798092, 21658510, 1452080017, 26401687, 168356762, 367332251, 245529500, 2839266204, 36473759, 26401695, 367521, 25033634, 1577485219, 1306180526, 544469942, 3798019008, 2924393410, 1498518467, 1784413124, 1841699782, 2538845126, 1904888776, 6384827340, 254172109, 1841699791, 277562322, 1498518482, 8809440, 1803875301, 1784413163, 1771262959, 134521840, 931570679, 1832256505, 3396566014, 340390915, 1784413194, 5751911435, 142361613, 666317839, 319144977, 24972308, 297497622, 4225215515, 34817057, 166335521, 287620141, 24972336, 94143538, 406713396, 96134198, 382015, 644159, 34819142, 142640201, 241083467, 3724026958, 86035535, 5287705689, 25033820, 728984669, 24984668, 24972382, 4225207393, 968764522, 5036225646, 470135, 884210807, 110517369, 199183487, 15035526, 100289673, 1328467084, 27323534, 276997275, 3437806747, 3697149088, 34817185, 1279405216, 96146596, 15035563, 26039467, 1254700205, 837571760, 1089066170, 27286715, 26401983, 26401984, 94131393, 26588354, 2607891649, 151354567, 25033928, 27415756, 25287889, 577291476, 60912853, 677151960, 25101533, 94239970, 25101543, 6428558572, 570100981, 1142990075, 132773117, 1277048061, 21658877, 6625082621, 1446624515, 151362823, 3920493837, 1282530586, 1666520351, 319712544, 94149921, 648217891, 27323684, 256587045, 256324902, 560837928, 6412563755, 500581682, 257740088, 4760458553, 258075963, 153500988, 148944194, 765709634, 918101328, 176934225, 250350929, 6310956373, 116122967, 489604441, 6253692250, 6310956381, 25183590, 5309859177, 610483563, 3273082221, 367918448, 21292407, 3014047098, 21292425, 27018634, 3373342093, 141573529, 324322719, 573453733, 6410198440, 2499644845, 291464623, 5773573552, 987604401, 4121402811, 260382140, 505081278, 319702468, 5717697991, 116121031, 2321149386, 25183693, 141604305, 36466129, 3075931604, 268221908, 249691609, 2151917027, 936685031, 2814207464, 94174697, 14798311, 2814207468, 92192237, 36468210, 3926806004, 1151534589, 267261437, 368125, 268408320, 152739326, 5928308236, 5373613582, 158684688, 15435281, 1430078996, 4331306517, 250549782, 25554459, 4701060639, 246144547, 429286951, 15435303, 5219860009, 480702005, 245089850, 21732939, 5928308300, 206091857, 34909787, 5928308322, 616877666, 123457134, 256325231, 5928308336, 271435378, 36591221, 63164022, 4347803258, 94197380, 96136841, 30183055, 36476560, 5586042521, 6151767705, 314312347, 141604509, 3002531493, 25034407, 3166731945, 225937067, 178888368, 3042295478, 1697384123, 5299431104, 1491691203, 25034436, 6466311888, 110548692, 25671389, 1697384158, 661220, 112039659, 34817771, 622497519, 36472566, 96143095, 94144255, 17809152, 5577729793, 497151746, 1719123716, 271435526, 24958726, 17809162, 1835212558, 567373586, 175046421, 25290522, 17809179, 25184031, 256626475, 358455084, 148944692, 6407116598, 4957278009, 25581369, 94209853, 123713357, 691775310, 439881550, 36474702, 94269263, 30183253, 256325467, 699045729, 1922639714, 229318498, 178878313, 34674540, 1151524718, 471617392, 152737652, 25102197, 25034620, 151357309, 94140290, 25034634, 25034646, 25034650, 202117023, 151357346, 439855014, 5340600231, 1534568365, 676890544, 201981889, 417189831, 2325538770, 25255892, 297498581, 36476887, 25255897, 305917914, 36476890, 6487680988, 249698271, 5702799331, 1812252645, 280692710, 5581936615, 14956520, 208359407, 4200738804, 141606902, 519026686}
print('start double expansoin isochrone!')
dest_nodes = {306092060}
start = time.time()
multimodal_double_expansion_astar = MultiModalDoubleExpansionIsochrone()
iso = multimodal_double_expansion_astar.get_isochrone(G,
orig_node,
dest_nodes,
bss_nodes,
double_expansion_isochrone_callback)
end = time.time()
print(end - start)
print(iso)