coin-Bcp
List of all members
BCP_lp_branching_object Class Reference

This class describes a generic branching object. More...

#include <BCP_lp_branch.hpp>

Collaboration diagram for BCP_lp_branching_object:
Collaboration graph
[legend]

Public Member Functions

Constructor and destructor
 BCP_lp_branching_object (const int children, BCP_vec< BCP_var * > *const new_vars, BCP_vec< BCP_cut * > *const new_cuts, const BCP_vec< int > *const fvp, const BCP_vec< int > *const fcp, const BCP_vec< double > *const fvb, const BCP_vec< double > *const fcb, const BCP_vec< int > *const ivp, const BCP_vec< int > *const icp, const BCP_vec< double > *const ivb, const BCP_vec< double > *const icb)
 The constructor makes a copy of each vector passed to it. More...
 
 BCP_lp_branching_object (const BCP_lp_integer_branching_object &o, const int *order)
 The constructor makes a copy of each vector passed to it. More...
 
 BCP_lp_branching_object (const OsiSolverInterface *osi, const BCP_lp_sos_branching_object &o, const int *order)
 The constructor makes a copy of each vector passed to it. More...
 
void set_presolve_result (const BCP_vec< double > &objval, const BCP_vec< int > &termcode)
 The constructor makes a copy of each vector passed to it. More...
 
 ~BCP_lp_branching_object ()
 The destructor deletes each vector. More...
 
Query methods
int vars_affected () const
 Return the number of variables whose bounds are affected by the branching. More...
 
int cuts_affected () const
 Return the number of cuts whose bounds are affected by the branching. More...
 
int vars_added () const
 Return the number of variables added in the branching. More...
 
int cuts_added () const
 Return the number of cuts added in the branching. More...
 
BCP_vec< double >::const_iterator forced_var_bd_child (const int index) const
 Return a const iterator to the position in the forced variable bound changes where the new bounds for the index-th child start. More...
 
BCP_vec< double >::const_iterator forced_cut_bd_child (const int index) const
 Return a const iterator to the position in the forced cut bound changes where the new bounds for the index-th child start. More...
 
BCP_vec< double >::const_iterator implied_var_bd_child (const int index) const
 Return a const iterator to the position in the implied variable bound changes where the new bounds for the index-th child start. More...
 
BCP_vec< double >::const_iterator implied_cut_bd_child (const int index) const
 Return a const iterator to the position in the implied cut bound changes where the new bounds for the index-th child start. More...
 
Modifying methods
void init_pos_for_added (const int added_vars_start, const int added_cuts_start)
 This method "cleans up" the positions and bounds. More...
 
void apply_child_bd (OsiSolverInterface *lp, const int child_ind) const
 This method invokes the appropriate methods of lp to apply the forced and implied bound changes of the child_ind-th child. More...
 
void print_branching_info (const int orig_varnum, const double *x, const double *obj) const
 This method prints out some information about the branching object. More...
 

Public Attributes

Data members
int child_num
 The number of children for this branching object. More...
 
BCP_vec< BCP_var * > * vars_to_add
 Variables to be added to the formulation. More...
 
BCP_vec< BCP_cut * > * cuts_to_add
 Cuts to be added to the formulation. More...
 
Data members referring to forced bound changes. "Forced" means

that the branching rule specifies this change.

BCP_vec< int > * forced_var_pos
 Positions of variables whose bounds change ("forcibly", by branching) in the children. More...
 
BCP_vec< int > * forced_cut_pos
 Positions of cuts whose bounds change ("forcibly", by branching) in the children. More...
 
BCP_vec< double > * forced_var_bd
 Contains the actual bounds for the variables indexed by forced_var_pos. More...
 
BCP_vec< double > * forced_cut_bd
 Contains the actual bounds for the cuts indexed by forced_cut_pos. More...
 
Data members referring to implied bound changes. "Implied" means

that these changes could be made by applying the forced changes and then doing logical fixing.

Therefore this information is not recorded in the Tree Manager when it stores the branching rule. However, if there are implied changes, it is useful to specify them, because strong branching may be more effecive then.

The interpretation of these data members is identical to their forced counterparts.

BCP_vec< int > * implied_var_pos
 
BCP_vec< int > * implied_cut_pos
 
BCP_vec< double > * implied_var_bd
 
BCP_vec< double > * implied_cut_bd
 
Data members referring to presolved values. The user may have

presolved the candidate.

Then she may store the termcodes and objvals of the children here.

BCP_vec< double > * objval_
 
BCP_vec< int > * termcode_
 

Private Member Functions

Disabled methods
 BCP_lp_branching_object (const BCP_lp_branching_object &)
 The copy constructor is declared but not defined to disable it. More...
 
BCP_lp_branching_objectoperator= (const BCP_lp_branching_object &)
 The assignment operator is declared but not defined to disable it. More...
 

Detailed Description

This class describes a generic branching object.

The object may contain variables and cuts to be added to the formulation and it contains the bound changes for each child.

Note that it is unlikely that the user would need any of the member functions. She should simply call its constructor to create the object. The rest is internal to BCP.

Definition at line 70 of file BCP_lp_branch.hpp.

Constructor & Destructor Documentation

BCP_lp_branching_object::BCP_lp_branching_object ( const BCP_lp_branching_object )
private

The copy constructor is declared but not defined to disable it.

BCP_lp_branching_object::BCP_lp_branching_object ( const int  children,
BCP_vec< BCP_var * > *const  new_vars,
BCP_vec< BCP_cut * > *const  new_cuts,
const BCP_vec< int > *const  fvp,
const BCP_vec< int > *const  fcp,
const BCP_vec< double > *const  fvb,
const BCP_vec< double > *const  fcb,
const BCP_vec< int > *const  ivp,
const BCP_vec< int > *const  icp,
const BCP_vec< double > *const  ivb,
const BCP_vec< double > *const  icb 
)
inlineexplicit

The constructor makes a copy of each vector passed to it.

If a 0 pointer is passed for one of the arguments that means that the vector is empty. new_{vars,cuts} contains the variables/cuts to be added and [fi][vc][pb] contains the forced/implied variable/cut positions/bounds.

Definition at line 153 of file BCP_lp_branch.hpp.

References BCP_vec< T >::clear(), cuts_to_add, forced_cut_bd, forced_cut_pos, forced_var_bd, forced_var_pos, implied_cut_bd, implied_cut_pos, implied_var_bd, implied_var_pos, BCP_vec< T >::size(), and vars_to_add.

BCP_lp_branching_object::BCP_lp_branching_object ( const BCP_lp_integer_branching_object o,
const int *  order 
)

The constructor makes a copy of each vector passed to it.

If a 0 pointer is passed for one of the arguments that means that the vector is empty. new_{vars,cuts} contains the variables/cuts to be added and [fi][vc][pb] contains the forced/implied variable/cut positions/bounds.

BCP_lp_branching_object::BCP_lp_branching_object ( const OsiSolverInterface osi,
const BCP_lp_sos_branching_object o,
const int *  order 
)

The constructor makes a copy of each vector passed to it.

If a 0 pointer is passed for one of the arguments that means that the vector is empty. new_{vars,cuts} contains the variables/cuts to be added and [fi][vc][pb] contains the forced/implied variable/cut positions/bounds.

BCP_lp_branching_object::~BCP_lp_branching_object ( )
inline

Member Function Documentation

BCP_lp_branching_object& BCP_lp_branching_object::operator= ( const BCP_lp_branching_object )
private

The assignment operator is declared but not defined to disable it.

void BCP_lp_branching_object::set_presolve_result ( const BCP_vec< double > &  objval,
const BCP_vec< int > &  termcode 
)
inline

The constructor makes a copy of each vector passed to it.

If a 0 pointer is passed for one of the arguments that means that the vector is empty. new_{vars,cuts} contains the variables/cuts to be added and [fi][vc][pb] contains the forced/implied variable/cut positions/bounds.

Definition at line 206 of file BCP_lp_branch.hpp.

References objval_, and termcode_.

int BCP_lp_branching_object::vars_affected ( ) const
inline

Return the number of variables whose bounds are affected by the branching.

(Including both forced and implied changes.)

Definition at line 232 of file BCP_lp_branch.hpp.

References child_num, forced_var_bd, implied_var_bd, and BCP_vec< T >::size().

int BCP_lp_branching_object::cuts_affected ( ) const
inline

Return the number of cuts whose bounds are affected by the branching.

(Including both forced and implied changes.)

Definition at line 239 of file BCP_lp_branch.hpp.

References child_num, forced_cut_bd, implied_cut_bd, and BCP_vec< T >::size().

int BCP_lp_branching_object::vars_added ( ) const
inline

Return the number of variables added in the branching.

Definition at line 245 of file BCP_lp_branch.hpp.

References BCP_vec< T >::size(), and vars_to_add.

int BCP_lp_branching_object::cuts_added ( ) const
inline

Return the number of cuts added in the branching.

Definition at line 249 of file BCP_lp_branch.hpp.

References cuts_to_add, and BCP_vec< T >::size().

BCP_vec<double>::const_iterator BCP_lp_branching_object::forced_var_bd_child ( const int  index) const
inline

Return a const iterator to the position in the forced variable bound changes where the new bounds for the index-th child start.

This method should be invoked only if the appropriate data member is non-0.

Definition at line 257 of file BCP_lp_branch.hpp.

References BCP_vec< T >::entry(), forced_var_bd, forced_var_pos, and BCP_vec< T >::size().

BCP_vec<double>::const_iterator BCP_lp_branching_object::forced_cut_bd_child ( const int  index) const
inline

Return a const iterator to the position in the forced cut bound changes where the new bounds for the index-th child start.

This method should be invoked only if the appropriate data member is non-0.

Definition at line 265 of file BCP_lp_branch.hpp.

References BCP_vec< T >::entry(), forced_cut_bd, forced_cut_pos, and BCP_vec< T >::size().

BCP_vec<double>::const_iterator BCP_lp_branching_object::implied_var_bd_child ( const int  index) const
inline

Return a const iterator to the position in the implied variable bound changes where the new bounds for the index-th child start.

This method should be invoked only if the appropriate data member is non-0.

Definition at line 273 of file BCP_lp_branch.hpp.

References BCP_vec< T >::entry(), implied_var_bd, implied_var_pos, and BCP_vec< T >::size().

BCP_vec<double>::const_iterator BCP_lp_branching_object::implied_cut_bd_child ( const int  index) const
inline

Return a const iterator to the position in the implied cut bound changes where the new bounds for the index-th child start.

This method should be invoked only if the appropriate data member is non-0.

Definition at line 281 of file BCP_lp_branch.hpp.

References BCP_vec< T >::entry(), implied_cut_bd, implied_cut_pos, and BCP_vec< T >::size().

void BCP_lp_branching_object::init_pos_for_added ( const int  added_vars_start,
const int  added_cuts_start 
)

This method "cleans up" the positions and bounds.

First it re-indexes the negative positions starting from added_vars_start for the variables (and from added_cuts_start for the cuts). Then it reorders the positions (and follows that ordering with the bounds) so that the positions will be in increasing order.

void BCP_lp_branching_object::apply_child_bd ( OsiSolverInterface lp,
const int  child_ind 
) const

This method invokes the appropriate methods of lp to apply the forced and implied bound changes of the child_ind-th child.

void BCP_lp_branching_object::print_branching_info ( const int  orig_varnum,
const double *  x,
const double *  obj 
) const

This method prints out some information about the branching object.

(The positions, new bounds, the primal value of the variables.)

Member Data Documentation

int BCP_lp_branching_object::child_num
BCP_vec<BCP_var*>* BCP_lp_branching_object::vars_to_add

Variables to be added to the formulation.

Definition at line 86 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), vars_added(), and ~BCP_lp_branching_object().

BCP_vec<BCP_cut*>* BCP_lp_branching_object::cuts_to_add

Cuts to be added to the formulation.

Definition at line 88 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), cuts_added(), and ~BCP_lp_branching_object().

BCP_vec<int>* BCP_lp_branching_object::forced_var_pos

Positions of variables whose bounds change ("forcibly", by branching) in the children.

If a position is non-negative, it refers to a variable in the current LP formulation. If a position is negative (-i), it refers to an added variable (i-1st).

Definition at line 97 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), forced_var_bd_child(), and ~BCP_lp_branching_object().

BCP_vec<int>* BCP_lp_branching_object::forced_cut_pos

Positions of cuts whose bounds change ("forcibly", by branching) in the children.

If a position is non-negative, it refers to a cut in the current LP formulation. If a position is negative (-i), it refers to an added cut (i-1st).

Definition at line 102 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), forced_cut_bd_child(), and ~BCP_lp_branching_object().

BCP_vec<double>* BCP_lp_branching_object::forced_var_bd

Contains the actual bounds for the variables indexed by forced_var_pos.

List the lower/upper bound pairs for each of the variables, for each child in turn. The length of this vector is thus child_num * 2 * forced_var_pos.size().

Definition at line 107 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), forced_var_bd_child(), vars_affected(), and ~BCP_lp_branching_object().

BCP_vec<double>* BCP_lp_branching_object::forced_cut_bd

Contains the actual bounds for the cuts indexed by forced_cut_pos.

List the lower/upper bound pairs for each of the cuts, for each child in turn. The length of this vector is thus child_num * 2 * forced_cut_pos.size().

Definition at line 112 of file BCP_lp_branch.hpp.

Referenced by BCP_lp_branching_object(), cuts_affected(), forced_cut_bd_child(), and ~BCP_lp_branching_object().

BCP_vec<int>* BCP_lp_branching_object::implied_var_pos
BCP_vec<int>* BCP_lp_branching_object::implied_cut_pos
BCP_vec<double>* BCP_lp_branching_object::implied_var_bd
BCP_vec<double>* BCP_lp_branching_object::implied_cut_bd
BCP_vec<double>* BCP_lp_branching_object::objval_

Definition at line 139 of file BCP_lp_branch.hpp.

Referenced by set_presolve_result(), and ~BCP_lp_branching_object().

BCP_vec<int>* BCP_lp_branching_object::termcode_

Definition at line 140 of file BCP_lp_branch.hpp.

Referenced by set_presolve_result(), and ~BCP_lp_branching_object().


The documentation for this class was generated from the following file: