I want to create a bus schedule for a given time table. I have used PULP for the optimization problem (MIP). But I get multiple errors and I need some help with the entire code for scheduling. I also want to make spans and show the results.
Error 1: '<=' not supported between instances of 'list' and 'int'
===My Code===
data=pd.read_csv(file)
data.head()
from mip.model import *
from itertools import product
from mip import Model, xsum, BINARY
model = Model()
(S, T) = (range(len(data)), range(max(data["bi"])))
Y = [model.add_var(name='Y({})'.format(i), var_type=BINARY)for i in S]
E = [model.add_var(name='E({})'.format(i), var_type=CONTINUOUS)for i in S]
C1=0.0662
d=2
C2=2
C3=0.5
R=180
l=26
Th=7
B=150
Emin=30
model.objective = minimize(xsum([Y[i]]*int((C1*d)+C2+(C3*R)) for i in S))
for i in S:
model+=[E[i]+[((Th*R)-d)*Y[i]]]<=B
model+=[E[i]+[((Th*R)-d)*Y[i]]-l]==E[i+1]
model+=E[i]>=Emin
model+=Y[i]=={0,1}
model+=E[1]==B
model.optimize()
print("Schedule: ")
for i in range(S):
print('({})'.format(i))
print('Makespan = {}'.format(model.objective_value))
Get Free Quote!
262 Experts Online