Hi,
in CPLEX_Studio129\opl\examples\opl\sched_jobshop we have a jobshop example with CPO
And CPO is the right method for jobshop.
I often get question on how to write that as a MIP even though CPO is the way to go.
https://www.sciencedirect.com/science/article/pii/S0305054816300764
One way is to enumerate time with boolean decision variables.
If you do not you may rewrite the CPO model into
int nbJobs = ...;
int nbMchs = ...;
range Jobs = 0..nbJobs-1;
range Mchs = 0..nbMchs-1;
// Mchs is used both to index machines and operation position in job
tuple Operation {
int mch; // Machine
int pt; // Processing time
};
Operation Ops[j in Jobs][m in Mchs] = ...;
dvar int+ s[j in Jobs][o in Mchs];
dexpr int e[j in Jobs][o in Mchs]=s[j][o]+Ops[j][o].pt;
minimize max(j in Jobs) e[j][nbMchs-1];
subject to {
forall (m in Mchs,ordered i,j in Jobs, o1 in Mchs,o2 in Mchs:Ops[i][o1].mch == m && Ops[j][o2].mch == m)
(e[i][o1]<=s[j][o2]) || (e[j][o2]<=s[i][o1]);
forall (j in Jobs, o in 0..nbMchs-2)
e[j][o]<=s[j][o+1];
}
execute {
for (var j = 0; j <= nbJobs-1; j++) {
for (var o = 0; o <= nbMchs-1; o++) {
write(s[j][o] + " ");
}
writeln("");
}
regards
NB: Read http://icaps17.icaps-conference.org/tutorials/T3-Introduction-to-CP-Optimizer-for-Scheduling.pdf
#DecisionOptimization#OPLusingCPLEXOptimizer