[Cbc] Update on using LP solvers other than Clp from Cbc

John Forrest john.forrest at fastercoin.com
Fri Jan 28 10:27:22 EST 2011


Iain,

I have spent some time looking into this and it is not simple or
promising.

Cbc has used other solvers to some extent.  For instance the ability to
use OsiCplex had been built into Cbc in a special way.  The idea was
that you could use Cbc's root heuristics and cut generators and then
hand over to Cplex to do the actual branch and bound.  Even if some
heuristics and cut generators are in common, the implementation was
different so you could get better results.  This was activated by
defining COIN_HAS_CPX and CBC_OTHER_SOLVER to 1.  However this was for a
specific use of Cplex and Clp.  However it did seem the way to go.

So I did two things.  Firstly I changed #ifdefs on COIN_HAS_CLP to #if
COIN_HAS_CLP and modified code in other places so that it will miss out
incompatible code.  Secondly I allowed defining
CBC_OTHER_SOLVER=OsixxxSolverInterface.  I wasted an hour or so trying
to get #define () # and/or ## to work so I could create a C++ line of

#include "OsixxxSolverInterface.hpp" from CBC_OTHER_SOLVER

Out of interest, does anyone know how to do that?  It is of no real
importance as I have found out that not all Osi...SolverInterfaces are
equal, but it would have been more elegant to be able to drop in any
solver with a single define.

Doing this I could drop in other solvers.  I tried using two other
solvers.  I ran into one problem early, which is that many solvers
invalidate a solution as soon as the underlying model is touched, while
Clp leaves it lying around.  This can be patched round.

More worrying was that for one solver it was obvious that a lot of the
OsiSolverInterface functions had never been tested - not even on a tiny
problem.  So - how much time to spend fixing up someone else's
interface?  Another solver did not like it when a problem was
preprocessed down to zero rows - and that looked like a lot of coding to
bypass. So although there is an Osi...SolverInterface definition not all
interfaces fulfil the definition (although mostly there is no
definition).

Many other minor problems showed up.  For instance one solver produced
clean row copies of the matrix for use by Cgl functions while another
had gaps.  Some Cgl functions assumed a clean copy.  Again those sorts
of discrepancies could be patched, but the work starts to spread beyond
Cbc to Cgl and CoinUtils.

So currently I have managed to get Cbc to solve some problems using
other solvers but I don't think it is worth doing much work to get
inferior performance.  Obviously this attitude is coloured by the fact
that I do not have access to some of the better (non-free) solvers.

I could check in my changes as a step to what you need.  My only concern
is that I might break the current use of Cplex - I can't check that
without access to Cplex.

John Forrest



More information about the Cbc mailing list