[Coin-discuss] some information about Cbc
John J Forrest
jjforre at us.ibm.com
Wed Aug 2 09:26:32 EDT 2006
Benoît,
Part of the problem could be basis handling. The actual copying of the
solver should not take much time but the way you are doing it you are
losing the optimal basis.
I would replace the loadProblem by
OsiSolverInterface * osiSolver = si.clone(); which keeps basis
information.
Then if you need an OsiClpSolverInterface do a dynamic cast.
See if that helps. If not I may have one more suggestion but that is the
simplest.
John Forrest
Benoît MERLET
<benoit.merlet at or
ange-ft.com> To
Sent by: coin-discuss at list.coin-or.org
coin-discuss-boun cc
ces at list.coin-or.
org Subject
[Coin-discuss] some information
about Cbc
08/02/06 08:53 AM
Please respond to
Discussions about
open source
software for
Operations
Research
<coin-discuss at lis
t.coin-or.org>
Hello,
First of all, let me present myself : i'm a French student in training
period at France Telecom R&D. I work on a branch-and-cut algorithm for a
specific capacitated network design problem.
For the implementation of the method, i use Cbc with Cgl. It works fine,
but takes time, and i think i can improve it.
Indeed, in the generateCuts() method of the CglCutGenerator i develop, i
make a copy of the OsiSolverInterface constant reference `si' :
OsiClpSolverInterface solver;
solver.loadProblem(
* (si.getMatrixByRow()),
si.getColLower(),
si.getColUpper(),
si.getObjCoefficients(),
si.getRowLower(),
si.getRowUpper()
);
The reason is i have to modify it (add cuts) and re-solve the LP
relaxation of the node until the cutGenerationProcess() can't generate
cuts anymore :
do
{
solver.initialSolve();
if( solver->isProvenPrimalInfeasible() )
return;
const double * sol = solver.getColSolution();
const int nVars = solver.getNumCols();
// cs is the OsiCuts cutset
// all the cuts added to cs are also added to solver
nCuts = cutGenerationProcess(solver, sol, cs);
}
while( nCuts != 0 );
This generator have to be run only once, so, after creating the
CbcModel, i do :
model.setMaximumCutPasses(1);
The problem is that on every node of the branch-and-cut, the solver is
copied, just because i can't modify it.
For information, i've already tried to "hack" the philosophy of Cgl
adding a parameter to the constructor of my CglCutGenerator :
OsiSolverInterface * cbcSolver
which is saved as an attribute. I instanciate my generator as follow :
MyCglCutGenerator generator(model.solver());
and, in the generator, the cuts are directly added to `cbcSolver' and
not to the cutset `cs' in order to avoid their duplication. But sadly,
it takes more time having a solution than the first way ...
Why ? I don't know. :)
Have you ideas why my "hack" doesn't work ?
Have you proposition to avoid this copy at every node ?
Thank you by advance,
Benoît.
_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss
More information about the Coin-discuss
mailing list