Bcp  1.4.4
BCP_branch.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_BRANCH_H
4 #define _BCP_BRANCH_H
5 
6 // This file is fully docified.
7 
8 #include "BCP_vector.hpp"
9 
10 class OsiSolverInterface;
11 class BCP_buffer;
13 
14 //#############################################################################
15 
32 private:
38  BCP_internal_brobj& operator=(const BCP_internal_brobj&);
41 private:
45  int _child_num;
49  BCP_vec<int> _var_positions;
51  BCP_vec<int> _cut_positions;
56  BCP_vec<double> _var_bounds; // 2*_child_num*_var_positions.size()
58  BCP_vec<double> _cut_bounds;
61 public:
66  BCP_internal_brobj() : _child_num(0),
67  _var_positions(), _cut_positions(), _var_bounds(), _cut_bounds() {}
79  inline int child_num() const { return _child_num; }
81  inline int affected_varnum() const { return _var_positions.size(); }
83  inline int affected_cutnum() const { return _cut_positions.size(); }
84 
87  inline const BCP_vec<int>& var_positions() const { return _var_positions; }
90  inline const BCP_vec<int>& cut_positions() const { return _cut_positions; }
91 
95  inline
97  return _var_bounds.entry(2 * _var_positions.size() * index);
98  }
102  inline
104  return _cut_bounds.entry(2 * _cut_positions.size() * index);
105  }
112  void apply_child_bounds(OsiSolverInterface* lp, int child_ind) const;
118  void pack(BCP_buffer& buf) const;
120  void unpack(BCP_buffer& buf);
122 };
123 
124 #endif
125 
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
This class is the internal representation of a branching object.
Definition: BCP_branch.hpp:31
int affected_varnum() const
Return the number of affected variables.
Definition: BCP_branch.hpp:81
void pack(BCP_buffer &buf) const
Pack the internal branching object into the buffer.
BCP_internal_brobj()
The default constructor creates an empty internal branching object (which can be filled later by unpa...
Definition: BCP_branch.hpp:66
const BCP_vec< int > & cut_positions() const
Return a const reference to the vector of positions of cuts affected by the branching.
Definition: BCP_branch.hpp:90
void apply_child_bounds(OsiSolverInterface *lp, int child_ind) const
Modify the bounds in the LP solver by applying the changes specified for the child_ind-th child.
const BCP_vec< int > & var_positions() const
Return a const reference to the vector of positions of variables affected by the branching.
Definition: BCP_branch.hpp:87
~BCP_internal_brobj()
The desctructor deletes all data members.
Definition: BCP_branch.hpp:73
int child_num() const
Return the number of children.
Definition: BCP_branch.hpp:79
BCP_vec< double >::const_iterator cut_bounds_child(const int index) const
Return a const iterator within _cut_bounds to the location where the bound pairs for the index-th chi...
Definition: BCP_branch.hpp:103
void unpack(BCP_buffer &buf)
Unpack an internal branching object from the buffer.
BCP_internal_brobj(BCP_lp_branching_object &candidate)
This constructor sets the number of children and copies the contents of the positions and bounds of t...
int affected_cutnum() const
Return the number of affected cuts.
Definition: BCP_branch.hpp:83
BCP_vec< double >::const_iterator var_bounds_child(const int index) const
Return a const iterator within _var_bounds to the location where the bound pairs for the index-th chi...
Definition: BCP_branch.hpp:96
This class describes a generic branching object.
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116
iterator entry(const int i)
Return an iterator to the i-th entry.
Definition: BCP_vector.hpp:109