[Cbc] Using LP solvers other than CLP

Iain Dunning iaindunning at gmail.com
Tue Jan 25 16:09:12 EST 2011


Hi guys,

Well it does seem a shame that CLP is so wired into CBC, but given how CBC
developed and given most peoples needs, its fairly understandable.

Do you think that it would be possible to "emulate" CLP to a certain extent?

I've made a simple LP solver, lets call it XYZ. So far (to use VS
terminology) I have two projects, libXYZ and libOsiXYZ.
libOsiXYZ has one class that inherits from OsiSolverInterface, and to start
off with I just implemented dummy functions for all the required virtual
functions.
I then ran the minimum.cpp example over and over with a linear (non-integer)
programme and implemented all the required functions until I succesfully
solved the LP.

Obviously this didn't make use of any of CBC's IP solving techniques, so
that was the next step. Seeing that there was so much CLP-specific code, I
thought it might be best to remove it so I don't implement more than the
bare minimum number of features to get my LP solver usable.

However my own experiments with this and what Lou said have cast some doubt
on that plan... Is it desirable for CBC to be LP-solver agnostic? It seems
some work has been done in this direction so far, but its far from complete.

I guess what I'm asking is - should I just forget about trying to get my LP
solver working? I don't mind if CLP is still compiled into the project, I
just don't want to ever be used to solve an LP.

Cheers,
Iain

On 25 January 2011 18:45, Ted Ralphs <ted at lehigh.edu> wrote:

> Hi Ian,
>
> What platform are you building on? Are you using the autotools? In
> general, editing CbcConfig is probably not going to get you where you
> want to go. Depending on exactly how you've built and installed Cbc,
> the line you're editing is most likely be inside a block that is being
> ignored because HAVE_CONFIG_H is defined. Even if not, I believe that
> the line
>
> #define COIN_HAS_CLP 0
>
> still defines COIN_HAS_CLP. What you would want to do in principle is
> to delete the line altogether or even put
>
> #undef COIN_HAS_CLP
>
> If you're using the autotools, there are options to configure that
> will build Cbc with alternative solvers, but if I'm not mistaken,
> these options are mostly not working at this point. Lou Hafer (cc'd)
> has worked extensively on getting Cbc to work with other solvers and
> will be able to say for sure (and save you a lot of trouble going down
> blind alleys). With Visual C++, there is a separate solutions file
> that builds Cbc with alternative solvers.  If you search the mailing
> list, you should find some posts about this or I'm sure Lou will also
> be able to let you know about it.
>
> Cheers,
>
> Ted
>
> On Mon, Jan 24, 2011 at 10:06 PM, Iain Dunning <iaindunning at gmail.com>
> wrote:
> > Hello,
> > I've been investigating the use of LP solvers other than CLP with CBC,
> and
> > I've hit a bit of a snag.
> > In CbcConfig, there are 2 lines:
> >
> > /* Define to 1 if the Clp package is used */
> > #define COIN_HAS_CLP 1
> >
> > As I am compiling the "minimum.cpp" example with an LP solver that isn't
> CLP
> > (i.e. #include "OsiXYZSolverInterface.hpp"), I figured I should set this
> to
> > zero
> >
> > #define COIN_HAS_CLP 0
> >
> > I re-compiled, and I happened to being stepping through when I noticed
> code
> > that (I think) shouldn't of been compiled, was compiled!
> >
> > As an example, right near the start of void CbcModel::branchAndBound():
> >
> > ...
> > ...
> > #ifdef COIN_HAS_CLP
> > {
> >   OsiClpSolverInterface * clpSolver = dynamic_cast<OsiClpSolverInterface
> *>
> > (solver_);
> >   if (clpSolver) {
> >     // pass in disaster handler
> >     CbcDisasterHandler handler(this);
> > ...
> > ...
> >
> >
> > Because COIN_HAS_CLP is still defined, the code still compiles. I can't
> help
> > but feel this is _not_ the intended behaviour...
> > Should it not be:
> > #if COIN_HAS_CLP == 1
> > or maybe just
> > #if COIN_HAS_CLP
> > ?
> > Cheers,
> > Iain Dunning
> > University of Auckland
> > _______________________________________________
> > Cbc mailing list
> > Cbc at list.coin-or.org
> > http://list.coin-or.org/mailman/listinfo/cbc
> >
> >
>
>
>
> --
> Dr. Ted Ralphs
> Associate Professor, Lehigh University
> (610) 628-1280
> ted 'at' lehigh 'dot' edu
> coral.ie.lehigh.edu/~ted
>



-- 
Iain Dunning
Email: iaindunning at gmail.com
Web:   http://www.iaindunning.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/cbc/attachments/20110126/a2afd972/attachment.html 


More information about the Cbc mailing list