Originally posted by: AndyHam
Hi IBM,
I have a further question about CP-MIP interlinking. I am trying to generate an allocation decision by MIP and feed it to CP for the sequencing job.
-
MIP model has a decision variable of x[j][r][m]
-
CP has an interval variable of itvMach (tuple qual) // tuple tpQual has three members: j, r, and m.
My question is how to convert MIP's x[j][r][m] so that I can force the presence of corresponding itvMach of CP.
The highlighted area has an error, but I hope it shows what I am trying to do.
for(var j=1;j<=nj;j++)
for(var r=1;r<=nr;r++)
for(var m=1;m<=nm;m++)
if(j2m.job==j && j2m.mch==m && j2m.ret==r && opl1.x[j][r][m]==1) opl2.add(presenceOf(itvMach[j,r,m])==true);
main {
var data = new IloOplDataSource("Litho.dat");
var source1 = new IloOplModelSource("Litho_MIP.mod");
var cplex = new IloCplex();
var def1 = new IloOplModelDefinition(source1);
var source2 = new IloOplModelSource("Litho_CP.mod");
var cp = new IloCP();
var def2 = new IloOplModelDefinition(source2);
var opl1 = new IloOplModel(def1,cplex);
opl1.addDataSource(data);
var opl2 = new IloOplModel(def2,cp);
opl2.addDataSource(data);
opl1.generate();
opl2.generate();
cplex.tilim=10;
cplex.solve();
writeln("cplex objective = ",cplex.getObjValue());
cp.param.timelimit=10;
cp.param.SearchType=24;
for(var j=1;j<=nj;j++)
for(var r=1;r<=nr;r++)
for(var m=1;m<=nm;m++)
if(j2m.job==j && j2m.mch==m && j2m.ret==r && opl1.x[j][r][m]==1) opl2.add(presenceOf(itvMach[j,r,m])==true);
cp.solve();
}
#CPOptimizer#DecisionOptimization