I define a parameter t[i,s] as follows:
for i in Trucks:
for s in Slots:
t[i,s]=m.addVar(vtype=GRB.CONTINUOUS, name="t[%s,%s]"%(i,s))
I call the values of t[i,s] from an excel file. I is a list which contains a numbers from 0 to 263, also s is a list from 1 to 24. The problem appears when I run the code the following bug occurs:
GurobiError: Name too long (maximum name length is 255 characters)
How can I fix that?
In case the items in
TrucksandSlotsare just strings, you can limit the length that is passed to the variable name like this:Strings in Python can be treated just like any other array and support slicing.