Originally posted by: arthurmedeiros
Hello,
I obtain, as final results of my model, an answer like X[i][j] which I'm able to export to a txt file and so on. But I would like to do the same with the all the incumbent answers stored in solution pool.
I'm able to get their objective values with getObjValue(i) and even write all the solutions in a file with the command cplex.writeSolutions.
So, when I try to print X[i][j] it prints only the best solution. How do I get the values from the others as well? I know that I have then somewhere, I'm just not able to extract.
Above some of the implementation in C++
typedef IloArray<IloNumVarArray> NumVarMatrix;
typedef IloArray<IloNumArray> NumMatrix;
NumVarMatrix x(env, Up_i);
NumMatrix answer(env, Up_i);
for (int i = 0; i < Up_i; i++)
{
x[i] = IloNumVarArray(env, Up_j);
answer[i] = IloNumArray(env, Up_j);
for (int j = 0; j < Up_j; j++)
x[i][j] = IloNumVar(env, 0.0, 1, ILOINT);
}
for (int i = 0; i < up_i; i++)
cplex.getValues(answer[i], x[i]);
//How do i get the answer[i][j] from all the solutions in solution pool?
for (int i = 0; i < Up_i; i++)
{
env.out() << "Storage: " << i << endl;
for (int j = 0; j < up_j; j++)
env.out() << answer[i][j] << " ";
}
Thanks in advance.
#CPLEXOptimizers#DecisionOptimization