[Cbc] cbc.savedSolutionObjective() does not flip sign for max

Matthew Galati matthew.galati at gmail.com
Sat Feb 14 20:28:13 EST 2015


Well - that was using cbc.branchAndBound().

The behavior is different for CbcMain().

The first solution is the right sign, the rest are not.

nSolutions=3
i=0 saved sol obj=279.9
i=1 saved sol obj=-279.43
i=2 saved sol obj=-279.28

Unless there is only one solution, then the sign is wrong for even for the
first solution:
nSolutions=1
i=0 saved sol obj=-282.4


On Thu, Feb 12, 2015 at 5:06 PM, Matthew Galati <matthew.galati at gmail.com>
wrote:

> int nSolutions = cbc.numberSavedSolutions();
>    printf("nSolutions=%d\n", nSolutions);
>    for(int i =0; i < nSolutions; i++){
>       printf("i=%d obj=%g\n", i, cbc.savedSolutionObjective(i));
>    }
>    double         objValue    =  cbc.getObjValue();
>    printf("opt=%g\n", cbc.getObjValue());
>
>
> nSolutions=6
> i=0 obj=-282.4
> i=1 obj=-282.21
> i=2 obj=-279.97
> i=3 obj=-267.76
> i=4 obj=-248.95
> i=5 obj=-247.9
> opt=282.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20150214/2502daf2/attachment.html>


More information about the Cbc mailing list