Originally posted by: AndyHam
Dear IBM,
I have a question about relaxation of CP problem. I found few postings, but I could not get what I am looking for.
https://www.ibm.com/developerworks/community/forums/html/topic?id=1eba9283-a7fc-41e6-ab39-f41cbb818e68#94e9ddac-6618-4577-81d0-bae7b5e58b42
The following code generates a conflict, because a worker is available only between 100 and 300, but there are 10 jobs with size of 10 for each and all jobs must complete by time 170. Is there any way to relax the calendar restriction (forbidExtent(itvAlt[j][i], sfCalendar);) of the jobs having the conflict? At the end, I would like to generate the schedule with a note indicating this interval has a conflict or not.
j start end Conflict
1 100 110 N
2 110 120 N
3 120 130 N
4 130 140 N
5 140 150 N
6 150 160 N
7 160 170 N
8 170 180 Y
9 180 190 Y
10 190 200 Y
ShiftCalendar = {
<100,300>
};
using CP;
tuple Break {
int s;
int e;
};
{Break} ShiftCalendar = ...;
tuple Step {
int v;
key int x;
};
sorted {Step} Steps =
{ <0, b.s> | b in ShiftCalendar } union
{ <100, b.e> | b in ShiftCalendar };
stepFunction sfCalendar =
stepwise (s in Steps) { s.v -> s.x; 100 };
range Jobs = 1..10;
range Workers = 1..1;
dvar interval itvJob[Jobs] in 1..170 size 10;
dvar interval itvAlt[Jobs][Workers] optional intensity sfCalendar;
dvar sequence seq in itvJob;
minimize max(j in Jobs) endOf(itvJob[j]);
subject to {
noOverlap(seq);
forall(j in Jobs)
alternative(itvJob[j], all(i in Workers) itvAlt[j][i]);
forall(j in Jobs,i in Workers)
forbidExtent(itvAlt[j][i], sfCalendar);
}
execute {
writeln("j" + "\t" + "start" + "\t" + "end");
for (var j in Jobs)
writeln( j + "\t" + itvJob[j].start + "\t" + itvJob[j].end );
}
#DecisionOptimization#OPLusingCPOptimizer