#include <OS_lp.hpp>
Inheritance diagram for OS_lp:
Public Member Functions | |
virtual OsiSolverInterface * | initialize_solver_interface () |
Called only once at the beginning, from the root node. | |
virtual void | initialize_new_search_tree_node (const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const BCP_vec< BCP_obj_status > &var_status, const BCP_vec< BCP_obj_status > &cut_status, BCP_vec< int > &var_changed_pos, BCP_vec< double > &var_new_bd, BCP_vec< int > &cut_changed_pos, BCP_vec< double > &cut_new_bd) |
Initialize data members at the start of processing a new subproblem. | |
virtual void | modify_lp_parameters (OsiSolverInterface *lp, bool in_strong_branching) |
Modify the parameters of the LP solver. | |
virtual void | display_lp_solution (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool final_lp_solution) |
Cut generation. | |
virtual BCP_solution * | generate_heuristic_solution (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts) |
Simple rounding heuristic. | |
virtual void | cuts_to_rows (const BCP_vec< BCP_var * > &vars, BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_row * > &rows, const BCP_lp_result &lpres, BCP_object_origin origin, bool allow_multiple) |
Describes how to get a row of the matrix from the representation of the cut. | |
virtual BCP_branching_decision | select_branching_candidates (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const BCP_lp_var_pool &local_var_pool, const BCP_lp_cut_pool &local_cut_pool, BCP_vec< BCP_lp_branching_object * > &cands, bool force_branch=false) |
Called at the end of each iteration. | |
virtual void | set_user_data_for_children (BCP_presolved_lp_brobj *best, const int selected) |
Set up the user data for the children according to the chosen branching object. | |
virtual void | vars_to_cols (const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_var * > &vars, BCP_vec< BCP_col * > &cols, const BCP_lp_result &lpres, BCP_object_origin origin, bool allow_multiple) |
Convert a set of variables into corresponding columns for the current LP relaxation. | |
virtual void | process_lp_result (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const double old_lower_bound, double &true_lower_bound, BCP_solution *&sol, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows, BCP_vec< BCP_var * > &new_vars, BCP_vec< BCP_col * > &new_cols) |
Process the result of an iteration. | |
Constructors and destructors | |
OS_lp () | |
Default constructor. | |
virtual | ~OS_lp () |
Destructor. | |
Packing and unpacking methods | |
virtual void | unpack_module_data (BCP_buffer &buf) |
Unpack data sent from the tree manager. | |
Private Attributes | |
OsiSolverInterface * | cg_lp |
OS_prob * | os_prob |
Pointer on the description of the problem. | |
MY_user_data * | p_ud |
Pointer on the description of the user data. | |
int | in_strong |
in_strong = 1 if and only if in strong branching phase | |
double | EPS |
Hold the value of EPSILON of class OS_prob. | |
BCP_vec< BCP_cut * > | algo_cuts |
Hold pointers on generated algorithmic cuts. | |
BCP_vec< BCP_var * > | algo_vars |
Hold pointers on generated variables. | |
bool | generated_vars |
bool | generated_cuts |
std::vector< int > | violated_cuts |
Hold indices of violated indexed cuts. |
Definition at line 28 of file OS_lp.hpp.
void OS_lp::unpack_module_data | ( | BCP_buffer & | buf | ) | [virtual] |
Unpack data sent from the tree manager.
we also have access to the osinstance object that was created in OS_tm the OS_tm tree manager sent us a pointer to this -- the osinstance is actually a memeber of OS_prob -- put in this class information we want access to
Reimplemented from BCP_lp_user.
Definition at line 34 of file OS_lp.cpp.
References EPS, OS_prob::EPSILON, OSInstance::getVariableNumber(), os_prob, OS_prob::osinstance, and BCP_buffer::unpack().
OsiSolverInterface * OS_lp::initialize_solver_interface | ( | ) | [virtual] |
void OS_lp::initialize_new_search_tree_node | ( | const BCP_vec< BCP_var * > & | vars, | |
const BCP_vec< BCP_cut * > & | cuts, | |||
const BCP_vec< BCP_obj_status > & | var_status, | |||
const BCP_vec< BCP_obj_status > & | cut_status, | |||
BCP_vec< int > & | var_changed_pos, | |||
BCP_vec< double > & | var_new_bd, | |||
BCP_vec< int > & | cut_changed_pos, | |||
BCP_vec< double > & | cut_new_bd | |||
) | [virtual] |
Initialize data members at the start of processing a new subproblem.
Reimplemented from BCP_lp_user.
Definition at line 63 of file OS_lp.cpp.
References BCP_lp_user::get_param(), BCP_lp_user::get_user_data(), in_strong, MY_user_data::is_processed, BCP_lp_par::LpVerb_RelaxedSolution, and BCP_lp_user::set_param().
void OS_lp::modify_lp_parameters | ( | OsiSolverInterface * | lp, | |
bool | in_strong_branching | |||
) | [virtual] |
void OS_lp::display_lp_solution | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
const bool | final_lp_solution | |||
) | [virtual] |
Cut generation.
Send to BCP the cuts generated in test_feasibility. Use this function to generate standard cuts (Knapsack covers, Lift-and-Project, odd holes, ...).
Reimplemented from BCP_lp_user.
Definition at line 594 of file OS_lp.cpp.
References BCP_lp_user::display_lp_solution(), BCP_lp_user::get_param(), BCP_lp_par::IntegerTolerance, BCP_lp_par::LpVerb_RelaxedSolution, BCP_vec< T >::size(), BCP_lp_result::x(), and x.
BCP_solution * OS_lp::generate_heuristic_solution | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts | |||
) | [virtual] |
void OS_lp::cuts_to_rows | ( | const BCP_vec< BCP_var * > & | vars, | |
BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_row * > & | rows, | |||
const BCP_lp_result & | lpres, | |||
BCP_object_origin | origin, | |||
bool | allow_multiple | |||
) | [virtual] |
Describes how to get a row of the matrix from the representation of the cut.
Required method when indexed or algorithmic cuts are used.
Reimplemented from BCP_lp_user.
Definition at line 286 of file OS_lp.cpp.
References BCP_vec< T >::push_back(), and BCP_vec< T >::size().
BCP_branching_decision OS_lp::select_branching_candidates | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
const BCP_lp_var_pool & | local_var_pool, | |||
const BCP_lp_cut_pool & | local_cut_pool, | |||
BCP_vec< BCP_lp_branching_object * > & | cands, | |||
bool | force_branch = false | |||
) | [virtual] |
Called at the end of each iteration.
Possible return values are: BCP_DoNotBranch_Fathomed : The node should be fathomed without branching; BCP_DoNotBranch : BCP should continue to work on this node; BCP_DoBranch : Branching must be done. In this case the method returns the branching object candidates in one of the arguments.
Reimplemented from BCP_lp_user.
Definition at line 154 of file OS_lp.cpp.
References BCP_lp_user::append_branching_vars(), BCP_DoBranch, BCP_DoNotBranch, BCP_lp_user::current_level(), BCP_lp_user::get_param(), BCP_lp_par::IntegerTolerance, BCP_vec< T >::push_back(), BCP_vec< T >::size(), BCP_lp_result::x(), and x.
void OS_lp::set_user_data_for_children | ( | BCP_presolved_lp_brobj * | best, | |
const int | selected | |||
) | [virtual] |
Set up the user data for the children according to the chosen branching object.
Reimplemented from BCP_lp_user.
Definition at line 245 of file OS_lp.cpp.
References BCP_presolved_lp_brobj::candidate(), real_user_data::card_set_zero, BCP_lp_branching_object::child_num, EPS, BCP_lp_branching_object::forced_var_bd, BCP_lp_branching_object::forced_var_pos, BCP_lp_user::get_user_data(), MY_user_data::p_rud, and BCP_presolved_lp_brobj::user_data().
void OS_lp::vars_to_cols | ( | const BCP_vec< BCP_cut * > & | cuts, | |
BCP_vec< BCP_var * > & | vars, | |||
BCP_vec< BCP_col * > & | cols, | |||
const BCP_lp_result & | lpres, | |||
BCP_object_origin | origin, | |||
bool | allow_multiple | |||
) | [virtual] |
Convert a set of variables into corresponding columns for the current LP relaxation.
Converting means to compute for each variable the coefficients corresponding to each cut and create BCP_col objects that can be added to the formulation.
See the documentation of cuts_to_rows() above for the use of this method (just reverse the role of cuts and variables.)
cuts | the cuts currently in the relaxation (IN) | |
vars | the variables to be converted (IN/OUT) | |
cols | the colums the variables convert into (OUT) | |
lpres | solution to the current LP relaxation (IN) | |
origin | where the do the cuts come from (IN) | |
allow_multiple | whether multiple expansion, i.e., lifting, is allowed (IN) |
Reimplemented from BCP_lp_user.
Definition at line 311 of file OS_lp.cpp.
References BCP_vec< T >::push_back(), and BCP_vec< T >::size().
void OS_lp::process_lp_result | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
const double | old_lower_bound, | |||
double & | true_lower_bound, | |||
BCP_solution *& | sol, | |||
BCP_vec< BCP_cut * > & | new_cuts, | |||
BCP_vec< BCP_row * > & | new_rows, | |||
BCP_vec< BCP_var * > & | new_vars, | |||
BCP_vec< BCP_col * > & | new_cols | |||
) | [virtual] |
Process the result of an iteration.
This includes:
The default behavior is to do nothing and invoke the individual methods one-by-one.
lp_result | the result of the most recent LP optimization (IN) | |
vars | variables currently in the formulation (IN) | |
cuts | variables currently in the formulation (IN) | |
old_lower_bound | the previously known best lower bound (IN) | |
new_cuts | the vector of generated cuts (OUT) | |
new_rows | the correspontding rows(OUT) | |
new_vars | the vector of generated variables (OUT) | |
new_cols | the correspontding columns(OUT) |
Cgl cut addition scope
Reimplemented from BCP_lp_user.
Definition at line 339 of file OS_lp.cpp.
References algo_cuts, algo_vars, BCP_vec< T >::append(), BCP_DBL_MAX, EPS, generated_cuts, generated_vars, BCP_lp_user::getLpProblemPointer(), k, BCP_lp_prob::lp_solver, BCP_lp_result::objval(), BCP_lp_result::pi(), pi, BCP_lp_user::process_lp_result(), BCP_vec< T >::push_back(), BCP_vec< T >::size(), BCP_lp_result::x(), and x.
OsiSolverInterface* OS_lp::cg_lp [private] |
OS_prob* OS_lp::os_prob [private] |
Pointer on the description of the problem.
Definition at line 35 of file OS_lp.hpp.
Referenced by unpack_module_data().
MY_user_data* OS_lp::p_ud [private] |
int OS_lp::in_strong [private] |
in_strong = 1 if and only if in strong branching phase
Definition at line 41 of file OS_lp.hpp.
Referenced by initialize_new_search_tree_node().
double OS_lp::EPS [private] |
Hold the value of EPSILON of class OS_prob.
Definition at line 44 of file OS_lp.hpp.
Referenced by process_lp_result(), set_user_data_for_children(), and unpack_module_data().
BCP_vec<BCP_cut*> OS_lp::algo_cuts [private] |
Hold pointers on generated algorithmic cuts.
Definition at line 47 of file OS_lp.hpp.
Referenced by process_lp_result().
BCP_vec<BCP_var*> OS_lp::algo_vars [private] |
Hold pointers on generated variables.
Definition at line 50 of file OS_lp.hpp.
Referenced by process_lp_result().
bool OS_lp::generated_vars [private] |
bool OS_lp::generated_cuts [private] |
std::vector<int> OS_lp::violated_cuts [private] |