for i in range(alltasks):
for j in range(allhorizon):
start[i,j] = model.NewBoolVar("start[i,j]") // variable will equal 1 if task i starts on period j
Now the constraint in question that's causing me a problem:
for i in range(alltasks-1):
for j in range(allhorizon):
for l in range(len(successor)):
model.Add(start[i,j]*j+duration[i] >= start[successor[i,l],j]*j)
I have a successor Pandas Series filled with tuples.
the i axis is the task list
the j axis it the successor list
I am multiplying start[] and successor[] by *j so that it returns the actual time period.
for example:
successor[2,3] is the tuple that returns the 4th task successor to the 2nd task.
by doing start[]*j+duration[i], it returns the end period of task i (since j is 1,2,...,horizon)
So the constraint will make it impossible for a successor task to start on a given period as long as the predecessor isn't finish.
I get the error:
KeyError: 'key of type tuple not found and not a MultiIndex'
Any idea what's causing this?
It's for sure ''start[successor[i,l],j]], i just don't know why.
Thank you