Hello. I am trying to find all optimal solutions to a shortest path problem as part of a larger problem. I have two problems loaded, one called ‘main’ and the other called ‘subproblem’. The relevant code is as follows:
option cplex_options 'poolstub=solfile populate=1 poolintensity=4 poolagap=0';
repeat while bestSubobj > -1 * tau and iterationCount < 10 {
print("Solving main problem");
option cplex_options 'poolstub=mainsolfile poolcapacity=1';
problem main;
solve main;
#Irreleveant code
.
.
.
.
#Solving to get the correct optimal value
option cplex_options 'poolstub=unconstrainedsubsolfile poolcapacity=1';
solve subproblem;
let optimalLength := Total_Cost;
#Getting all optimal solutions
problem subproblem;
option cplex_options 'poolstub=subsolfile poolcapacity=2100000000 populate=1 poolintensity=4 poolagap=0';
solve subproblem;
print(Current.result);#Put here so I can get a value for a for loop
This generates the following error:
Bad suffix .npool for subproblem
context: >>> print(Current.npool) <<< ;
Possible suffix values for subproblem.suffix:
astatus exitcode message relax
result sstatus stage
I attempted to fix this error with the following line I found online:
suffix npool OUT;
While this successfully gets it to run, npool is 0, which breaks things. Additionally, cplex options seem to be chosen out of order, as the output is the following:
Solving main problem
CPLEX 22.1.1.0: poolstub=subsolfile
poolcapacity=2100000000
populate=1
poolintensity=4
poolagap=0
CPLEX 22.1.1.0: optimal integer solution; objective 190
9 MIP simplex iterations
0 branch-and-bound nodes
No basis.
Wrote 1 solution in solution pool
to file subsolfile1.sol.
CPLEX 22.1.1.0: poolstub=mainsolfile
poolcapacity=1
CPLEX 22.1.1.0: optimal solution; objective 190
0 dual simplex iterations (0 in phase I)
Solution determined by presolve;
objective Total_Cost = 190.
0
The 0 at the end is from print(Current.npool); Could someone help me figure out how to get the correct number of optimal solutions from npool? Thanks!