Originally posted by: SystemAdmin
I observed that if I set 0/1 for binary variables of an cplex object then I solve; the first time it displays solution and the corresponding objective value; the second time; it displays no solution. Even I create new cplex model and then set same 0/1 values on the second model.
for(int a=0;a<g.nbNodes;a++)
for(int b=0;b<g.nbNodes;b++)
freCpy[a][b]=fre[a][b];
FixVariablesValue(g,fre,cplexObj);
cplexObj.cplex.solve();
if (cplexObj.cplex.getStatus()!=IloAlgorithm::Feasible && cplexObj.cplex.getStatus()!=IloAlgorithm::Optimal)
{
cout<<"No solution for this design"<<endl;
}
else
{
FixVariablesValue(g,freCpy,cplexObj); //resolve again
cplexObj.cplex.solve();
if (cplexObj.cplex.getStatus()!=IloAlgorithm::Feasible && cplexObj.cplex.getStatus()!=IloAlgorithm::Optimal)
{
cout<<"solution existed!"<<endl;
exit(0);
}
else
{
cout<<"No solution!"<<endl; //this line is displayed
}
cout<<"Final objective value:"<<cplexObj.cplex.getObjValue()<<endl; //this line is display also
}
Please help me to understand and handle it. I just checked in windows and linux, same behaviour.
Thanks,
#DecisionOptimization#MathematicalProgramming-General