7 #include "CoinSort.hpp"
13 #include "OsiSolverInterface.hpp"
14 #include "OsiBranchingObject.hpp"
28 pos[i] = (start - 1) - pos[i];
38 const int size = positions.
size();
44 for (
int i = 0; i < size; ++i)
53 for (
int i = 0; i < child_num; ++i){
56 for ( ; pos != lastpos; ++
pos) {
57 const int bd_pos = *pos << 1;
59 new_bd.unchecked_push_back(*(old_bd + (bd_pos+1)));
71 vars_to_add(0), cuts_to_add(0),
72 forced_var_pos(new
BCP_vec<
int>(1,-1)), forced_cut_pos(0),
73 forced_var_bd(new
BCP_vec<double>(4,0.0)), forced_cut_bd(0),
74 implied_var_pos(0), implied_cut_pos(0),
75 implied_var_bd(0), implied_cut_bd(0),
76 objval_(0), termcode_(0)
80 fvp[0] = o.originalObject()->columnNumber();
81 memcpy(&fvb[0], o.
childBounds(order[0]), 2*
sizeof(double));
82 memcpy(&fvb[2], o.
childBounds(order[1]), 2*
sizeof(double));
92 vars_to_add(0), cuts_to_add(0),
93 forced_var_pos(0), forced_cut_pos(0),
94 forced_var_bd(0), forced_cut_bd(0),
95 implied_var_pos(0), implied_cut_pos(0),
96 implied_var_bd(0), implied_cut_bd(0),
97 objval_(0), termcode_(0)
99 const OsiSOS* sos =
dynamic_cast<const OsiSOS*
>(o.originalObject());
100 const int * which = sos->members();
101 const double * weights = sos->weights();
102 const double value = o.value();
105 const double* clb = osi->getColLower();
106 const double* cub = osi->getColUpper();
108 const int len = sos->numberMembers();
112 double* downchildBounds = NULL;
113 double* upchildBounds = NULL;
114 if ( order[0] == 0) {
115 downchildBounds = &fvb[0];
116 upchildBounds = &fvb[2*len];
118 downchildBounds = &fvb[2*len];
119 upchildBounds = &fvb[0];
121 for (i = 0; i < len; ++i) {
122 const int pos = which[i];
123 downchildBounds[2*i] = upchildBounds[2*i] = clb[
pos];
124 downchildBounds[2*i+1] = upchildBounds[2*i+1] = cub[
pos];
127 for (i = 0; i < len; ++i) {
128 if (weights[i] > value)
132 for ( ; i < len; ++i) {
133 downchildBounds[2*i+1] = 0.0;
136 for (i = 0 ; i < len; ++i) {
137 if (weights[i] >= value)
140 upchildBounds[2*i+1] = 0.0;
149 const int added_cuts_start)
179 const int child_ind)
const
208 const double * obj)
const
212 const int ind = (*forced_var_pos)[0];
213 if (ind < orig_varnum) {
214 printf(
"%i,%.4f,%.4f", ind, x[ind], obj[ind]);
217 printf(
";%i,-,-", ind);
220 for (
int i = 1; i < size; ++i) {
221 const int ind = (*forced_var_pos)[i];
222 if (ind < orig_varnum) {
223 printf(
";%i,%.4f,%.4f", ind, x[ind], obj[ind]);
226 printf(
";%i,-,-", ind);
234 for (
int i = 1; i < size; ++i)
245 const int tc =
_lpres[i]->termcode();
253 _lpres[i]->fake_objective_value(itlim_objval);
261 const double itlim_objval)
264 const int tc = termcode[i];
272 _lpres[i]->fake_objective_value(itlim_objval);
275 _lpres[i]->fake_objective_value(obj[i]);
284 const int tc =
_lpres[i]->termcode();
BCP_vec< double > * implied_var_bd
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 th...
BCP_vec< int > * implied_var_pos
static void BCP_reset_pos(BCP_vec< int > &pos, const int start)
pos
position where the operator should be printed when printing the expression
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.
void set_objective_values(const BCP_vec< double > &obj, const BCP_vec< int > &termcode, const double itlim_objval)
Set the appropriate fields of all _lpres to the given termcode and objval if the termcode is "normal"...
BCP_vec< BCP_lp_result * > _lpres
A vector of lp results holding the actual presolved data.
This class exist only so that we can extract information from OsiIntegerBranchingObject.
const double * childBounds(int i) const
iterator begin()
Return an iterator to the beginning of the object.
bool had_numerical_problems() const
Return true if at least one child had numerical difficulties while presolving.
BCP_vec< double > * forced_var_bd
Contains the actual bounds for the variables indexed by forced_var_pos.
void reserve(const size_t n)
Reallocate the object to make space for n entries.
bool fathomable(const double objval_limit) const
Return true if every children can be fathomed.
BCP_vec< int > * implied_cut_pos
BCP_lp_branching_object(const BCP_lp_branching_object &)
The copy constructor is declared but not defined to disable it.
BCP_vec< int > * forced_cut_pos
Positions of cuts whose bounds change ("forcibly", by branching) in the children. ...
void fint fint fint real fint real real real real real real real real real fint real fint * lp
int child_num
The number of children for this branching object.
BCP_vec< double > * forced_cut_bd
Contains the actual bounds for the cuts indexed by forced_cut_pos.
BCP_vec< BCP_var * > * vars_to_add
Variables to be added to the formulation.
BCP_vec< double > * implied_cut_bd
BCP_vec< int > * forced_var_pos
Positions of variables whose bounds change ("forcibly", by branching) in the children.
size_t size() const
Return the current number of entries.
iterator end()
Return an iterator to the end of the object.
BCP_vec< BCP_cut * > * cuts_to_add
Cuts to be added to the formulation.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
This class exist only so that we can extract information from OsiIntegerBranchingObject.
iterator entry(const int i)
Return an iterator to the i-th entry.
BCP_lp_branching_object * _candidate
A pointer to the branching object (created internally or by the user) whose presolved data is stored ...
void fake_objective_values(const double itlim_objval)
Examine the termination codes for the children and for those that do not have a valid lower bound fak...
void init_pos_for_added(const int added_vars_start, const int added_cuts_start)
This method "cleans up" the positions and bounds.
static void BCP_reorder_pos(const int child_num, BCP_vec< int > &positions, BCP_vec< double > &bounds)
void fint fint fint real fint real * x