Class for operations at the node level. More...
#include <OS_lp.hpp>
Public Member Functions | |
virtual OsiSolverInterface * | initialize_solver_interface () |
Pack algorithmic cuts. | |
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) |
Test feasibility of the LP solution. | |
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. |
Class for operations at the node level.
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.
OsiSolverInterface * OS_lp::initialize_solver_interface | ( | ) | [virtual] |
Pack algorithmic cuts.
Unpack algorithmic cuts Pack user data Unpack user data Called only once at the beginning, from the root node
Reimplemented from BCP_lp_user.
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.
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] |
Test feasibility of the LP solution.
Called after each node LP has been solved. Called even if the node LP was infeasible Called also during strong branching 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.
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] |
Simple rounding heuristic.
Reimplemented from BCP_lp_user.
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.
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.
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.
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) |
Default: throw an exception (if this method is invoked then the user must have generated variables and BCP has no way to know how to convert them).
Reimplemented from BCP_lp_user.
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 reason for the existence of this method is that (especially when column generation is done) these tasks are so intertwined that it is much easier to execute them in one method instead of in several separate methods.
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.
OsiSolverInterface* OS_lp::cg_lp [private] |
OS_prob* OS_lp::os_prob [private] |
MY_user_data* OS_lp::p_ud [private] |
int OS_lp::in_strong [private] |
double OS_lp::EPS [private] |
BCP_vec<BCP_cut*> OS_lp::algo_cuts [private] |
BCP_vec<BCP_var*> OS_lp::algo_vars [private] |
bool OS_lp::generated_vars [private] |
bool OS_lp::generated_cuts [private] |
std::vector<int> OS_lp::violated_cuts [private] |