Originally posted by: dbaena
Hi,
I'm using cplex 12 and I want to solve a MIP problem with limit time. When i get the limit time I want to know each integer solution found (feasible of course) of this problem and keep the best integer (and x solution).
I did it using it:
if ((status == CPX_STAT_ABORT_TIME_LIM) || (status == CPXMIP_SOL_LIM))
{
nsols=cplex.getSolnPoolNsolns();
if (nsols>0)
{
//feasible_sol_found
cout << "abort time limit with feasible solution found " << endl;
// get new best solution
BestNode=Inf;
cout << nsols << " integer solutions found" << endl;
for (int i=0;i<nsols;i++)
{
ObjValue = cplex.getObjValue(i);
if ( ObjValue < BestNode)
{
BestNode = ObjValue;
cplex.getValues(xtil,vars,i);
}//end_if
}//end_for
using SolutionPool of cplex. However, I am having several problems. For example I do:
cplex.getObjValue(i) //
and I obtain a value that is not according with value of variables in xtil:
cplex.getValues(xtil,vars,i)...
I don't know what happen...
Thanks a lot!
#CPLEXOptimizers#DecisionOptimization