Originally posted by: davidoff
I wrote a similar model in Java but without populate method since I simply want to use the current solution pool natively available at the end of a solve
int nsolns = cplex.getSolnPoolNsolns();
System.out.println("Number of solutions found = "+nsolns);
System.out.println();
for (int s=0; s<nsolns; s++) {
System.out.println("solution #" + s + ": objective = "+ cplex.getObjValue(s)+ ": gap = "+ (cplex.getObjValue(s)-cplex.getBestObjValue()));
Here is the MIP log and the output
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0+ 0 85.0000 0.0000 115 100.00%
* 0+ 0 71.2500 0.0000 115 100.00%
* 0+ 0 64.5833 0.0000 115 100.00%
0 0 38.3333 32 64.5833 38.3333 115 40.65%
* 0+ 0 55.0000 38.3333 115 30.30%
0 0 38.3333 38 55.0000 Cuts: 3 142 30.30%
0 0 38.3333 32 55.0000 Fract: 3 150 30.30%
0 0 38.3333 32 55.0000 Covers: 1 160 30.30%
* 0+ 0 51.6667 38.3333 160 25.81%
0 0 cutoff 51.6667 51.6667 160 0.00%
Elapsed time = 0.23 sec. (32.11 ticks, tree = 0.00 MB, solutions = 5)
Cover cuts applied: 1
Lift and project cuts applied: 1
Gomory fractional cuts applied: 2
Root node processing (before b&c):
Real time = 0.23 sec. (32.12 ticks)
Parallel b&c, 4 threads:
Real time = 0.00 sec. (0.00 ticks)
Sync time (average) = 0.00 sec.
Wait time (average) = 0.00 sec.
------------
Total (root+branch&cut) = 0.23 sec. (32.12 ticks)
INFO: CPLEX status = Optimal
Objective function = 51.66666666666666
Number of solutions found = 5
solution #0: objective = 51.66666666666666: gap = 0.0
solution #1: objective = 71.24999999999999: gap = 19.58333333333333
solution #2: objective = 64.58333333333331: gap = 12.916666666666657
solution #3: objective = 54.99999999999999: gap = 3.3333333333333357
solution #4: objective = 85.0: gap = 33.33333333333334
With this method , the gap of each incumbent is based on the best objective value at the very end, which differs a little bit from what we see in the MIP log since the best bound will be improving too.
#CPLEXOptimizers#DecisionOptimization