-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart.py
More file actions
51 lines (36 loc) · 1.13 KB
/
start.py
File metadata and controls
51 lines (36 loc) · 1.13 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
import os
from pesp_instance import PESPInstance
from structures import *
__author__ = 'jetbrains'
def read_all_lines():
BASE = "Lines/%s"
all_lines_map = OrderedDict()
file_names = os.listdir('Lines')
for fn in file_names:
f = open(BASE % fn).readlines()
all_lines_map[fn] = map(lambda x: x.replace('\n', ''), f)
return all_lines_map
ALL_LINES_DATA = read_all_lines()
GRAPHS = []
# ========================
# SET PARAMETERS
# ========================
T = 10 # time frequency
time_bounds = {"ub_path": 5, "lb_path": 3, # time between stations
"ub_station": 1, "lb_station": 0, # time on station
"ub_lines": 7, "lb_lines": 3} # time between station of different lines
pesp_instance = PESPInstance(ALL_LINES_DATA, T, time_bounds)
# =============
# B&B method
# =============
#
# bb_model = pesp_instance.generate_bb_model()
#
# for v in bb_model.getVars():
# print('%s %g' % (v.varName, v.x))
# print('Objective funtion: \t %g' % bb_model.objVal)
# ===================
# Genetic algorithm
# ===================
gen_model = pesp_instance.generate_genetic_model()
pass