Originally posted by: PhilippeLaborie
Hello,
First, concerning the error, it indeed is an issue in CP Optimizer on models with sameSequence constraints that are defined without the arrays of interval variables: in this case model.end() may crash. It will be fixed in future releases.
There are several possible work-arounds:
1- Do not use model.end() but let the memory be released when you end the environment (env.end()). If you only want to release the memory of the IloCP engine, you can also call cp.end()
2- If you really need to destroy only the model, then you should use the constructor of sameSequence that, beside the two sequence variables, also uses two arrays of interval variables.
Looking at the model you described above, I'm really wondering why it is so complex:
1- If you have precedence constraints (endBeforeStart) between consecutive operations of the same job, then, by construction, they do not overlap, so you do not need to add a noOverlap constraint between these operations (startVar[i] is an array that represents all the operations of job i):
seqs[i] = IloIntervalSequenceVar(env, Startvar[i]);
model.add(IloNoOverlap(env, seqs[i]));
2- Given that your problem is like a flow shop and all jobs go through the same machines in the same order, you do not need to have sameSequence constraints between these sequences
3- You post too many noOverlap constraints for the machines. You do not need to post one (and the same) noOverlap per job!
for (IloInt k = 0; k < Jobs; k++) {
sizeofoperation[k] = Startvar[k][0];
}
for (IloInt k = 0; k < Jobs; k++) {
model.add(IloNoOverlap(env, sizeofoperation));
}
4- And if your problem is a permutation flow shop problem, then it is between these noOverlap (the noOverlap on the operations of a machine, not the fixed sequence of operation on a job) that you need to post a sameSequence constraint
5- If you want to minimize the makespan, you do not need to introduce a decision variable for that. You can just minimize the "max" of the last operations end times.
In short, if your problem is similar to the classical permutation flow-shop problem, you should look at the distributed example 'cpoptimizer/examples/src/cpp/sched_pflowshop.cpp'. It is exactly about this problem.
#DecisionOptimization#OPLusingCPOptimizer