#include <MC_lp.hpp>
Inheritance diagram for MC_lp:
Public Member Functions | |
MC_lp () | |
~MC_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 | modify_lp_parameters (OsiSolverInterface *lp, const int changeType, bool in_strong_branching) |
Modify parameters of the LP solver before optimization. | |
virtual BCP_solution * | test_feasibility (const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts) |
Evaluate and return MIP feasibility of the current solution. | |
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. | |
MC_solution * | mc_generate_heuristic_solution (const double *x, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts) |
A local helper function. | |
virtual void | pack_feasible_solution (BCP_buffer &buf, const BCP_solution *sol) |
Pack a MIP feasible solution into a buffer. | |
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) |
Convert (and possibly lift) a set of cuts into corresponding rows for the current LP relaxation. | |
virtual void | generate_cuts_in_lp (const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows) |
Generate cuts within the LP process. | |
void | generate_cuts_in_lp (const double *x, const double *lhs, const double objval, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows) |
void | unique_cycle_cuts (BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows) |
void | generate_mst_cuts (const double *x, const double *lhs, const double objval, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows) |
void | generate_sp_cuts (const double *x, const double *lhs, const double objval, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows) |
double | getMaxLpViol () |
virtual BCP_object_compare_result | compare_cuts (const BCP_cut *c0, const BCP_cut *c1) |
Compare two generated cuts. | |
virtual void | logical_fixing (const BCP_lp_result &lpres, 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, const int var_bound_changes_since_logical_fixing, BCP_vec< int > &changed_pos, BCP_vec< double > &new_bd) |
This method provides an opportunity for the user to tighten the bounds of variables. | |
bool | is_gap_tailoff_rel (const int k, const double minimp, const double objval) const |
bool | is_lb_tailoff_abs (const int k, const double minimp, const double objval) const |
bool | is_lb_tailoff_rel (const int k, const double minimp, const double objval) const |
void | tailoff_test (bool &tailoff_gap_rel, bool &tailoff_lb_abs, bool &tailoff_lb_rel, const double objval) const |
OsiSolverInterface * | solveToOpt (OsiVolSolverInterface *vollp, const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, double &exact_obj) |
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 * > &candidates, bool force_branch=false) |
Decide whether to branch or not and select a set of branching candidates if branching is decided upon. | |
void | perform_strong_branching (const BCP_lp_result &lpres, OsiSolverInterface *exact_solver, BCP_vec< BCP_lp_branching_object * > &cands) |
void | choose_branching_vars (const BCP_vec< BCP_var * > &vars, const double *x, const int cand_num, BCP_vec< BCP_lp_branching_object * > &cands) |
virtual BCP_branching_object_relation | compare_branching_candidates (BCP_presolved_lp_brobj *new_presolved, BCP_presolved_lp_brobj *old_presolved) |
Decide which branching object is preferred for branching. | |
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< MC_lp_par > | par |
MC_problem | mc |
int | hist_len |
double * | objhist |
MC_solution * | soln |
bool | started_exact |
bool | tried_hard_cuts_in_prev_major_iter |
double | obj_shift |
BCP_presolved_lp_brobj * | best_presolved |
Private Member Functions | |
MC_lp (const MC_lp &) | |
MC_lp & | operator= (const MC_lp &) |
Definition at line 16 of file MC_lp.hpp.
MC_lp::MC_lp | ( | const MC_lp & | ) | [private] |
void MC_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.
Default: empty method.
Reimplemented from BCP_lp_user.
Definition at line 93 of file MC_lp.cpp.
References MC_problem::create_adj_lists(), BCP_parameter_set< Par >::entry(), hist_len, MC_lp_par::LpSolver, BCP_lp_par::MaxCutsAddedPerIteration, MC_lp_par::MaxCutsAddedPerIterSim, MC_lp_par::MaxCutsAddedPerIterVol, BCP_lp_par::MaxPresolveIter, MC_lp_par::MaxPresolveIterSim, MC_lp_par::MaxPresolveIterVol, mc, MC_UseVol, objhist, par, BCP_lp_user::set_param(), MC_lp_par::TailoffGapRelMinItcount, MC_lp_par::TailoffLbAbsMinItcount, MC_lp_par::TailoffLbRelMinItcount, MC_problem::unpack(), and BCP_parameter_set< Par >::unpack().
OsiSolverInterface * MC_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.
Definition at line 124 of file MC_lp.cpp.
References BCP_parameter_set< Par >::entry(), MC_lp_par::LpSolver, MC_UseClp, MC_UseVol, and par.
void MC_lp::modify_lp_parameters | ( | OsiSolverInterface * | lp, | |
const int | changeType, | |||
bool | in_strong_branching | |||
) | [virtual] |
Modify parameters of the LP solver before optimization.
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 what has changed in the LP before this method is called. 0: no change; 1: changes that affect primal feasibility (change in column/row bounds, added cuts); 2: changes that affect dual feasibility (added columns); 3: both. The last argument indicates whether the optimization is a "regular" optimization or it will take place in strong branching.
Default: If 1 or 2 then the appropriate simplex method will be hinted to the solver.
Reimplemented from BCP_lp_user.
Definition at line 141 of file MC_lp.cpp.
References BCP_lp_user::current_iteration(), BCP_parameter_set< Par >::entry(), MC_lp_par::LpSolver, MC_UseClp, par, started_exact, MC_lp_par::Vol_alphaFactor, MC_lp_par::Vol_alphaInit, MC_lp_par::Vol_alphaInt, MC_lp_par::Vol_alphaMin, MC_lp_par::Vol_ascentCheckInterval, MC_lp_par::Vol_ascentFirstCheck, MC_lp_par::Vol_gapAbsPrecision, MC_lp_par::Vol_gapRelPrecision, MC_lp_par::Vol_granularity, MC_lp_par::Vol_greenTestInterval, MC_lp_par::Vol_lambdaInit, MC_lp_par::Vol_maxSubGradientIterations, MC_lp_par::Vol_minimumRelAscent, MC_lp_par::Vol_primalAbsPrecision, MC_lp_par::Vol_printFlag, MC_lp_par::Vol_printInterval, MC_lp_par::Vol_redTestInterval, and MC_lp_par::Vol_yellowTestInterval.
BCP_solution * MC_lp::test_feasibility | ( | const BCP_lp_result & | lp_result, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts | |||
) | [virtual] |
Evaluate and return MIP feasibility of the current solution.
If the solution is MIP feasible, return a solution object otherwise return a NULL pointer. The useris also welcome to heuristically generate a solution and return a pointer to that solution (although the user will have another chance (after cuts and variables are generated) to return/create heuristically generated solutions. (After all, it's quite possible that solutions are generated during cut/variable generation.)
Default: test feasibility based on the FeeasibilityTest
parameter in BCP_lp_par which defults to BCP_FullTest_Feasible
.
lp_result | the result of the most recent LP optimization | |
vars | variables currently in the formulation | |
cuts | variables currently in the formulation |
Reimplemented from BCP_lp_user.
Definition at line 181 of file MC_lp.cpp.
References MC_lp_par::DoEdgeSwitchHeur, BCP_parameter_set< Par >::entry(), MC_lp_par::HeurSwitchImproveRound, MC_lp_par::IntegerTolerance, k, mc, MC_mst_cutgen(), MC_MstEdgeOrderingPreferExtreme, MC_problem::num_structure_type, par, purge_ptr_vector(), BCP_vec< T >::size(), MC_lp_par::StructureSwitchHeur, BCP_lp_result::x(), and x.
BCP_solution * MC_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.
Reimplemented from BCP_lp_user.
Definition at line 231 of file MC_lp.cpp.
References mc_generate_heuristic_solution(), and BCP_lp_result::x().
MC_solution * MC_lp::mc_generate_heuristic_solution | ( | const double * | x, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts | |||
) |
A local helper function.
Definition at line 241 of file MC_lp.cpp.
References MC_lp_par::DoEdgeSwitchHeur, BCP_parameter_set< Par >::entry(), MC_lp_par::HeurSwitchImproveRound, m, MC_lp_par::MaxPerturbInMstHeur, mc, MC_mst_heur(), MC_MstEdgeOrderingPreferExtreme, MC_MstEdgeOrderingPreferOne, MC_MstEdgeOrderingPreferZero, MC_update_solution(), MC_lp_par::MstHeurNum, n, MC_problem::num_edges, MC_problem::num_nodes, MC_problem::num_structure_type, par, ratio(), BCP_vec< T >::size(), soln, MC_lp_par::StructureSwitchHeur, and w.
Referenced by generate_heuristic_solution(), and solveToOpt().
void MC_lp::pack_feasible_solution | ( | BCP_buffer & | buf, | |
const BCP_solution * | sol | |||
) | [virtual] |
Pack a MIP feasible solution into a buffer.
The solution will be unpacked in the Tree Manager by the BCP_tm_user::unpack_feasible_solution() method.
Default: The default implementation assumes that sol
is a BCP_solution_generic object (containing variables at nonzero level) and packs it.
buf | (OUT) the buffer to pack into | |
sol | (IN) the solution to be packed |
Reimplemented from BCP_lp_user.
Definition at line 347 of file MC_lp.cpp.
References MC_solution::pack().
void MC_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] |
Convert (and possibly lift) a set of cuts into corresponding rows for the current LP relaxation.
Converting means computing for each cut the coefficients corresponding to each variable and creating BCP_row objects that can be added to the formulation.
This method has different purposes depending on the value of the last argument. If multiple expansion is not allowed then the user must generate a unique row for each cut. This unique row must always be the same for any given cut. This kind of operation is needed so that an LP relaxation can be exactly recreated.
On the other hand if multiple expansion is allowed then the user has (almost) free reign over what she returns. She can delete some of the cuts
or append new ones (e.g., lifted ones) to the end. The result of the LP relaxation and the origin of the cuts are there to help her to make a decision about what to do. For example, she might want to lift cuts coming from the Cut Generator, but not those coming from the Cut Pool. The only requirement is that when this method returns the number of cuts and rows must be the same and the i-th row must be the unique row corresponding to the i-th cut.
vars | the variables currently in the relaxation (IN) | |
cuts | the cuts to be converted (IN/OUT) | |
rows | the rows into which the cuts are converted (OUT) | |
lpres | solution to the current LP relaxation (IN) | |
origin | where the cuts come from (IN) | |
allow_multiple | whether multiple expansion, i.e., lifting, is allowed (IN) |
Reimplemented from BCP_lp_user.
Definition at line 356 of file MC_lp.cpp.
References BCP_DBL_MAX, BCP_vec< T >::clear(), MC_explicit_dense_cut::coeffs, cycle_cut, MC_problem::feas_sol, mc, BCP_vec< T >::reserve(), MC_explicit_dense_cut::rhs, BCP_vec< T >::size(), BCP_vec< T >::unchecked_push_back(), and MC_feas_sol::value.
Referenced by select_branching_candidates().
void MC_lp::generate_cuts_in_lp | ( | const BCP_lp_result & | lpres, | |
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_cut * > & | new_cuts, | |||
BCP_vec< BCP_row * > & | new_rows | |||
) | [virtual] |
Generate cuts within the LP process.
Sometimes too much information would need to be transmitted for cut generation (e.g., the full tableau for Gomory cuts) or the cut generation is so fast that transmitting the info would take longer than generating the cuts. In such cases it might better to generate the cuts locally. This routine provides the opportunity.
Default: empty for now. To be interfaced to Cgl.
lpres | solution to the current LP relaxation (IN) | |
vars | the variabless currently in the relaxation (IN) | |
cuts | the cuts currently in the relaxation (IN) | |
new_cuts | the vector of generated cuts (OUT) | |
new_rows | the correspontding rows(OUT) |
Reimplemented from BCP_lp_user.
Definition at line 581 of file MC_lp.cpp.
References BCP_lp_result::lhs(), BCP_lp_result::objval(), BCP_vec< T >::size(), BCP_lp_result::x(), and x.
Referenced by select_branching_candidates().
void MC_lp::generate_cuts_in_lp | ( | const double * | x, | |
const double * | lhs, | |||
const double | objval, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_cut * > & | new_cuts, | |||
BCP_vec< BCP_row * > & | new_rows | |||
) |
Definition at line 627 of file MC_lp.cpp.
References BCP_parameter_set< Par >::entry(), MC_problem::feas_sol, generate_mst_cuts(), generate_sp_cuts(), getMaxLpViol(), MC_problem::ising_four_cycles, MC_problem::ising_triangles, mc, MC_AlwaysGenerateMstCycleCuts, MC_AlwaysGenerateSPCycleCuts, MC_GenerateMstCycleCutsAsLastResort, MC_GenerateSPCycleCutsAsLastResort, MC_test_ising_four_cycles(), MC_test_ising_triangles(), MC_lp_par::MinIsingCutViolation, MC_lp_par::MstCycleCutGeneration, MC_problem::num_nodes, par, BCP_vec< T >::size(), MC_lp_par::SPCycleCutGeneration, tailoff_test(), unique_cycle_cuts(), and MC_feas_sol::value.
Definition at line 52 of file MC_lp.cpp.
References BCP_vec< T >::end(), BCP_vec< T >::entry(), BCP_vec< T >::erase(), k, MC_cycle_cut_equal(), MC_cycle_row_pair_comp(), and BCP_vec< T >::size().
Referenced by generate_cuts_in_lp().
void MC_lp::generate_mst_cuts | ( | const double * | x, | |
const double * | lhs, | |||
const double | objval, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_cut * > & | new_cuts, | |||
BCP_vec< BCP_row * > & | new_rows | |||
) |
Definition at line 437 of file MC_lp.cpp.
References MC_lp_par::CycleCutHeurNum, MC_lp_par::DoEdgeSwitchHeur, BCP_parameter_set< Par >::entry(), getMaxLpViol(), MC_lp_par::HeurSwitchImproveRound, MC_lp_par::MaxCycleCutNum, MC_lp_par::MaxPerturbInMstCycleCutGen, mc, MC_mst_cutgen(), MC_MstEdgeOrderingPreferExtreme, MC_MstEdgeOrderingPreferOne, MC_update_solution(), MC_lp_par::MinMstCycleCutViolation, MC_problem::num_structure_type, MC_solution::objective_value(), par, ratio(), BCP_vec< T >::size(), soln, MC_lp_par::StructureSwitchHeur, and w.
Referenced by generate_cuts_in_lp().
void MC_lp::generate_sp_cuts | ( | const double * | x, | |
const double * | lhs, | |||
const double | objval, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
BCP_vec< BCP_cut * > & | new_cuts, | |||
BCP_vec< BCP_row * > & | new_rows | |||
) |
Definition at line 565 of file MC_lp.cpp.
References BCP_parameter_set< Par >::entry(), getMaxLpViol(), mc, MC_generate_shortest_path_cycles(), MC_lp_par::MinSPCycleCutViolation, par, and MC_lp_par::ReportAllSPCycleCuts.
Referenced by generate_cuts_in_lp().
double MC_lp::getMaxLpViol | ( | ) |
Definition at line 608 of file MC_lp.cpp.
References BCP_lp_user::getLpProblemPointer(), k, BCP_lp_result::lhs(), BCP_lp_prob::lp_result, and BCP_lp_prob::lp_solver.
Referenced by generate_cuts_in_lp(), generate_mst_cuts(), and generate_sp_cuts().
BCP_object_compare_result MC_lp::compare_cuts | ( | const BCP_cut * | c0, | |
const BCP_cut * | c1 | |||
) | [virtual] |
Compare two generated cuts.
Cuts are generated in different iterations, they come from the Cut Pool, etc. There is a very real possibility that the LP process receives several cuts that are either identical or one of them is better then another (cuts off everything the other cuts off). This routine is used to decide which one to keep if not both.
Default: Return BCP_DifferentObjs
.
Reimplemented from BCP_lp_user.
Definition at line 428 of file MC_lp.cpp.
References BCP_DifferentObjs, BCP_ObjsAreSame, and MC_cycle_cut_equal().
void MC_lp::logical_fixing | ( | const BCP_lp_result & | lpres, | |
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, | |||
const int | var_bound_changes_since_logical_fixing, | |||
BCP_vec< int > & | changed_pos, | |||
BCP_vec< double > & | new_bd | |||
) | [virtual] |
This method provides an opportunity for the user to tighten the bounds of variables.
The method is invoked after reduced cost fixing. The results are returned in the last two parameters.
Default: empty method.
lpres | the result of the most recent LP optimization, | |
vars | the variables in the current formulation, | |
status | the stati of the variables as known to the system, | |
var_bound_changes_since_logical_fixing | the number of variables whose bounds have changed (by reduced cost fixing) since the most recent invocation of this method that has actually forced changes returned something in the last two arguments, | |
changed_pos | the positions of the variables whose bounds should be changed | |
new_bd | the new bounds (lb/ub pairs) of these variables. |
Reimplemented from BCP_lp_user.
Definition at line 723 of file MC_lp.cpp.
References MC_problem::edges, MC_graph_edge::head, k, m, mc, n, MC_problem::num_edges, MC_problem::num_nodes, BCP_vec< T >::push_back(), BCP_vec< T >::size(), and MC_graph_edge::tail.
bool MC_lp::is_gap_tailoff_rel | ( | const int | k, | |
const double | minimp, | |||
const double | objval | |||
) | const |
Definition at line 25 of file MC_lp_branch.cpp.
References BCP_lp_user::current_iteration(), hist_len, objhist, and BCP_lp_user::upper_bound().
Referenced by tailoff_test().
bool MC_lp::is_lb_tailoff_abs | ( | const int | k, | |
const double | minimp, | |||
const double | objval | |||
) | const |
Definition at line 61 of file MC_lp_branch.cpp.
References BCP_lp_user::current_iteration(), hist_len, and objhist.
Referenced by tailoff_test().
bool MC_lp::is_lb_tailoff_rel | ( | const int | k, | |
const double | minimp, | |||
const double | objval | |||
) | const |
Definition at line 44 of file MC_lp_branch.cpp.
References BCP_lp_user::current_iteration(), hist_len, and objhist.
Referenced by tailoff_test().
void MC_lp::tailoff_test | ( | bool & | tailoff_gap_rel, | |
bool & | tailoff_lb_abs, | |||
bool & | tailoff_lb_rel, | |||
const double | objval | |||
) | const |
Definition at line 80 of file MC_lp_branch.cpp.
References BCP_lp_user::current_iteration(), BCP_parameter_set< Par >::entry(), hist_len, is_gap_tailoff_rel(), is_lb_tailoff_abs(), is_lb_tailoff_rel(), objhist, par, MC_lp_par::TailoffGapRelMinImprovement, MC_lp_par::TailoffGapRelMinItcount, MC_lp_par::TailoffLbAbsMinImprovement, MC_lp_par::TailoffLbAbsMinItcount, MC_lp_par::TailoffLbRelMinImprovement, MC_lp_par::TailoffLbRelMinItcount, and BCP_lp_user::upper_bound().
Referenced by generate_cuts_in_lp(), and select_branching_candidates().
OsiSolverInterface * MC_lp::solveToOpt | ( | OsiVolSolverInterface * | vollp, | |
const BCP_lp_result & | lpres, | |||
const BCP_vec< BCP_var * > & | vars, | |||
const BCP_vec< BCP_cut * > & | cuts, | |||
double & | exact_obj | |||
) |
Definition at line 169 of file MC_lp_branch.cpp.
References BCP_parameter_set< Par >::entry(), MC_lp_par::ExplicitSlacksInOpt, BCP_lp_user::get_param(), BCP_lp_user::getLpProblemPointer(), BCP_lp_par::Granularity, MC_lp_par::LpSolver, mc_generate_heuristic_solution(), MC_solveClp(), MC_UseClp, BCP_lp_prob::node, MC_solution::objective_value(), par, BCP_lp_user::reduced_cost_fixing(), BCP_lp_user::send_feasible_solution(), soln, BCP_lp_user::upper_bound(), and BCP_lp_node::vars.
Referenced by select_branching_candidates().
BCP_branching_decision MC_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 * > & | candidates, | |||
bool | force_branch = false | |||
) | [virtual] |
Decide whether to branch or not and select a set of branching candidates if branching is decided upon.
The return value indicates what should be done: branching, continuing with the same node or abandoning the node completely.
Default: Branch if both local pools are empty. If branching is done then several (based on the StrongBranch_CloseToHalfNum
and StrongBranch_CloseToOneNum
parameters in BCP_lp_par) variables are selected for strong branching.
"Close-to-half" variables are those that should be integer and are at a fractional level. The measure of their fractionality is their distance from the closest integer. The most fractional variables will be selected, i.e., those that are close to half. If there are too many such variables then those with higher objective value have priority.
"Close-to-on" is interpreted in a more literal sense. It should be used only if the integer variables are binary as it select those fractional variables which are away from 1 but are still close. If there are too many such variables then those with lower objective value have priority.
lpres | the result of the most recent LP optimization. | |
vars | the variables in the current formulation. | |
cuts | the cuts in the current formulation. | |
local_var_pool | the local pool that holds variables with negative reduced cost. In case of continuing with the node the best so many variables will be added to the formulation (those with the most negative reduced cost). | |
local_cut_pool | the local pool that holds violated cuts. In case of continuing with the node the best so many cuts will be added to the formulation (the most violated ones). | |
cands | the generated branching candidates. | |
force_branch | indicate whether to force branching regardless of the size of the local cut/var pools |
Pseudo Shadow Price mode 0 - off 1 - use and multiply by strong info 2 - use
Reimplemented from BCP_lp_user.
Definition at line 335 of file MC_lp_branch.cpp.
References BCP_DoBranch, BCP_DoNotBranch, BCP_DoNotBranch_Fathomed, BCP_lp_next_cut_index(), BCP_Object_FromGenerator, choose_branching_vars(), BCP_lp_user::current_index(), BCP_lp_user::current_iteration(), BCP_lp_user::current_level(), cuts_to_rows(), BCP_parameter_set< Par >::entry(), generate_cuts_in_lp(), BCP_lp_result::get_results(), BCP_lp_user::getLpProblemPointer(), hist_len, BCP_lp_prob::local_cut_pool, lp, BCP_lp_prob::lp_result, BCP_lp_prob::lp_solver, MC_lp_par::LpSolver, BCP_lp_prob::master_lp, BCP_lp_par::MaxCutsAddedPerIteration, MC_lp_par::MaxCutsAddedPerIterSim, MC_lp_par::MaxDepth, BCP_lp_par::MaxPresolveIter, MC_lp_par::MaxPresolveIterSim, MC_UseClp, MC_UseVol, objhist, BCP_lp_result::objval(), MC_lp_par::OnceOptAlwaysOpt, BCP_lp_user::p, par, perform_strong_branching(), BCP_vec< T >::reserve(), MC_lp_par::SB_CandidateNum, BCP_parameter_set< Par >::set_entry(), BCP_lp_user::set_param(), BCP_vec< T >::size(), solveToOpt(), started_exact, MC_lp_par::SwitchToSimplex, tailoff_test(), BCP_vec< T >::unchecked_push_back(), and BCP_lp_result::x().
void MC_lp::perform_strong_branching | ( | const BCP_lp_result & | lpres, | |
OsiSolverInterface * | exact_solver, | |||
BCP_vec< BCP_lp_branching_object * > & | cands | |||
) |
Definition at line 531 of file MC_lp_branch.cpp.
References BCP_lp_branching_object::apply_child_bd(), BCP_DBL_MAX, BCP_ProvenOptimal, BCP_ProvenPrimalInf, BCP_vec< T >::begin(), best_presolved, BCP_presolved_lp_brobj::candidate(), BCP_lp_branching_object::child_num, BCP_vec< T >::clear(), BCP_vec< T >::end(), BCP_lp_branching_object::forced_var_pos, BCP_lp_user::get_param(), BCP_lp_par::Granularity, BCP_lp_par::LpVerb_PresolvePositions, BCP_lp_par::LpVerb_PresolveResult, obj_shift, BCP_lp_branching_object::print_branching_info(), purge_ptr_vector(), BCP_vec< T >::push_back(), BCP_lp_user::upper_bound(), and BCP_lp_result::x().
Referenced by select_branching_candidates().
void MC_lp::choose_branching_vars | ( | const BCP_vec< BCP_var * > & | vars, | |
const double * | x, | |||
const int | cand_num, | |||
BCP_vec< BCP_lp_branching_object * > & | cands | |||
) |
Definition at line 285 of file MC_lp_branch.cpp.
References BCP_lp_user::append_branching_vars(), BCP_vec< T >::begin(), MC_problem::edges, BCP_vec< T >::end(), BCP_vec< T >::entry(), BCP_parameter_set< Par >::entry(), BCP_vec< T >::erase(), MC_lp_par::IntegerTolerance, MC_problem::ising_triangles, m, mc, MC_problem::num_edges, MC_problem::num_nodes, par, BCP_vec< T >::reserve(), BCP_vec< T >::size(), BCP_vec< T >::unchecked_push_back(), and w.
Referenced by select_branching_candidates().
BCP_branching_object_relation MC_lp::compare_branching_candidates | ( | BCP_presolved_lp_brobj * | new_presolved, | |
BCP_presolved_lp_brobj * | old_presolved | |||
) | [virtual] |
Decide which branching object is preferred for branching.
Based on the member fields of the two presolved candidate branching objects decide which one should be preferred for really branching on it. Possible return values are: BCP_OldPresolvedIsBetter
, BCP_NewPresolvedIsBetter
and BCP_NewPresolvedIsBetter_BranchOnIt
. This last value (besides specifying which candidate is preferred) also indicates that no further candidates should be examined, branching should be done on this candidate.
Default: The behavior of this method is governed by the BranchingObjectComparison
parameter in BCP_lp_par.
Reimplemented from BCP_lp_user.
Definition at line 503 of file MC_lp_branch.cpp.
References BCP_lp_user::compare_branching_candidates().
void MC_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_FathomChild
, 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.
Definition at line 514 of file MC_lp_branch.cpp.
References best_presolved, BCP_lp_user::set_actions_for_children(), and BCP_presolved_lp_brobj::swap().
Definition at line 21 of file MC_lp.hpp.
Referenced by choose_branching_vars(), generate_cuts_in_lp(), generate_mst_cuts(), generate_sp_cuts(), initialize_solver_interface(), mc_generate_heuristic_solution(), modify_lp_parameters(), select_branching_candidates(), solveToOpt(), tailoff_test(), test_feasibility(), and unpack_module_data().
Definition at line 22 of file MC_lp.hpp.
Referenced by choose_branching_vars(), cuts_to_rows(), generate_cuts_in_lp(), generate_mst_cuts(), generate_sp_cuts(), logical_fixing(), mc_generate_heuristic_solution(), test_feasibility(), and unpack_module_data().
int MC_lp::hist_len |
Definition at line 26 of file MC_lp.hpp.
Referenced by is_gap_tailoff_rel(), is_lb_tailoff_abs(), is_lb_tailoff_rel(), select_branching_candidates(), tailoff_test(), and unpack_module_data().
double* MC_lp::objhist |
Definition at line 27 of file MC_lp.hpp.
Referenced by is_gap_tailoff_rel(), is_lb_tailoff_abs(), is_lb_tailoff_rel(), select_branching_candidates(), tailoff_test(), unpack_module_data(), and ~MC_lp().
Definition at line 30 of file MC_lp.hpp.
Referenced by generate_mst_cuts(), mc_generate_heuristic_solution(), solveToOpt(), and ~MC_lp().
bool MC_lp::started_exact |
Definition at line 32 of file MC_lp.hpp.
Referenced by modify_lp_parameters(), and select_branching_candidates().
double MC_lp::obj_shift |
Definition at line 40 of file MC_lp.hpp.
Referenced by perform_strong_branching(), and set_actions_for_children().