-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_populationsim.py
70 lines (50 loc) · 2.24 KB
/
run_populationsim.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
65
66
67
68
69
70
# copied from https://github.com/ActivitySim/populationsim/blob/master/example_calm/run_populationsim.py 3/25/20
from __future__ import print_function
import os
import logging
from activitysim.core import config
from populationsim import steps
from activitysim.core import tracing
from activitysim.core import pipeline
from activitysim.core import inject
from activitysim.core.config import handle_standard_args
from activitysim.core.tracing import print_elapsed_time
from activitysim.core.config import setting
from populationsim import lp
from populationsim import multi_integerizer
# Add (and handle) 'standard' activitysim arguments:
# --config : specify path to config_dir
# --output : specify path to output_dir
# --data : specify path to data_dir
# --models : specify run_list name
# --resume : resume_after
handle_standard_args()
tracing.config_logger()
t0 = print_elapsed_time()
logger = logging.getLogger('populationsim')
logger.info("GROUP_BY_INCIDENCE_SIGNATURE: %s"
% setting('GROUP_BY_INCIDENCE_SIGNATURE'))
logger.info("INTEGERIZE_WITH_BACKSTOPPED_CONTROLS: %s"
% setting('INTEGERIZE_WITH_BACKSTOPPED_CONTROLS'))
logger.info("SUB_BALANCE_WITH_FLOAT_SEED_WEIGHTS: %s"
% setting('SUB_BALANCE_WITH_FLOAT_SEED_WEIGHTS'))
logger.info("meta_control_data: %s"
% setting('meta_control_data'))
logger.info("control_file_name: %s"
% setting('control_file_name'))
logger.info("USE_CVXPY: %s" % lp.use_cvxpy())
logger.info("USE_SIMUL_INTEGERIZER: %s" % multi_integerizer.use_simul_integerizer())
# get the run list (name was possibly specified on the command line with the -m option)
run_list_name = inject.get_injectable('run_list_name', 'run_list')
# run list from settings file is dict with list of 'steps' and optional 'resume_after'
run_list = setting(run_list_name)
assert 'steps' in run_list, "Did not find steps in run_list"
# list of steps and possible resume_after in run_list
steps = run_list.get('steps')
resume_after = run_list.get('resume_after', None)
if resume_after:
print("resume_after", resume_after)
pipeline.run(models=steps, resume_after=resume_after)
# tables will no longer be available after pipeline is closed
pipeline.close_pipeline()
t0 = ("all models", t0)