coin-Bcp
BCP_lp.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_LP_H
4 #define _BCP_LP_H
5 
6 #include <cfloat>
7 
8 #include "BCP_math.hpp"
9 #include "BCP_enum.hpp"
10 #include "BCP_enum_process_t.hpp"
11 #include "BCP_vector.hpp"
12 
13 #include "BCP_lp_param.hpp"
14 #include "BCP_parameters.hpp"
15 
16 #include "BCP_buffer.hpp"
17 #include "BCP_process.hpp"
18 
19 //#############################################################################
20 class OsiObject;
21 
22 class BCP_lp_user;
23 class BCP_user_pack;
24 class OsiSolverInterface;
26 
27 class BCP_lp_result;
28 
29 class BCP_problem_core;
31 
32 class BCP_var;
33 class BCP_cut;
34 
35 class BCP_col;
36 class BCP_row;
37 
38 class BCP_solution;
39 
40 class BCP_lp_var_pool;
41 class BCP_lp_cut_pool;
42 
43 class BCP_lp_node;
44 class BCP_lp_parent;
45 class CoinWarmStart;
46 
47 //#############################################################################
48 
49 // Everything in BCP_lp_prob is public. If the user wants to shoot herself in
50 // the leg she can do it.
51 
57 public:
70 
71 public:
77  time_heuristics(0),
78  time_lp_solving(0),
80  {}
81 
85  void pack(BCP_buffer& buf);
87  void unpack(BCP_buffer& buf);
91  void display() const;
92 
95  void add(const BCP_lp_statistics& stat);
96 };
97 
102 class BCP_lp_prob : public BCP_process {
103 private:
107  BCP_lp_prob(const BCP_lp_prob&);
112 public:
116  BCP_lp_prob(int my_id, int parent);
118  virtual ~BCP_lp_prob();
121 public:
122  //-------------------------------------------------------------------------
123  // The unpacking classes
126  //------------------------------------------------------------------------
127  // User provided members
148  //------------------------------------------------------------------------
149  // the description of the core
158  //------------------------------------------------------------------------
161  std::vector<OsiObject *> intAndSosObjects;
162 
163  //------------------------------------------------------------------------
164  // the search tree node we are working on and its parent
177  //------------------------------------------------------------------------
178  // Info while processing a particular node. Need to be updated when
179  // starting a new node.
194 
195  // The next/last index we can assign to a newly generated var/cut
206  //------------------------------------------------------------------------
207  // time measurements
211  double start_time;
216  //------------------------------------------------------------------------
217  // Internal members
218  //------------------------------------------------------------------------
222  double upper_bound;
224  int phase;
226  int no_more_cuts_cnt; // a counter for how many places we got to get
227  // NO_MORE_CUTS message to know for sure not to
228  // expect more.
230  int no_more_vars_cnt; // similar for vars
233  // message passing related fields
237  // int tree_manager;
241  //------------------------------------------------------------------------
242  // Results of BCP_lp_user::process_lp_result() are stored here
243  //------------------------------------------------------------------------
251 
252  //------------------------------------------------------------------------ // end of data members
254 
255 public:
259  void pack_var(const BCP_var& var);
261  BCP_var* unpack_var();
263  void pack_cut(const BCP_cut& cut);
265  BCP_cut* unpack_cut();
267  //-------------------------------------------------------------------------
270  // member functions related to accessing the parameters
274  inline char
275  param(BCP_lp_par::chr_params key) const { return par.entry(key); }
277  inline int
278  param(BCP_lp_par::int_params key) const { return par.entry(key); }
280  inline double
281  param(BCP_lp_par::dbl_params key) const { return par.entry(key); }
283  inline const BCP_string&
284  param(BCP_lp_par::str_params key) const { return par.entry(key); }
286  inline const BCP_vec<BCP_string>&
287  param(BCP_lp_par::str_array_params key) const { return par.entry(key); }
289  inline double granularity() const {
291  }
294  //-------------------------------------------------------------------------
298  inline bool has_ub() const { return upper_bound < BCP_DBL_MAX / 10; }
300  inline double ub() const { return upper_bound; }
302  inline bool ub(double new_ub) {
303  if (new_ub < upper_bound){
304  upper_bound = new_ub;
305  return true;
306  }
307  return false;
308  }
310  inline bool over_ub(double lb) const {
311  return has_ub() && lb >= upper_bound - granularity();
312  }
314  // end of query methods
315  //-------------------------------------------------------------------------
316  virtual BCP_buffer& get_message_buffer() { return msg_buf; }
317  virtual void process_message();
318 };
319 
320 #endif
This class describes changes in the core of the problem.
int_params
Integer parameters.
This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corr...
BCP_parameter_set< BCP_lp_par > par
Definition: BCP_lp.hpp:145
This class holds a column in a compressed form.
Definition: BCP_matrix.hpp:26
str_params
String parameters.
BCP_lp_node * node
Description he current search tree node.
Definition: BCP_lp.hpp:168
The minimum difference between the objective value of any two feasible solution (with different objec...
double param(BCP_lp_par::dbl_params key) const
Definition: BCP_lp.hpp:281
BCP_lp_parent * parent
Description of the parent of the current node.
Definition: BCP_lp.hpp:170
char param(BCP_lp_par::chr_params key) const
Definition: BCP_lp.hpp:275
const BCP_vec< BCP_string > & param(BCP_lp_par::str_array_params key) const
Definition: BCP_lp.hpp:287
void add(const BCP_lp_statistics &stat)
Add the argument statistics to this one.
int last_cut_index
Definition: BCP_lp.hpp:203
double granularity() const
Definition: BCP_lp.hpp:289
This is an abstract base class that describes the message passing environment.
Definition: BCP_message.hpp:30
Abstract base class that defines members common to all types of cuts.
Definition: BCP_cut.hpp:29
BCP_lp_statistics stat
Definition: BCP_lp.hpp:213
BCP_var * unpack_var()
char entry(const chr_params key) const
OsiSolverInterface * master_lp
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:135
double time_branching
Definition: BCP_lp.hpp:69
int last_var_index
Definition: BCP_lp.hpp:199
virtual ~BCP_lp_prob()
NO OLD DOC.
Definition: BCP_lp.hpp:102
void pack_var(const BCP_var &var)
NO OLD DOC.
Definition: BCP_lp.hpp:56
BCP_solution * sol
Definition: BCP_lp.hpp:249
This class is a very simple impelementation of a constant length string.
Definition: BCP_string.hpp:13
int next_cut_index
Definition: BCP_lp.hpp:201
virtual BCP_buffer & get_message_buffer()
Definition: BCP_lp.hpp:316
double time_var_generation
Definition: BCP_lp.hpp:63
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
const BCP_string & param(BCP_lp_par::str_params key) const
Definition: BCP_lp.hpp:284
double upper_bound
Definition: BCP_lp.hpp:222
BCP_vec< BCP_var * > new_vars
Definition: BCP_lp.hpp:247
BCP_cut * unpack_cut()
#define BCP_DBL_MAX
Definition: BCP_math.hpp:6
int no_more_cuts_cnt
Definition: BCP_lp.hpp:226
BCP_lp_cut_pool * local_cut_pool
Definition: BCP_lp.hpp:193
virtual void process_message()
BCP_lp_user * user
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:131
BCP_lp_prob(const BCP_lp_prob &)
NO OLD DOC.
Definition: BCP_lp_node.hpp:92
BCP_lp_prob & operator=(const BCP_lp_prob &)
void unpack(BCP_buffer &buf)
BCP_lp_statistics()
The contsructor just zeros out every timing data.
Definition: BCP_lp.hpp:73
OsiSolverInterface * lp_solver
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:137
int param(BCP_lp_par::int_params key) const
Definition: BCP_lp.hpp:278
BCP_lp_result * lp_result
Definition: BCP_lp.hpp:185
CoinWarmStart * warmstartRoot
Description of the warmstart info from the end of the root node.
Definition: BCP_lp.hpp:174
bool has_ub() const
Definition: BCP_lp.hpp:298
chr_params
Character parameters.
double ub() const
Definition: BCP_lp.hpp:300
BCP_lp_var_pool * local_var_pool
Definition: BCP_lp.hpp:191
Abstract Base Class for describing an interface to a solver.
bool over_ub(double lb) const
Definition: BCP_lp.hpp:310
NO OLD DOC.
Definition: BCP_lp_node.hpp:42
str_array_params
There are no string array parameters.
void pack_cut(const BCP_cut &cut)
Abstract base class that defines members common to all types of variables.
Definition: BCP_var.hpp:28
bool user_has_lp_result_processing
Definition: BCP_lp.hpp:244
double time_lp_solving
Definition: BCP_lp.hpp:67
Abstract base class for warm start information.
void display() const
Print out the statistics.
BCP_vec< BCP_cut * > slack_pool
Definition: BCP_lp.hpp:189
std::vector< OsiObject * > intAndSosObjects
Things that can be branched on.
Definition: BCP_lp.hpp:161
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
int no_more_vars_cnt
Definition: BCP_lp.hpp:230
BCP_problem_core * core
Definition: BCP_lp.hpp:153
BCP_vec< BCP_cut * > new_cuts
Definition: BCP_lp.hpp:245
double time_feas_testing
Definition: BCP_lp.hpp:59
double start_time
Definition: BCP_lp.hpp:211
BCP_message_environment * msg_env
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:139
double new_true_lower_bound
Definition: BCP_lp.hpp:250
This class holds the results after solving an LP relaxation.
BCP_vec< BCP_row * > new_rows
Definition: BCP_lp.hpp:246
Abstract base class for `objects&#39;.
BCP_problem_core_change * core_as_change
Definition: BCP_lp.hpp:155
bool ub(double new_ub)
Definition: BCP_lp.hpp:302
void pack(BCP_buffer &buf)
double time_heuristics
Definition: BCP_lp.hpp:65
double time_cut_generation
Definition: BCP_lp.hpp:61
BCP_buffer msg_buf
Definition: BCP_lp.hpp:239
dbl_params
Double parameters.
int next_var_index
Definition: BCP_lp.hpp:197
BCP_vec< BCP_col * > new_cols
Definition: BCP_lp.hpp:248
int var_bound_changes_since_logical_fixing
Definition: BCP_lp.hpp:187
This class holds a row in a compressed form.
Definition: BCP_matrix.hpp:152
This is the abstract base class for a solution to a Mixed Integer Programming problem.
BCP_user_pack * packer
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:133