Hi
I have added a sequence variable to cover all interval variables assigned to each resource in my model
I would like to add an interval variable so that it is the first in the sequence.
My code looks like:
- Create the sequence_variable
for r in resources :
int_vars = [value for entry in intervals for key, value in entry.items() if r in key] # list of intvars for this resource
seq = model.sequence_var(int_vars,name = 'seq_var_'+r) # create the sequence_var for each resource & include all int_vars for the resource
mdl.resources[r].seq_var = seq
- Create an interval to put first in the sequence
itv = model.interval_var(size=service_time, name="Service_Start_"+r, optional=False) # create interval var for the activity
model.add(model.first(seq_var,itv))
When I add step 1, there appears no issue
When I do the second part, the program just goes to sleep. No response for 20 minutes
Clearly my attempt to post the 'first' constraint is incorrect
Can someone tell me the correct way to post this constraint
Thanks
Ross Dye