-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_passenger_assigner.py
More file actions
54 lines (39 loc) · 2.21 KB
/
run_passenger_assigner.py
File metadata and controls
54 lines (39 loc) · 2.21 KB
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
#!/usr/bin/env python3
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
#import configparser
import passenger_assigner.passenger_assigner as paf
#from connection_tools import mysql_connection, generic_connection
from general_tools import read_paras
__version__ = '1.1'
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Database and options details', add_help=True)
#parser.add_argument('-pr','--profile',help='Profile file for connection', required=False, default='remote_direct3')
parser.add_argument('-p','--paras',help='Paras file', required=False, default='paras/paras.py')
parser.add_argument('-s','--scenario',help='scenario to run overrides paras file', required=False)
# TODO: put these parameters in the paras file.
#parser.add_argument('-owt','--only_schedules_w_trajectory',help='limit the number of schedules to only ones with trajectories options', action='store_true')
# parser.add_argument('-er','--economic_run',help='economic run model', required=False)
# parser.add_argument('-sr','--schedule_run',help='schedule run run model', required=False)
# parser.add_argument('-pr','--passenger_option_run',help='which passenger option run to use', required=False)
# parser.add_argument('-c','--condition_leg23', help="optimise first leg 2 and 3 and then all consitioned to that", action='store_true')
# parser.add_argument('-pf','--problem_file',help='save problem in file', required=False)
#parser.add_argument('-pc','--parallel_computing', help='number of threads to launch', required=False)
parser.add_argument('-v','--verbose', help='verbose overrides paras file', action='store_true')
args = parser.parse_args()
paras = read_paras(paras_file=args.paras)
paras['verbose'] = paras.get('verbose') or args.verbose
if args.scenario is not None:
print(args.scenario)
paras['scenario'] = args.scenario
if paras['passenger_options_computation']:
paf.compute_passenger_options(paras=paras,
connection=None,
verbose=paras['verbose'])
if paras['passenger_assigment']:
paf.assign_passengers(paras=paras,
connection=None,
dry_run=paras['dry_run'],
verbose=paras['verbose'])