Originally posted by: PhilippeLaborie
// for station 1 this expression does not work...how can i model it?
You could use conditional ternary expressions: (s==1) ? StationLength : StationLength-MaxDrift[s-1]
// dvar int overload [1..N][1..S][1..G];
// dvar interval work[i in 1..N][s in 1..S][g in 1..G] size b[v[i]][s][g]-overload[i][s][g]; //Length of working time minus if overload occurs
You cannot use a variable when defining the range of an interval variable.
Furthermore, I'm not sure you need to model 'overload' as a decision variable. I would rather do something like this, assuming there is a known (fixed) maximal overload maxOverload[i][s][g]:
dvar interval work[i in 1..N][s in 1..S][g in 1..G] size b[v[i]][s][g]-maxOverload[i][s][g]..b[v[i]][s][g]; //Length of working time minus if overload occurs
dexpr int overload [i in 1..N][s in 1..S][g in 1..G] = sizeOf(work[i][s][g])-b[v[i]][s][g];
// startOf(station[i][1][2]) % c == 0; //How can you translate this constraint into the model?
// startAtStart(station[i][s], work[i][s][g], drift[i][s][g]); //What does this constraint say? Do I need it for the model?
These constraint were here to ensure synchronize the start time of each stations to multiples of 120s and measure what I used to call the 'drift time' with respect to this multiple of 120s, if the duration of the stations are not always 120s, these constraints should be removed. And probably replaced by something else, but I'm not sure to still fully understand how all these stations/work times are synchronized.
//Does this mean that the calculation is executed for a maximum of 600 sec?
Yes
// cp.setSearchPhases(f.searchPhase(stationSeq[1])); //???
This is not part of the model itself but of the parameterization of the search engine. When used, it telles the engine to first fix the order of the intervals in the sequence given as argument end only then, to fix the start/end values of the intervals in the sequence.
On problems like here were you mostly need to order only one sequence of events (all the sequences are the 'same'), then it can improve the performance of the search.
// sameSequence(stationSeq[1][g],workStationSeq[s][g]); // Is this redundant?
Yes
// I would like to know in which order the product instances are produced and like to know which variant is linked to the instance.
tuple Solution { int start; int product; int variant; }
sorted {Solution} sol = { <startOf(station[i][1][1]),i,v[i]> | i in 1..N };
execute {
writeln(sol);
}
#DecisionOptimization#OPLusingCPOptimizer