In Cplex, is there a way to assign a different operator to a time interval variable when shifts changes?

43 Views Asked by At

I am using Cplex OPL to model flexible jobshop scheduling. I can use the intensity function to assign a task to an operator during his/her shifts. If the span is beyond a shift, the task will pause, and it will continue if the time is the operator's shift again. However, the real situation is that the task will be assigned to a different operator if the shift changes. Does anybody know how to realize this in Cplex ?

Thanks a lot!

I can use intensity function. But a single task is only associated to a single operator.

1

There are 1 best solutions below

0
Alex Fleischer On

If you do not want the interval to go through the weekend / holiday you may use overlapLength to forbit that.

using CP;

int startWeekend=6;
int endWeekend=8;


stepFunction weekIntensity=stepwise{100->5;0->7;100};

dvar interval itvs in 1..10 size 4 intensity weekIntensity;

maximize endOf(itvs);
subject to
{
  //overlapLength(itvs,startWeekend,endWeekend)==0;
}

execute
{
  writeln(itvs);
  writeln("start : ",Opl.startOf(itvs));
  writeln("end : ",Opl.endOf(itvs));
}

gives

// solution with objective 10
 <1 4 10 4>
start : 4
end : 10

if you uncomment the overlapLength constraint you then get

// solution with objective 6
 <1 1 6 4>
start : 1
end : 6