12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Stating Precedence ConstraintsIn each job, activities must be processed one after the other. This order is enforced by theprecedence constraints, which look like this:for(j = 0; j < nbJob; j++){for(i = 1; i < nbResource; i++){model.add(s[j][i] >= s[j][i-1] + duration[j][i-1]);}}Stating Resource ConstraintsEach resource can process one activity at a time. To avoid having two (or more) activitiesthat share the same resource overlap with each other, disjunctive constraints are added to themodel. Disjunctive constraints look like this:s1 >= s2 + d2 or s2 >= s1 + d1where 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 disjunctionsneed 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]);}}}Representing the Piecewise Linear Cost FunctionThe earliness-tardiness cost function is the sum of piecewise linear functions having twosegments, as you see in Figure 22.1. The function takes as an argument the completion dateof the last activity of a job (in other words, the starting date plus the duration). In thattwo-segment function, the slope of the first segment is (-1) times the earliness cost, and theslope of the second segment is the tardiness cost. Moreover, at the due date, the cost is zero.370 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!