[Cbc] Making CBC deterministic

John Forrest john.forrest at fastercoin.com
Mon Jan 5 10:31:12 EST 2015


Dan,

You should always get the same result when running serially (unless you 
set random seed to zero).

If it happens on a small problem, look for uninitialized variables e.g. 
by using valgrind.

John Forrest
On 05/01/15 15:06, Dan Burkolter wrote:
> Hi
>
> I'm using CBC to create line diagrams modeled as a MILP. I have the 
> problem that I need to ensure that two runs of the same instance 
> always lead to the same solution. I tried to do this by setting the 
> CBC and CLP random seeds in the following way:
>
> OsiClpSolverInterface solver;
> solver.loadFromCoinModel( build ); // build is a CoinModel
> CbcModel model( solver );
>
> // set optimality gap, heuristics, cut generators, and strategy
>
> model.setRandomSeed( 42 );
> solver.getModelPtr()->setRandomSeed( 42 );
>
> model.initialSolve();
> model.branchAndBound( 1 );
>
> However, I still get random behaviour, ie two runs of the same 
> instance may end in a different solution.
>
> What am I missing?
>
>
> Thanks for your help!
> Dan
>
>



More information about the Cbc mailing list