Originally posted by: PhilippeLaborie
You can use the notion of intensity function as follows:
1. You define a stepFunction h with value 100 (100%) during the holes and value 0 outside the holes.
2. Your intervals in the noOverlap constraint are defined with this intensity function. the intensity function will ensure the following relation between the size and the start/end/length of each interval variable:
size = sum(start->end) h(t) / 100
length = end-start
So 'size' will be the total duration of the interval variable executed inside the holes, this is what you want.
Be careful then that you need to specify a 'length' and not a 'size' when defining the "duration" of the interval variable.
So instead of doing:
dvar interval x[i in 1..10] in 0..1000 size 1..5;
You need:
dvar interval x[i in 1..10] in 0..1000 intensity h;
forall(i in 1..10) {
1 <= lengthOf(x[i],1) <= 5;
}
Then you can directly minimize:
minimize sum(i in 1..10) sizeOf(x[i],0);
Two remarks:
1- there is an example of manipulation of step functions and intensity functions in the delivered example sched_calendar
2- of course if your interval variables already have some intensity function defined for other reasons, you will need to duplicate the variables and synchronize them (with startAtStart/endAtEnd constraints).
#DecisionOptimization#OPLusingCPOptimizer