Hi I have the same problem and I couldnt solve it..how can I define Var or LinExpr for all i?
my code is:
for i in range(clients):
T[i] = model.addVar(lb=1, ub=1440,name='T[%s]' % ( i))
for i in range(clients):
model.addConstr(start_times[i] <= T[i])
THE ERROR IS:
Traceback (most recent call last):
File "c:\Users\Admin\Desktop\SampleToolBox\Python\cvrp_model.py", line 2, in <module>
import math
File "C:\sh\Lib\site-packages\gurobipy\gurobipy.pyd", line 2466, in gurobipy.Model.addConstr (../../src/python/gurobipy.c:77325)