Originally posted by: ToshiyukiMiyamoto
Dear Alex
Thank you for your reply.
I'm checking sched_trolley2, but unfortunately the method is not good for my case.
Let me explain my case more detail. A simple example is shown as follows:
using CP;
{string} Jobs = {"a", "b", "c"};
dvar interval act[i in Jobs] size 2;
dvar sequence ss in act;
dvar int loc[j in Jobs] in 1..20;
minimize max(j in Jobs) endOf(act[j]);
subject to {
noOverlap(ss);
loc["a"] % 4 == 1;
loc["b"] % 5 == 1;
endBeforeStart( act["a"], act["c"], 2 );
forall( j in Jobs ) startOf(act[j]) == loc[j];
}
There are three jobs: "a", "b", and "c". And we want to find a schedule with minmal makespan.
Each job must be allocated to a location, and their start time depends on the location.
The location of "a" must be 1, 5, 9, 13, or 17, and the location of "b" must be 1, 6, 11, or 16.
The start time of "c" must be later than or equal to the end time of "a" plus 2.
The optimal solution of this example is like this: start time of a = 1, b = 6, and c = 8.
Then, let us add another constraint: distance between consecutive intervals must be less than or equal to 4.
(This is the maximal distance constraint I said before.)
The optimal solution violates this constraint, so we have to add constraints in the model.
My question is how can I describe constraints for such a case.
The following constraint does not work.
forall( j in Jobs ) {
if( typeOfNext(ss, act[j], 0) != 0 ) {
startOfNext(ss, act[j], 0) - startOf(act[j]) <= 4 ;
}
}
#DecisionOptimization#OPLusingCPOptimizer