[Cbc] Information about the LP relaxation inside CbcBranchDynamicDecision::betterBranch

John Forrest john.forrest at fastercoin.com
Tue Jan 10 04:05:23 EST 2012


Haroldo,

Solution changes because of stuff like strong branching.

Look at model()->testSolution()[idxVar]


John Forrest

On 07/01/12 14:12, Haroldo Gambini Santos wrote:
> Hi,
>
> I'm working to customize my branching rules using a the *betterBranch* 
> method in a class derived from *CbcBranchDynamicDecision*.
>
> This method has the following signature:
> *betterBranch(CbcBranchingObject *thisOne,
>       CbcBranchingObject *bestSoFar,
>       double changeUp, int numInfUp,
>       double changeDown, int numInfDown)
> *
> To decide which variable to branch I need to check:
>   - fractional value which variables take in current LP solution;
>   - variable names (some variables are more important than others and 
> I can check this by looking at their names.
>
> I think I succeed to check for their names with the following code:
> *   OsiSolverInterface *lp = thisOne->model()->referenceSolver();
>    CbcIntegerBranchingObject *ibo = 
> dynamic_cast<CbcIntegerBranchingObject *> (thisOne);
>    if (ibo)
>    {
>       int idxInt = ibo->variable();
>       int idxVar = ibo->model()->integerVariable()[idxInt];
>       // name is in lp->getColName(idxVar)
> *
> To check for the fractional value I though I could pick the value in:
> *   lp->getColSolution()[idxVar]
> *
> But this value appears to be an integer value in many calls - I though 
> that only fractional variables where considered for *thisOne* object.
>
> Is this the correct way to get the fractional value of the variable ???
>
> -- 
> =============================================================
> Haroldo Gambini Santos
> Computing Department - Universidade Federal de Ouro Preto - UFOP
> email: haroldo [at ] iceb.ufop.br
> home/research page:www.decom.ufop.br/haroldo/
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20120110/3244bbb5/attachment.html>


More information about the Cbc mailing list