BCP_branch.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #include "BCP_error.hpp"
4 #include "BCP_branch.hpp"
5 #include "BCP_buffer.hpp"
6 #include "OsiSolverInterface.hpp"
7 #include "BCP_lp_branch.hpp"
8 
10  _child_num(candidate.child_num),
11  _var_positions(), _cut_positions(), _var_bounds(), _cut_bounds()
12 {
13  if (candidate.forced_var_pos) {
14  _var_positions = *candidate.forced_var_pos;
15  _var_bounds = *candidate.forced_var_bd;
16  }
17  if (candidate.forced_cut_pos) {
18  _cut_positions = *candidate.forced_cut_pos;
19  _cut_bounds = *candidate.forced_cut_bd;
20  }
21 }
22 
23 
24 void
26  int child_ind) const
27 {
28  if (_var_positions.size() > 0) {
29  lp->setColSetBounds(_var_positions.begin(), _var_positions.end(),
30  var_bounds_child(child_ind));
31  }
32  if (_cut_positions.size() > 0) {
33  lp->setRowSetBounds(_cut_positions.begin(), _cut_positions.end(),
34  cut_bounds_child(child_ind));
35  }
36 }
37 
39  buf.pack(_child_num)
42 }
43 
45  buf.unpack(_child_num)
48 }
BCP_vec< int > _cut_positions
The positions of cuts whose bounds are affected by the branching.
Definition: BCP_branch.hpp:51
BCP_buffer & pack(const T &value)
Pack a single object of type T.
Definition: BCP_buffer.hpp:177
BCP_internal_brobj()
The default constructor creates an empty internal branching object (which can be filled later by unpa...
Definition: BCP_branch.hpp:66
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
Definition: BCP_buffer.hpp:186
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
iterator begin()
Return an iterator to the beginning of the object.
Definition: BCP_vector.hpp:99
BCP_vec< double > * forced_var_bd
Contains the actual bounds for the variables indexed by forced_var_pos.
BCP_vec< double > _cut_bounds
Lower/upper bound pairs for the cuts affected by the branching.
Definition: BCP_branch.hpp:58
void unpack(BCP_buffer &buf)
Unpack an internal branching object from the buffer.
Definition: BCP_branch.cpp:44
BCP_vec< int > * forced_cut_pos
Positions of cuts whose bounds change (&quot;forcibly&quot;, by branching) in the children. ...
BCP_vec< double > _var_bounds
Lower/upper bound pairs for the variables affected by the branching.
Definition: BCP_branch.hpp:56
void fint fint fint real fint real real real real real real real real real fint real fint * lp
This class describes a generic branching object.
BCP_vec< double > * forced_cut_bd
Contains the actual bounds for the cuts indexed by forced_cut_pos.
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
BCP_vec< int > _var_positions
The positions of variables whose bounds are affected by the branching.
Definition: BCP_branch.hpp:49
BCP_vec< int > * forced_var_pos
Positions of variables whose bounds change (&quot;forcibly&quot;, by branching) in the children.
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116
iterator end()
Return an iterator to the end of the object.
Definition: BCP_vector.hpp:104
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
void pack(BCP_buffer &buf) const
Pack the internal branching object into the buffer.
Definition: BCP_branch.cpp:38
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...
Definition: BCP_branch.cpp:25
int _child_num
The number of children in the branching object.
Definition: BCP_branch.hpp:45