[Coin-discuss] OSI branchAndBound vs CBC
Matthew Saltzman
mjs at clemson.edu
Sun May 24 16:02:56 EDT 2009
Matt-
Good thoughts. Could you file tickets so I don't lose these ideas?
Thanks.
Matt
On Sat, 2009-05-23 at 19:45 -0400, Matthew Galati wrote:
> Thanks All.
>
> This
> const char *args[] = {"Cbc_Test", "-solve", "-quit"};
> CbcModel model(*solver.getRealSolverPtr());
> CbcMain0(model);
> CbcMain1(3, args, model);
>
> seems to work much better than OsiCbc::branchAndBound( ) !
>
> This is a very odd construction. Maybe I asked this before, but why
> don't we just have a CbcModel::model.solve( ) method? Why is there not
> some simple API like this for solving a MILP with CBC?
>
> Moreover - for OSI users, why don't we have an OsiCbc::solveMilp( )
> method? The base class can have solveMilp( ) virtual and for those
> OsiXxx's that can solve MILPs (OsiCpx, OsiXpr, OsiCbc, ...), it gets
> derived, else it returns an error. I understand the reluctance to add
> MILP support in OSI when OSI2 was being discussed -- but that was many
> years ago. As an "interim" fix, can we at least make OSI work for
> MILPs - since many people are already using them to define and (try
> to) solve MILPs.
>
> Thanks,
> Matt
>
>
>
>
> Hi,
>
> > I have a similar problem, which you helped me with
> previously:
> >
> http://list.coin-or.org/pipermail/cbc/2008-February/thread.html#99
> >
> > Just a quick summary: I have a model in OSI and need to get
> solution
> > there as well:
> > OsiCbcSolverInterface solver;
>
>
> Better use "OsiClpSolverInterface solver;" here.
> I think Cbc do some special stuff if the instance comes as an
> OsiClp object.
>
> > const char *args[] = {"Cbc_Test", "-solve", "-quit"};
> >
> > One option is to create a new CbcModel and solve it:
> > CbcModel model(*solver.getRealSolverPtr());
> > CbcMain0(model);
> > CbcMain1(3, args, model);
> > This works fine, but how do I get copy the solution to the
> OSI object?
> > (I tried solver->getModelPtr()->setBestSolution and
> > solver->getModelPtr()->setObjValue, using the values from
> model, but it
> > does not work - it does not update the "best possible
> solution", so even
> > if solver knows about the optimal solution, it does not know
> it is
> > optimal..)
>
>
> CbcModel creates a copy of the Osi interface that you give to
> it and
> works on this one. So maybe using the OsiSolverInterface* from
> model.solver() will work?
> Or you fix integer variables to the solution in your Osi, try
> to copy
> the basis from model.solver() as well, and do a resolve() in
> your Osi.
>
> > The other option is to work directly on the CbcModel of the
> OSI object:
> > CbcMain0(*solver.getModelPtr());
> > CbcMain1(3, args, *solver.getModelPtr());
> > In works fine in the sense that solver now has the optimal
> solution (and
> > knows it is optimal).
> > The problem with this version is that the CbcMain1 function
> takes more
> > than 3 times longer and in the first option - any idea why
> and how to
> > fix it?
>
>
> Maybe the way the CbcModel is setup in OsiCbc is different.
>
> Stefan
>
> --
> Stefan Vigerske
> Humboldt University Berlin, Numerical Mathematics
> http://www.math.hu-berlin.de/~stefan
>
>
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs
More information about the Coin-discuss
mailing list