Hello,
So I have a sequence decision variable which is indexed by a machine.
I also have an interval array that is optional and is indexed by the ordernumber and the task.
However, in the sequence I filtered the ordernumber to match the machine's width, and now I needed to make use of the typeOfPrev function, however when I'm looping the ordernumbers, the tasks and the machines it has intervals that are not in the sequence. Is there a better way to do this loop, or a way to check if an interval belongs to a sequence?
dvar interval tasks [o in Orders][t in Tasks] size (t == "MudEnfiado" ? 1000 : Duration[o])..(maxint div 2)-1 intensity F;
dvar interval opttasks [t in Teares][o in Orders][task in Tasks] optional in MinStartSpan[o][t]..(maxint div 2)-1 intensity F;
dvar sequence teares [t in Teares] in all(o in Orders,task in Tasks : OrdersWidth[o] <= TearWidth[t]) opttasks[t][o][task] types all(o in Orders,task in Tasks : OrdersWidth[o] <= TearWidth[t]) o;
subject to {
forall(t in Teares){
forall(o in Orders){
presenceOf(opttasks[t][o]["MudEnfiado"]) ? typeOfPrev(teares[t],opttasks[t][o]["MudEnfiado"],0) == 1 : true ;
}
}
}
This last one gives the OPL Cannot extract expression error.
This is my constraints full code:
subject to {
forall(o in Orders)
{
endOf(tasks[o]["MudEnfiado"]) == startOf(tasks[o]["Tecer"]);
endBeforeStart(tasks[o]["MudEnfiado"],tasks[o]["Tecer"]);
forall(task in Tasks){
alternative(tasks[o][task],all(t in Teares : TearWidth[t] >= OrdersWidth[o]) opttasks[t][o][task]);
endOf(tasks[o][task]) < (Due[o]-2940);
forbidStart(tasks[o][task],F);
forbidEnd(tasks[o][task],F);
}
}
forall(t in Teares)
{
forall(o in Orders){
presenceOf(opttasks[t][o]["MudEnfiado"]) == presenceOf(opttasks[t][o]["Tecer"]);
}
noOverlap(teares[t]);
}
forall(t in Teares){
forall(o in Orders){
presenceOf(opttasks[t][o]["MudEnfiado"]) ? typeOfPrev(teares[t],opttasks[t][o]["MudEnfiado"],0) == 1 : true ;
}
}
workersUsage <= NbWorkers;
}
I would need this loop because one of the duration of the tasks i need to calculate based on the last one.
Thank you in advance!
------------------------------
Vasco Ferreira
------------------------------
#DecisionOptimization