forked from Korusuke/Rail.it
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoptimize.py
38 lines (37 loc) · 1016 Bytes
/
optimize.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
populations = [54265,73470,84799,95811,126222,131714,130955,143690,143465,134251,125651,117766,115382,112796,107990,99974,98079,94483,86356,81551,61546,62206,56715,48514,44109,30148,20168]
'''
n_trains = [35 for i in range(len(populations))]
for i in range(len(populations)):
if populations[i]//35 <= 4000:
n_trains[i] = populations[i]//4000
print(n_trains)
'''
n_trains = []
while len(populations)!=0:
p = []
for i in range(len(populations)):
populations[i] -= 2000
if populations[i] >= 0:
p.append(i)
if len(p)>=2:
n_trains.append([p[0],p[-1]])
n = len(populations)
for i in range(n):
if i not in p:
populations.pop(i-1)
print(n_trains,len(n_trains))
'''
for i in html:
try:
i.select("tr")
x = i.select("td")
type = x[1]
type = type.text
s = x[3].text
e = x[4].text
bt = x[5].text
dat = [s,e,bt,type]
tab.append(dat)
except:
continue
'''