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);
305 const double*
x,
const double * obj)
const;
365 for (
int i = candidate->
child_num; i; --i) {
398 return *(
_lpres[child_ind]);
424 bool fathomable(
const double objval_limit)
const;
434 _lpres[i]->fake_objective_value(val);
454 for (
int i = 0; i < num_children; ++i)
461 for (
int i = 0; i < num_children; ++i)
462 _lpres[i]->fake_objective_value(obj[i]);
468 _lpres[child_ind]->get_results(lp);
487 const double itlim_objval);
bool is_pruned() const
Fill up obj with the lower bound on each child.
BCP_vec< double > * implied_var_bd
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_presolved_lp_brobj()
The destructor simply deletes every member (deletes every lpres in the vector).
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
~BCP_lp_sos_branching_object()
BCP_presolved_lp_brobj & operator=(const BCP_presolved_lp_brobj &)
The assignment operator is declared but not defined to disable it.
BCP_lp_integer_branching_object(const OsiIntegerBranchingObject *o)
~BCP_lp_integer_branching_object()
BCP_vec< BCP_vec< BCP_cut * > > _new_cuts
A pointer to the branching object (created internally or by the user) whose presolved data is stored ...
void clear()
Delete every entry.
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.
BCP_vec< double > * objval_
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_lp_branching_object & operator=(const BCP_lp_branching_object &)
The assignment operator is declared but not defined to disable it.
int vars_affected() const
Return the number of variables whose bounds are affected by the branching.
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< 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.
BCP_vec< BCP_vec< BCP_row * > > _new_rows
A pointer to the branching object (created internally or by the user) whose presolved data is stored ...
const double * childBounds(int i) const
BCP_vec< BCP_vec< BCP_row * > > & get_new_rows()
Fill up obj with the lower bound on each child.
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.
int cuts_added() const
Return the number of cuts added in the branching.
void push_back(const_reference x)
Append x to the end of the vector.
BCP_vec< int > * implied_cut_pos
void get_lower_bounds(BCP_vec< double > &obj)
Fill up obj with the lower bound on each child.
BCP_lp_branching_object(const BCP_lp_branching_object &)
The copy constructor is declared but not defined to disable it.
BCP_vec< BCP_user_data * > & user_data()
Return a reference to the user data vector.
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
void keep_no_child()
Fill up obj with the lower bound on each child.
BCP_vec< BCP_user_data * > _user_data
The user data to be passed around with the child nodes.
void get_results(OsiSolverInterface &lp, const int child_ind)
Extract the lp results from the LP solver for the child_ind-th child.
int child_num
The number of children for this branching object.
const BCP_vec< BCP_child_action > & action() const
Return a const reference to the actions to be taken.
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.
int cuts_affected() const
Return the number of cuts whose bounds are affected by the branching.
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_lp_branching_object()
The destructor deletes each vector.
BCP_vec< BCP_var * > * vars_to_add
Variables to be added to the formulation.
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.
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...
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< 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...
This child should be returned to the Tree Manager for later processing.
BCP_vec< double > * implied_cut_bd
BCP_vec< int > * forced_var_pos
Positions of variables whose bounds change ("forcibly", by branching) in the children.
Currently there isn't any error handling in BCP.
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 ...
A presolved branching object candidate.
size_t size() const
Return the current number of entries.
void set_lower_bounds(const BCP_vec< double > &obj)
Fill up the lower bounds on the children with the content of obj.
void swap(BCP_presolved_lp_brobj &rhs)
swap the two presolved branching object
BCP_vec< BCP_cut * > * cuts_to_add
Cuts to be added to the formulation.
BCP_vec< BCP_vec< BCP_cut * > > & get_new_cuts()
Fill up obj with the lower bound on each child.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
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< BCP_child_action > & action()
Return a reference to the actions to be taken.
This class exist only so that we can extract information from OsiIntegerBranchingObject.
BCP_vec< int > * termcode_
BCP_vec< BCP_child_action > _child_action
The action to be taken for each child (send back to the TM, keep for diving, prune it)...
This class holds the results after solving an LP relaxation.
iterator entry(const int i)
Return an iterator to the i-th entry.
const BCP_lp_branching_object * candidate() const
Return a const pointer to the candidate.
const BCP_vec< BCP_user_data * > & user_data() const
Return a const reference to the user data vector.
BCP_lp_branching_object * _candidate
A pointer to the branching object (created internally or by the user) whose presolved data is stored ...
BCP_presolved_lp_brobj(const BCP_presolved_lp_brobj &)
The copy constructor is declared but not defined to disable it.
BCP_lp_branching_object * candidate()
Return a pointer to the candidate.
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...
BCP_lp_sos_branching_object(const OsiSOSBranchingObject *o)
void initialize_lower_bound(const double val)
Fill up obj with the lower bound on each child.
void init_pos_for_added(const int added_vars_start, const int added_cuts_start)
This method "cleans up" the positions and bounds.
void swap(BCP_vec< T > &x)
Exchange the contents of the object with that of x.
void fint fint fint real fint real * x
int vars_added() const
Return the number of variables added in the branching.
This child should be fathomed.