Bcp  1.4.4
BCP_tmstorage.hpp
Go to the documentation of this file.
1 // Copyright (C) 2007, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_TMSTORAGE_H
4 #define _BCP_TMSTORAGE_H
5 
6 #include <map>
7 
8 #include "BCP_enum_process_t.hpp"
9 #include "BCP_buffer.hpp"
10 #include "BCP_message.hpp"
11 #include "BCP_parameters.hpp"
12 #include "BCP_process.hpp"
13 #include "BCP_USER.hpp"
14 #include "BCP_problem_core.hpp"
15 
16 //#############################################################################
17 
18 class BCP_var_algo;
19 class BCP_cut_algo;
20 
21 class BCP_node_change;
22 
23 //#############################################################################
24 
25 class BCP_ts_prob;
26 class BCP_ts_user;
27 
28 //#############################################################################
29 
30 struct BCP_ts_par {
31 
32  enum chr_params {
35  };
36 
37  enum int_params {
46  };
47 
48  enum dbl_params{
50  };
51 
52  enum str_params{
55  };
56 
59  };
60 
61 };
62 
63 //#############################################################################
64 
70 };
71 
72 //#############################################################################
73 
74 class BCP_ts_prob : public BCP_process {
75 private:
79  BCP_ts_prob(const BCP_ts_prob&);
81  BCP_ts_prob& operator=(const BCP_ts_prob&);
84 public:
102  std::map<int, BCP_ts_node_data*> nodes; // *FIXME*: maybe hash_map better ?
104  std::map<int, BCP_var_algo*> vars; // *FIXME*: maybe hash_map better ?
106  std::map<int, BCP_cut_algo*> cuts; // *FIXME*: maybe hash_map better ?
107 
108 public:
110  BCP_ts_prob(int my_id, int parent) :
111  BCP_process(my_id, parent),
112  user(0),
113  msg_env(0),
114  core(new BCP_problem_core) {}
116  virtual ~BCP_ts_prob();
117 
118 public:
119  virtual BCP_buffer& get_message_buffer() { return msg_buf; }
120  virtual void process_message();
121 };
122 
123 //#############################################################################
124 
125 class BCP_ts_user : public BCP_user_class {
126 private:
127  BCP_ts_prob * p;
128 public:
136  void setTsProblemPointer(BCP_ts_prob * ptr) { p = ptr; }
143  inline char get_param(const BCP_ts_par::chr_params key) const{
144  return p->par.entry(key); }
145  inline int get_param(const BCP_ts_par::int_params key) const{
146  return p->par.entry(key); }
147  inline double get_param(const BCP_ts_par::dbl_params key) const{
148  return p->par.entry(key); }
149  inline const BCP_string& get_param(const BCP_ts_par::str_params key) const{
150  return p->par.entry(key); }
151 
152  inline void set_param(const BCP_ts_par::chr_params key, const bool val) {
153  p->par.set_entry(key, val); }
154  inline void set_param(const BCP_ts_par::chr_params key, const char val) {
155  p->par.set_entry(key, val); }
156  inline void set_param(const BCP_ts_par::int_params key, const int val) {
157  p->par.set_entry(key, val); }
158  inline void set_param(const BCP_ts_par::dbl_params key, const double val) {
159  p->par.set_entry(key, val); }
160  inline void set_param(const BCP_ts_par::str_params key, const char * val) {
161  p->par.set_entry(key, val); }
162 
163  //=========================================================================
166  BCP_ts_user() : p(0) {}
169  virtual ~BCP_ts_user() {}
172  //=========================================================================
173  // Here are the user defined functions. For each of them a default is
174  // given which can be overridden when the concrete user class is defined.
175  //=========================================================================
176 
183  virtual void
185 };
186 
187 #endif
188 
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
This is the class from which the user should derive her own algorithmic cuts.
Definition: BCP_cut.hpp:242
This is an abstract base class that describes the message passing environment.
Definition: BCP_message.hpp:30
char entry(const chr_params key) const
void set_entry(const chr_params key, const char val)
This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corr...
This class is a very simple impelementation of a constant length string.
Definition: BCP_string.hpp:13
BCP_buffer msg_buf
BCP_problem_core * core
std::map< int, BCP_ts_node_data * > nodes
BCP_message_environment * msg_env
virtual BCP_buffer & get_message_buffer()
BCP_parameter_set< BCP_ts_par > par
BCP_ts_prob(int my_id, int parent)
std::map< int, BCP_var_algo * > vars
BCP_vec< int > indices
a list of indices of nodes/vars/cuts that are requested/tobe deleted
std::map< int, BCP_cut_algo * > cuts
BCP_user_pack * packer
BCP_ts_user * user
BCP_vec< int > positions
positions in the TM of requested nodes/vars/cuts
virtual ~BCP_ts_prob()
virtual void process_message()
void set_param(const BCP_ts_par::str_params key, const char *val)
void set_param(const BCP_ts_par::chr_params key, const bool val)
void set_param(const BCP_ts_par::int_params key, const int val)
void setTsProblemPointer(BCP_ts_prob *ptr)
Set the pointer.
int get_param(const BCP_ts_par::int_params key) const
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the LP process by the Tree Manager.
BCP_ts_prob * getTsProblemPointer()
Get the pointer.
virtual ~BCP_ts_user()
Being virtual, the destructor invokes the destructor for the real type of the object being deleted.
void set_param(const BCP_ts_par::chr_params key, const char val)
void set_param(const BCP_ts_par::dbl_params key, const double val)
const BCP_string & get_param(const BCP_ts_par::str_params key) const
double get_param(const BCP_ts_par::dbl_params key) const
char get_param(const BCP_ts_par::chr_params key) const
This is the class from which the user should derive her own algorithmic variables.
Definition: BCP_var.hpp:277
Same as BCP_tm_node_data, just there's no need to use smart pointers in this process.
BCP_node_change * _desc
BCP_user_data * _user
@ end_of_str_array_params
@ MessagePassingIsSerial
@ MaxHeapSize
The maximum size of the memory heap the TS can use.