Originally posted by: SystemAdmin
Here are some of the things which I find amiss in your code:
1) Declaration of h
dvar
boolean h[j in Jobs][m in M][n in M2];
//= s[j][m]> s[j][n]?1:0;
A decision variable cannot be used in the conditional initialization of another decision variable. Assuming that h can only take boolean values (0/1), I would instead declare h as boolean. Along with that the 2nd and 3rd indexes of h should be Mchs and not M and M2 since you have constraints in which h[j][m][n] and h[j][n][m] are used. It seems that h represents a variable denoting whether a certain job is assigned to a certain machine(s) or not and hence you multiply it with OpDurations in certain constraints. To accomodate all these requirements, it is better for you to use indicator constraints since they will prevent converting the MIP to a MIQCP. Here's one way to do so (I have added constraint names as well):
dvar
boolean h[j in Jobs][m in Mchs][n in Mchs]; ... subject to
{
//indicator constraints for h[][][] forall(j in Jobs, m in M, n in M2)
{ (s[j][m]>=s[j][n]+epsilon) => h[j][m][n]==1; (s[j][m]<=s[j][n]+epsilon) => h[j][m][n]==0; (h[j][m][n]==0) => OpDurations[j][n]==0; (h[j][n][m]==0) => OpDurations[j][m]==0;
} ... forall (j in Jobs,m in M2,n in M)
{ Constraint3: s[j][m]>=(s[j][n]+OpDurations[j][n]); Constraint4: s[j][n]>=(s[j][m]+OpDurations[j][m]);
}
2) Given the model structure, you seem to be using CPLEX and not the CP engine, and thus the execute block is misplaced. You will need to comment that section out:
/*execute { cp.param.FailLimit = 100000000; }*/
3) Even after all these changes, the model is not solvable since because of the quadratic constraint:
forall (j,k in Jobs:j!=k,m in Mchs) Constraint2:s[j][m]>=(s[k][m]+OpDurations[k][m])*g[j][k][m];
The Q matrix in this constraint is not positive semi-definite and hence CPLEX throws a CPLEX Error 5002 error when trying to solve this model, indicating that the problem is non-convex in nature. I donot understand the g variable, but if it is just an indicator type of variable, then you could do something like what we did for the other quadratic constraint.
Please find the modified mod file attached. Hope this helps and provides you a way forward.
#DecisionOptimization#OPLusingCPLEXOptimizer