[Coin-discuss] some information about Cbc
Benoît MERLET
benoit.merlet at orange-ft.com
Wed Aug 2 08:53:29 EDT 2006
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.
More information about the Coin-discuss
mailing list