OS_lp.hpp
Go to the documentation of this file.
1 /* $Id: OS_lp.hpp 2904 2009-09-06 06:47:42Z kmartin $ */
2 // Last edit: 2/10/05
3 //
4 // Name: OS_lp.hpp
5 // Author: Francois Margot
6 // Tepper School of Business
7 // Carnegie Mellon University, Pittsburgh, PA 15213
8 // email: fmargot@andrew.cmu.edu
9 // Date: 12/28/03
10 //-----------------------------------------------------------------------------
11 // Copyright (C) 2003, Francois Margot, International Business Machines
12 // Corporation and others. All Rights Reserved.
13 
14 #ifndef _OS_LP_H
15 #define _OS_LP_H
16 
17 
18 #include "OS.hpp"
19 #include "BCP_lp_user.hpp"
20 #include "BCP_buffer.hpp"
21 #include "BCP_parameters.hpp"
22 #include "OS_var.hpp"
23 #include "OS_user_data.hpp"
24 #include "OS_packer.hpp"
25 
28 class OS_lp : public BCP_lp_user {
29 
30  OsiSolverInterface* cg_lp;
31  //BCP_parameter_set<MCF1_par> par;
32  // OS_user_data data;
33 
36 
39 
41  int in_strong;
42 
44  double EPS;
45 
48 
51 
52 
54 
55 
57 
59  std::vector<int> violated_cuts;
60 
61 public:
62 
63 
64 
65 
66 
69  OS_lp(){}
71 
73  virtual ~OS_lp() {}
75 
78  virtual void unpack_module_data(BCP_buffer & buf);
80 
82  // virtual void pack_cut_algo(const BCP_cut_algo* cut, BCP_buffer& buf);
83 
85 // virtual BCP_cut_algo* unpack_cut_algo(BCP_buffer& buf);
86 
87 
88 // virtual void pack_var_algo(const BCP_var_algo* var, BCP_buffer& buf) {
89 
90 // OS_pack_var(var, buf);
91 // }
92 
93  // virtual BCP_var_algo* unpack_var_algo(BCP_buffer& buf) {
94 // return OS_unpack_var(buf);
95  // }
96 
98  //virtual void pack_user_data(const BCP_user_data* ud, BCP_buffer& buf);
99 
101  //virtual MY_user_data* unpack_user_data(BCP_buffer& buf);
103 
104  // Tell Bcp which solver to use and set parameters of solver.
106  virtual OsiSolverInterface *initialize_solver_interface();
107 
109  virtual void initialize_new_search_tree_node(
110  const BCP_vec<BCP_var*>& vars,
111  const BCP_vec<BCP_cut*>& cuts,
112  const BCP_vec<BCP_obj_status>& var_status,
113  const BCP_vec<BCP_obj_status>& cut_status,
114  BCP_vec<int>& var_changed_pos,
115  BCP_vec<double>& var_new_bd,
116  BCP_vec<int>& cut_changed_pos,
117  BCP_vec<double>& cut_new_bd);
118 
122  virtual void modify_lp_parameters(OsiSolverInterface* lp,
123  bool in_strong_branching);
124 
129  // virtual BCP_solution* test_feasibility(const BCP_lp_result& lp_result,
130 // const BCP_vec<BCP_var*>& vars,
131 // const BCP_vec<BCP_cut*>& cuts);
132 
133 
134 
139 
140 
141  //virtual void generate_cuts_in_lp(const BCP_lp_result& lpres,
142 // const BCP_vec<BCP_var*>& vars,
143 // const BCP_vec<BCP_cut*>& cuts,
144 // BCP_vec<BCP_cut*>& new_cuts,
145 // BCP_vec<BCP_row*>& new_rows);
146 
147 
148  virtual void display_lp_solution(const BCP_lp_result& lpres,
149  const BCP_vec<BCP_var*>& vars,
150  const BCP_vec<BCP_cut*>& cuts,
151  const bool final_lp_solution);
152 
155  const BCP_lp_result& lpres,
156  const BCP_vec<BCP_var*>& vars,
157  const BCP_vec<BCP_cut*>& cuts);
158 
162  virtual void
163  cuts_to_rows(const BCP_vec<BCP_var*>& vars, // on what to expand
164  BCP_vec<BCP_cut*>& cuts, // what to expand
165  BCP_vec<BCP_row*>& rows, // the expanded rows
166  const BCP_lp_result& lpres,
167  BCP_object_origin origin, bool allow_multiple);
168 
175 
176 
177  virtual BCP_branching_decision
179  const BCP_vec<BCP_var*>& vars,
180  const BCP_vec<BCP_cut*>& cuts,
181  const BCP_lp_var_pool& local_var_pool,
182  const BCP_lp_cut_pool& local_cut_pool,
184  bool force_branch = false);
185 
189  const int selected);
190 
191 
192 
193 
194 // virtual double compute_lower_bound(const double old_lower_bound,
195 // const BCP_lp_result& lpres, const BCP_vec<BCP_var*>& vars,
196 // const BCP_vec<BCP_cut*>& cuts);
197 
198 
199 // virtual void generate_vars_in_lp(const BCP_lp_result& lpres,
200 // const BCP_vec<BCP_var*>& vars, const BCP_vec<BCP_cut*>& cuts,
201 // const bool before_fathom, BCP_vec<BCP_var*>& new_vars,
202 // BCP_vec<BCP_col*>& new_cols);
203 
204 
205  virtual void vars_to_cols(const BCP_vec<BCP_cut*>& cuts,
207  const BCP_lp_result& lpres,
208  BCP_object_origin origin, bool allow_multiple);
209 
210 
211  //===========================================================================
238  virtual void process_lp_result(const BCP_lp_result& lpres,
239  const BCP_vec<BCP_var*>& vars,
240  const BCP_vec<BCP_cut*>& cuts,
241  const double old_lower_bound,
242  double& true_lower_bound,
243  BCP_solution*& sol,
244  BCP_vec<BCP_cut*>& new_cuts,
245  BCP_vec<BCP_row*>& new_rows,
246  BCP_vec<BCP_var*>& new_vars,
247  BCP_vec<BCP_col*>& new_cols);
248 
249 
250 
251 };
252 
253 #endif
BCP_object_origin
This enumerative constant describes the origin (originating process) of an object (variable or cut)...
Definition: BCP_enum.hpp:249
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.
Definition: OS_lp.cpp:145
OS_prob * os_prob
Pointer on the description of the problem.
Definition: OS_lp.hpp:35
BCP_vec< BCP_cut * > algo_cuts
Hold pointers on generated algorithmic cuts.
Definition: OS_lp.hpp:47
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.
Definition: OS_lp.cpp:154
double EPS
Hold the value of EPSILON of class OS_prob.
Definition: OS_lp.hpp:44
The BCP_lp_user class is the base class from which the user can derive a problem specific class to be...
Definition: BCP_lp_user.hpp:75
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.
Definition: OS_lp.cpp:339
void fint fint fint real fint real real real real real real real real real fint real fint * lp
OsiSolverInterface * cg_lp
Definition: OS_lp.hpp:30
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.
Definition: OS_lp.cpp:594
OS_lp()
Default constructor.
Definition: OS_lp.hpp:70
int in_strong
in_strong = 1 if and only if in strong branching phase
Definition: OS_lp.hpp:41
bool generated_cuts
Definition: OS_lp.hpp:56
std::vector< int > violated_cuts
Hold indices of violated indexed cuts.
Definition: OS_lp.hpp:59
bool generated_vars
Definition: OS_lp.hpp:53
MY_user_data * p_ud
Pointer on the description of the user data.
Definition: OS_lp.hpp:38
BCP_branching_decision
This enumerative constant is the return value of the select_branching_candidates() method in [BCP_lp_...
Class taking care of interaction between user data and Bcp.
virtual void unpack_module_data(BCP_buffer &buf)
Unpack data sent from the tree manager.
Definition: OS_lp.cpp:34
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.
Definition: OS_lp.cpp:286
A presolved branching object candidate.
virtual ~OS_lp()
Destructor.
Definition: OS_lp.hpp:73
BCP_vec< BCP_var * > algo_vars
Hold pointers on generated variables.
Definition: OS_lp.hpp:50
virtual OsiSolverInterface * initialize_solver_interface()
Pack algorithmic cuts.
Definition: OS_lp.cpp:55
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
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.
Definition: OS_lp.cpp:63
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.
Definition: OS_lp.cpp:245
Class holding data for describing the problem.
Definition: OS.hpp:25
This class holds the results after solving an LP relaxation.
virtual void modify_lp_parameters(OsiSolverInterface *lp, bool in_strong_branching)
Modify the parameters of the LP solver.
Definition: OS_lp.cpp:111
Class for operations at the node level.
Definition: OS_lp.hpp:28
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.
Definition: OS_lp.cpp:311
This is the abstract base class for a solution to a Mixed Integer Programming problem.