[Cbc] Multiple Optimal Solutions

John Forrest john.forrest at fastercoin.com
Wed Feb 29 03:55:45 EST 2012


Seeing the discussion of multiple solutions, I have made a few changes 
to Cbc/trunk.

I have modified Cbc/examples/driver4.cpp to show how you can print 
solutions to preprocessed problem.  This example can be used in 
Cbc/stable, but then user has to know if they are doing preprocessing as 
the test may not be correct.  The values of the variables which are 
still in the problem are printed correctly with the correct sequence 
number (or name).  The values of variables which were preprocessed out 
are not printed.  If the change below to Cbc is satisfactory then, at 
greater computational expense, the complete solution could be printed.

Cbc trunk has been altered so that postprocessing can be done several 
times on different solutions.  As Cbc trunk normally uses Cgl/stable and 
as stable code should not be modified too much, I have had to 
temporarily make it a conditional compile.  So add -DKEEP_POSTPROCESS to 
CXXDEFS in configure.  When Cgl/trunk migrates to stable, this will not 
be necessary.

Multiple solutions can now be printed or printed to file from the 
executable.  There is a new integer parameter maxSolutions and a new 
command nextB(estsolution) which acts like "solution", but works on the 
second best solution and then moves all others up.  The best solution is 
never touched.  So -

cbc ...... -solve -solution best.sol -nextbest 2.sol -nextbest 3.sol 
-solution best2.sol

would put the best solution to best.sol and best2.sol while the second 
best goes to 2.sol and the third best to 3.sol.  There is no action if 
no solution.

This was all a quick fix - I hope it helps.

John Forrest


More information about the Cbc mailing list