[Cbc] multiple solutions with CbcMain

Haroldo Gambini Santos haroldo.santos at gmail.com
Fri Feb 13 10:36:10 EST 2015


Hi Matthew,

To call CbcMain I think that the recommended way is:

CbcMain0(cbcModel);
CbcMain1( nArgs, args, cbcModel);

Using this way I got multiple solutions at the end using

cbcModel.numberSavedSolutions()  and contents cbcModel.savedSolution(i);



On 13-02-2015 11:53, Matthew Galati wrote:
> I switched to CbcMain from CbcModel.branchAndBound() based on comments 
> about performance.
>
> I want to get multiple solutions from Cbc.
>
> I am doing this:
>
>    const char * argv[20];
>    int   argc      = 0;
>    string cbcExe   = "cbc";
>    string cbcSolve = "-solve";
>    string cbcQuit  = "-quit";
>    string cbcLog   = "-log";
>    string cbcLogSet= UtilIntToStr(debugLevel);
>    string cbcMaxSave= "-maxSaved";
>    string cbcMaxSaveSet= "100";
>
>    argv[argc++] = cbcExe.c_str();
>    argv[argc++] = cbcLog.c_str();
>    argv[argc++] = cbcLogSet.c_str();
>    argv[argc++] = cbcMaxSave.c_str();
>    argv[argc++] = cbcMaxSaveSet.c_str();
>    argv[argc++] = cbcSolve.c_str();
>    argv[argc++] = cbcQuit.c_str();
>    CbcModel cbc(*osiClp);
>
>
>    CbcMain(argc, argv, cbc);
>
>
> And from the log, I can tell there are multiple solutions.
>
> Then, I tried to get them with:
> int nSolutions = cbc.numberSavedSolutions();
>
> But, it says there is only 1.
>
> When I was using cbc.branchAndBound(), this access method worked fine.
>
> How do I get the multiple solutions back when using CbcMain?
>
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc

-- 
==================================================
Haroldo Gambini Santos
D.Sc, Computer Science
Universidade Federal de Ouro Preto
http://www.decom.ufop.br/haroldo/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20150213/b61aec23/attachment-0001.html>


More information about the Cbc mailing list