[Cbc] CbcMain1 returns bogus result when it cannot improve on setBestSolution

Jack Vreeken jack at vreeken.me
Mon Jun 3 05:09:37 EDT 2019


Hello all,

I am doing multi-objective/priority optimization, and want to pass the best
solution from the previous priority along to the next (which speeds up things
a lot). I therefore first call setBestSolution(), before calling CbcMain1(). I
am however a bit confused about how to (1) reliably check if CBC was able to
find a solution, and (2) how to get/store/return that solution.

According to some examples in Cbc, the correct procedure is "[...] but
initially check if status is 0 and secondary status is 1 -> infeasible".  
This approach fails when setBestSolution() returns the optimal objective
value. The return status values from the model after calling CbcMain1() are
then:

status: 0, isProvenOptimal: 1, secondaryStatus: 1
isProvenInfeasible: 0, objective: 0.0000000

Am I correct in understanding that a proper check would have to involve
checking isProvenOptimal() and/or isProvenInfeasible() as well? 

Also, it seems that CbcMain1() return a bogus solution in this case, whereas I
was expecting it to return the solution that setBestSolution() found. Is this
intended behavior? Is there a way to make CbcMain1() return it somehow, or
should I store/overwrite the solution myself with the one after calling
setBestSolution()?

Kind regards,

Jack Vreeken

(Spin-off from https://github.com/casadi/casadi/issues/2410)


More information about the Cbc mailing list