[Scip] imposing branches of master in subproblem

Gerald Gamrath gamrath at zib.de
Mon Apr 21 22:46:01 CEST 2014


Dear Shahin,
>
> for my branch-and -price , I spent one day trying implement (with 
> minimal success) those stuffs in explained in  FAQ (also looking at 
> coloring example). The question in FAQ says:
> "I want to store some information at the nodes and update my pricer's 
> data structures when entering a new node. How can I do that?"
>
> The explanation is talking about three different things apparently.
No, it is not. You need to implement a constraint handler (similar to 
examples/Coloring/src/cons_storeGraph.c), which
1) stores your branching decisions at nodes
2) updates your pricing problem when a node is entered or left 
(CONSACTIVE/DEACTIVE)
3) checks master variables for their compatibility with the branching 
decision of the current node (CONSPROP)

All this belongs together. In order to impose branching decisions in the 
master problem, you need to update your pricing problem w.r.t. these 
decisions and at the same time fix variables to zero which don't comply 
with the decisions.
> What I need is basically imposing branches in master problem on 
> variables of subproblem:
> that is the last line of this FAQ question.
>
> Well, I doubt that looking into the coloring example would be a very 
> straightforward way to understand how to do that, at least for me :)
>
> I have added
>
>    SCIP_CALL( SCIPaddConsNode(scip, upchild, up_branch_con,  NULL) );
>    SCIP_CALL( SCIPaddConsNode(scip, downchild, down_branch_con, NULL) );
>
>   Now in the SCIP_DECL_PRICERREDCOST:
> How does one recover this constraint and the data attached to the 
> current branch node? what about the whole history of branches along 
> the tree up to this node?
The idea of cons_storeGraph is to update the pricing problem whenever a 
node in the tree is entered or left, such that when your pricing problem 
is called, the internal data is always correct. This is done in the 
CONSACTIVE and CONSDEACTIVE callbacks. If you want to do this within the 
pricing, have a look at COLORconsGetActiveStoreGraphCons(), which 
returns the constraint corresponding to the current node or 
COLORconsGetStack() which returns the complete stack of all currently 
active constraints. Alternatively, you could also use 
SCIPconshdlrGetConss() to get all constraints of your handler which are 
active at the current node.
In order to get the data stored in a constraint, use SCIPconsGetData() 
or (better) add external methods to your constraint handler returning 
whatever you need.

Best,
Gerald


More information about the Scip mailing list