Originally posted by: AmirB.
Hi,
I have two questions in my code.
1. when I uncomment " if(testopl.x >= -0.5)" create a Error "No solution exist" . what is problem?can you help me to remove this error?
2. I have two type post Process in my code (exe1 and exe2). at piece of code I want to run "exe1" and not "exe2" by postProcess() function. How can I do?
Best Regards
dvar float+ x;
dvar float+ y;
minimize x+y;
subject to
{
cons1:
x+y <= 1;
}
execute exe1{
writeln("x= " , x , " y = " , y);
}
execute exe2{
writeln("x= " , x , " y = " , y);
}
main
{
var modeltest = thisOplModel.modelDefinition
var testopl = new IloOplModel(modeltest,cplex);
testopl.generate();
if(cplex.solve())
{
writeln("the opt = ",cplex.getObjValue());
writeln("post prossing means = ");
testopl.postProcess();
}
//*********************************************
//**** change objective function coeffience
if(testopl.y >= -0.5)
cplex.setObjCoef(testopl.y,-1);
// if(testopl.x >= -0.5) ????????????????????????????
cplex.setObjCoef(testopl.x,-1);
cplex.solve();
writeln("the new opt after change coefince of constrain = ",cplex.getObjValue());
testopl.postProcess();
}
#DecisionOptimization#OPLusingCPLEXOptimizer