[Coin-discuss] sychronising the solution for OsiCbc after branch and bound

Kish Shen kish.shen at crosscoreop.com
Wed Jul 5 16:17:35 EDT 2006


On Friday 30 June 2006 09:04, John J Forrest wrote:
> I may get round to looking at this problem with OsiCbc but I will repeat
> for the umpteenth time that I really regret giving in to someone's request
> for OsiCbc as it is a circular idea with an OsiSolverInterface using
> another OsiSolverInterface.  It is far better to use Cbc directly and then
> a generic OsiSolver (OK - so that may break too but at least I will try and
> fix it).  sample2.cpp uses OsiClp not OsiCbc so it should be easy to move
> to Cbc directly.
>
I have been using the Cbc directly as suggested. I am now wondering how to 
synchronise the problem in the CbcModel and the original problem in the 
OsiClpSolverInterface.

The original problem is in lp->Solver, where Solver is an 
OsiClpSolverInterface *, and the CbcModel * is in lp->mipmodel 

For the first time that a MIP problem is solved, the original problem is first 
copied to the CbcModel as follows:

	lp->mipmodel = new CbcModel(static_cast<OsiSolverInterface &>(*lp->Solver));
       CbcModel* model = lp->mipmodel
 
and then eventually the branch and bound is performed:
 
   	model->branchAndBound();

At this point, I would like to transfer the solution in model (lp->mipmodel) 
back to lp->Solver. Can this be done?

In the Cbc User Guide suggests that this can be done by `refreshing the 
original':

lp->Solver = dynamic_cast< OsiClpSolverInterface*>(model->solver());

but as far as I can tell, lp->Solver is just given the pointer 
model->solver(), rather than updating what was in *lp->Solver

After this branch and bound, and obtaining the results of the solve (from 
lp->Solver), the problem in lp->Solver can be modified, and eventually 
resloved. Now, the MIP problem in lp->mipmodel needs to be updated with the 
modifications from lp->Solver. How can I do this?

The alternative is to delete the CbcModel in lp->mipmodel, and then allocate a 
new CbcModel to lp->mipmodel. Would this be better than trying to update the 
exiting mipmodel?

Thanks in advance for any suggestions and help!

Yours sincerely,

Kish Shen



More information about the Coin-discuss mailing list