3 #ifndef _BCP_LP_BRANCH_H 4 #define _BCP_LP_BRANCH_H 17 #include "OsiBranchingObject.hpp" 19 class OsiSolverInterface;
29 OsiIntegerBranchingObject(*o) {}
31 inline const double*
childBounds(
int i)
const {
return i==0 ? down_:up_; }
42 OsiSOSBranchingObject(*o) {}
172 if ( ((fvp == 0) ^ (fvb == 0)) || ((fcp == 0) ^ (fcb == 0)) ||
173 ((ivp == 0) ^ (ivb == 0)) || ((icp == 0) ^ (icb == 0)) )
175 if ( (fvp && (2 * children* fvp->
size() != fvb->
size())) ||
176 (fcp && (2 * children* fcp->
size() != fcb->
size())) ||
177 (ivp && (2 * children* ivp->
size() != ivb->
size())) ||
178 (icp && (2 * children* icp->
size() != icb->
size())) )
297 const int added_cuts_start);
301 void apply_child_bd(OsiSolverInterface* lp,
const int child_ind)
const;
305 const double* x,
const double * obj)
const;
376 for (
int i = _new_cuts.
size() - 1; i >= 0; --i) {
398 return *(_lpres[child_ind]);
404 return _child_action;
408 return _child_action;
424 bool fathomable(
const double objval_limit)
const;
433 for (
int i = _candidate->
child_num - 1; i >= 0; --i) {
434 _lpres[i]->fake_objective_value(val);
438 for (
int i = _child_action.
size() - 1; i >= 0; --i) {
443 for (
int i = _child_action.
size() - 1; i >= 0; --i) {
453 const int num_children = _lpres.
size();
454 for (
int i = 0; i < num_children; ++i)
460 const int num_children = _lpres.
size();
461 for (
int i = 0; i < num_children; ++i)
462 _lpres[i]->fake_objective_value(obj[i]);
467 inline void get_results(OsiSolverInterface& lp,
const int child_ind) {
468 _lpres[child_ind]->get_results(lp);
487 const double itlim_objval);
491 std::swap(_candidate, rhs._candidate);
492 _lpres.
swap(rhs._lpres);
493 _child_action.
swap(rhs._child_action);
494 _user_data.
swap(rhs._user_data);
495 _new_cuts.
swap(rhs._new_cuts);
496 _new_rows.
swap(rhs._new_rows);
~BCP_lp_branching_object()
The destructor deletes each vector.
BCP_vec< double > * forced_cut_bd
Contains the actual bounds for the cuts indexed by forced_cut_pos.
BCP_lp_integer_branching_object(const OsiIntegerBranchingObject *o)
const BCP_vec< BCP_user_data * > & user_data() const
Return a const reference to the user data vector.
int vars_added() const
Return the number of variables added in the branching.
iterator entry(const int i)
Return an iterator to the i-th entry.
BCP_vec< int > * implied_var_pos
void get_results(OsiSolverInterface &lp, const int child_ind)
Extract the lp results from the LP solver for the child_ind-th child.
BCP_vec< double > * forced_var_bd
Contains the actual bounds for the variables indexed by forced_var_pos.
~BCP_presolved_lp_brobj()
The destructor simply deletes every member (deletes every lpres in the vector).
This child should be returned to the Tree Manager for later processing.
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.
Currently there isn't any error handling in BCP.
const BCP_lp_result & lpres(const int child_ind) const
Return a const reference to the presolved results of the child_ind-th child.
BCP_vec< BCP_child_action > & action()
Return a reference to the actions to be taken.
void clear()
Delete every entry.
void push_back(const_reference x)
Append x to the end of the vector.
BCP_lp_sos_branching_object(const OsiSOSBranchingObject *o)
const BCP_vec< BCP_child_action > & action() const
Return a const reference to the actions to be taken.
~BCP_lp_sos_branching_object()
BCP_vec< BCP_var * > * vars_to_add
Variables to be added to the formulation.
BCP_presolved_lp_brobj(BCP_lp_branching_object *candidate)
The only one way to construct a presolved branching object is to create it from a regular branching o...
bool fathomable(const double objval_limit) const
Return true if every children can be fathomed.
void swap(BCP_vec< T > &x)
Exchange the contents of the object with that of x.
This class holds the results after solving an LP relaxation.
const BCP_lp_branching_object * candidate() const
Return a const pointer to the candidate.
int cuts_added() const
Return the number of cuts added in the branching.
A presolved branching object candidate.
This child should be fathomed.
BCP_vec< BCP_user_data * > & user_data()
Return a reference to the user data vector.
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.
int child_num
The number of children for this branching object.
BCP_vec< int > * termcode_
void swap(BCP_presolved_lp_brobj &rhs)
swap the two presolved branching object
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
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 fo...
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"...
void reserve(const size_t n)
Reallocate the object to make space for n entries.
BCP_vec< int > * forced_cut_pos
Positions of cuts whose bounds change ("forcibly", by branching) in the children. ...
BCP_vec< int > * forced_var_pos
Positions of variables whose bounds change ("forcibly", by branching) in the children.
BCP_vec< BCP_cut * > * cuts_to_add
Cuts to be added to the formulation.
BCP_vec< double > * implied_var_bd
BCP_vec< int > * implied_cut_pos
BCP_vec< double > * implied_cut_bd
void initialize_lower_bound(const double val)
void set_presolve_result(const BCP_vec< double > &objval, const BCP_vec< int > &termcode)
bool had_numerical_problems() const
Return true if at least one child had numerical difficulties while presolving.
size_t size() const
Return the current number of entries.
~BCP_lp_integer_branching_object()
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...
BCP_vec< BCP_vec< BCP_row * > > & get_new_rows()
This class exist only so that we can extract information from OsiIntegerBranchingObject.
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...
The class BCP_vec serves the same purpose as the vector class in the standard template library...
int cuts_affected() const
Return the number of cuts whose bounds are affected by the branching.
const double * childBounds(int i) const
void purge_ptr_vector(BCP_vec< T *> &pvec, typename BCP_vec< T *>::iterator first, typename BCP_vec< T *>::iterator last)
This function purges the entries [first,last) from the vector of pointers pvec.
BCP_vec< double > * objval_
void get_lower_bounds(BCP_vec< double > &obj)
Fill up obj with the lower bound on each child.
int vars_affected() const
Return the number of variables whose bounds are affected by the branching.
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...
This class exist only so that we can extract information from OsiIntegerBranchingObject.
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...
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 ...
BCP_vec< BCP_vec< BCP_cut * > > & get_new_cuts()
BCP_lp_branching_object * candidate()
Return a pointer to the candidate.
void set_lower_bounds(const BCP_vec< double > &obj)
Fill up the lower bounds on the children with the content of obj.
This class describes a generic branching object.
void init_pos_for_added(const int added_vars_start, const int added_cuts_start)
This method "cleans up" the positions and bounds.