-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
executable file
·64 lines (48 loc) · 1.67 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Markov decision process
from iofile.inputs import load_network, load_activity
from iofile.outputs import export_multi_run_data
from loading.assign import find_fixed_point
# from viewer.plot import draw_zone_population
from allocating.generators import gen_solo_activity_util, gen_path_set, find_shortest_path
from allocating.creators import set_corr
from stats.timer import print_current_time
# TODO: replace the dictionary with numpy.array
# TODO: use integers to index multidimension arrays
def run_multi_scenarios(case_name, corr_list):
# try distinct corrs
for corr in corr_list:
print " data set: %s" % case_name
print " correlation: %.2f" % corr
# correlations between household members
set_corr(1, 2, corr)
# run the iterative procedure
find_fixed_point(2, case_name, corr)
# output the raw results
# export_data(case_name+'_r'+str(corr))
# generate visual results
# draw_zone_population(4)
def main():
# initialize the timer
print_current_time()
# the data set name
case_name = '6node'
# load activity data
load_activity(case_name)
# load network data
load_network(case_name)
# generate path sets
gen_path_set()
find_shortest_path()
# generate utils
gen_solo_activity_util()
print '\n DATA LOADED'
print_current_time()
# run multiple scenarios
corr_list = [corr / 10.0 for corr in range(10, -1, -5)]
run_multi_scenarios(case_name, corr_list)
# export multi-run data
export_multi_run_data(case_name)
if __name__ == '__main__':
# import cProfile
# cProfile.run('main()', 'main_profile.log')
main()