#include <CSP_lp.hpp>
Inheritance diagram for CSP_lp:
Public Member Functions | |
CSP_lp () | |
~CSP_lp () | |
virtual void | unpack_module_data (BCP_buffer &buf) |
Unpack the initial information sent to the LP process by the Tree Manager. | |
virtual OsiSolverInterface * | initialize_solver_interface () |
Create LP solver environment. | |
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) |
Initializing a new search tree node. | |
virtual void | modify_lp_parameters (OsiSolverInterface *lp, const int changeType, bool in_strong_branching) |
This method provides an opportunity for the user to change parameters of the LP solver before optimization in the LP solver starts. | |
virtual double | compute_lower_bound (const double old_lower_bound, const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts) |
Compute a true lower bound for the subproblem. | |
virtual BCP_solution * | generate_heuristic_solution (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts) |
Try to generate a heuristic solution (or return one generated during cut/variable generation. | |
virtual void | restore_feasibility (const BCP_lp_result &lpres, const std::vector< double * > dual_rays, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_var * > &vars_to_add, BCP_vec< BCP_col * > &cols_to_add) |
Restoring feasibility. | |
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. | |
void | vars_to_cols (BCP_vec< BCP_var * > &vars, BCP_vec< BCP_col * > &cols) |
virtual void | generate_vars_in_lp (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool before_fathom, BCP_vec< BCP_var * > &new_vars, BCP_vec< BCP_col * > &new_cols) |
Generate variables within the LP process. | |
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) |
Decide whether to branch or not and select a set of branching candidates if branching is decided upon. | |
BCP_lp_branching_object * | branch_on_half (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars) |
virtual void | set_actions_for_children (BCP_presolved_lp_brobj *best) |
Decide what to do with the children of the selected branching object. | |
Public Attributes | |
BCP_parameter_set< CSP_lp_par > | par |
CSPROBLEM * | csproblem |
CSP_colgen * | colgen |
Private Attributes | |
std::vector< PATTERN * > | improving_patterns_ |
Definition at line 19 of file CSP_lp.hpp.
CSP_lp::CSP_lp | ( | ) | [inline] |
Definition at line 40 of file CSP_lp.hpp.
CSP_lp::~CSP_lp | ( | ) | [inline] |
virtual void CSP_lp::unpack_module_data | ( | BCP_buffer & | buf | ) | [virtual] |
Unpack the initial information sent to the LP process by the Tree Manager.
This information was packed by the method BCP_tm_user::pack_module_data() invoked with BCP_ProcessType_LP
as the third (target process type) argument.
Reimplemented from BCP_lp_user.
virtual OsiSolverInterface* CSP_lp::initialize_solver_interface | ( | ) | [virtual] |
Create LP solver environment.
Create the LP solver class that will be used for solving the LP relaxations. The default implementation picks up which COIN_USE_XXX
is defined and initializes an lp solver of that type. This is probably OK for most users. The only reason to override this method is to be able to choose at runtime which lp solver to instantiate (maybe even different solvers on different processors). In this case she should probably also override the pack_warmstart() and unpack_warmstart() methods in this class and in the BCP_tm_user class.
Reimplemented from BCP_lp_user.
virtual void CSP_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] |
Initializing a new search tree node.
This method serves as hook for the user to do some preprocessing on a search tree node before the node is processed. Also, logical fixing results can be returned in the last four parameters. This might be very useful if the branching implies significant tightening.
Default: empty method.
vars | (IN) The variables in the current formulation | |
cuts | (IN) The cuts in the current formulation | |
var_status | (IN) The stati of the variables | |
cut_status | (IN) The stati of the cuts | |
var_changed_pos | (OUT) The positions of the variables whose bounds should be tightened | |
var_new_bd | (OUT) The new lb/ub of those variables | |
cut_changed_pos | (OUT) The positions of the cuts whose bounds should be tightened | |
cut_new_bd | (OUT) The new lb/ub of those cuts |
Reimplemented from BCP_lp_user.
virtual void CSP_lp::modify_lp_parameters | ( | OsiSolverInterface * | lp, | |
const int | changeType, | |||
bool | in_strong_branching | |||
) | [virtual] |
This method provides an opportunity for the user to change parameters of the LP solver before optimization in the LP solver starts.
The second argument indicates whether the optimization is a "regular" optimization or it will take place in strong branching. Default: empty method.
Reimplemented from BCP_lp_user.
virtual double CSP_lp::compute_lower_bound | ( | const double | old_lower_bound, | |
const BCP_lp_result & | lpres, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts | |||
) | [virtual] |
Compute a true lower bound for the subproblem.
In case column generation is done the lower bound for the subproblem might not be the same as the objective value of the current LP relaxation. Here the user has an option to return a true lower bound.
The default implementation returns the objective value of the current LP relaxation if no column generation is done, otherwise returns the current (somehow previously computed) true lower bound.
Reimplemented from BCP_lp_user.
virtual BCP_solution* CSP_lp::generate_heuristic_solution | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts | |||
) | [virtual] |
Try to generate a heuristic solution (or return one generated during cut/variable generation.
Return a pointer to the generated solution or return a NULL pointer.
Reimplemented from BCP_lp_user.
virtual void CSP_lp::restore_feasibility | ( | const BCP_lp_result & | lpres, | |
const std::vector< double * > | dual_rays, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_var * > & | vars_to_add, | |||
BCP_vec< BCP_col * > & | cols_to_add | |||
) | [virtual] |
Restoring feasibility.
This method is invoked before fathoming a search tree node that has been found infeasible and the variable pricing did not generate any new variables.
The user has to check all variables here.
Reimplemented from BCP_lp_user.
virtual void CSP_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.
virtual void CSP_lp::generate_vars_in_lp | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
const bool | before_fathom, | |||
BCP_vec< BCP_var * > & | new_vars, | |||
BCP_vec< BCP_col * > & | new_cols | |||
) | [virtual] |
Generate variables within the LP process.
Sometimes too much information would need to be transmitted for variable generation or the variable generation is so fast that transmitting the info would take longer than generating the variables. In such cases it might be better to generate the variables locally. This routine provides the opportunity.
Default: empty method.
lpres | solution to the current LP relaxation (IN) | |
vars | the variabless currently in the relaxation (IN) | |
cuts | the cuts currently in the relaxation (IN) | |
before_fathom | if true then BCP is about to fathom the node, so spend some extra effort generating variables if you want to avoid that... | |
new_vars | the vector of generated variables (OUT) | |
new_cols | the correspontding columns(OUT) |
Reimplemented from BCP_lp_user.
virtual BCP_branching_decision CSP_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] |
Decide whether to branch or not and select a set of branching candidates if branching is decided upon.
Reimplemented from BCP_lp_user.
BCP_lp_branching_object* CSP_lp::branch_on_half | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars | |||
) |
virtual void CSP_lp::set_actions_for_children | ( | BCP_presolved_lp_brobj * | best | ) | [virtual] |
Decide what to do with the children of the selected branching object.
Fill out the _child_action
field in best
. This will specify for every child what to do with it. Possible values for each individual child are BCP_PruneChild
, BCP_ReturnChild
and BCP_KeepChild
. There can be at most child with this last action specified. It means that in case of diving this child will be processed by this LP process as the next search tree node.
Default: Every action is BCP_ReturnChild
. However, if BCP dives then one child will be mark with BCP_KeepChild
. The decision which child to keep is based on the ChildPreference
parameter in BCP_lp_par. Also, if a child has a presolved lower bound that is higher than the current upper bound then that child is mark as BCP_FathomChild
.
THINK*: Should those children be sent back for processing in the next phase?
Reimplemented from BCP_lp_user.
std::vector<PATTERN*> CSP_lp::improving_patterns_ [private] |
Definition at line 29 of file CSP_lp.hpp.