Each resource can process one activity at a time. To avoid having two (or more) activities that share the same resource overlap with each other, disjunctive constraints are added to the model. Disjunctive constraints look like this:
s1 >= s2 + d2 or s2 >= s1 + d1
|
where s
is the starting date of an activity and d
is its duration.
If n
activities need to be processed on the same resource then about (n*n)/2
disjunctions need to be stated and added to the model, like this:
for(i = 0; i < nbResource; i++) {
IloInt end = nbJob - 1;
for(j = 0; j < end; j++){
IloInt a = activityOnAResource[i][j];
for(IloInt k = j + 1; k < nbJob; k++){
IloInt b = activityOnAResource[i][k];
model.add(s[j][a] >= s[k][b] + duration[k][b]
||
s[k][b] >= s[j][a] + duration[j][a]);
}
}
}
|