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:
135  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 
BCP_ts_user::get_param
double get_param(const BCP_ts_par::dbl_params key) const
Definition: BCP_tmstorage.hpp:147
BCP_ts_user::get_param
const BCP_string & get_param(const BCP_ts_par::str_params key) const
Definition: BCP_tmstorage.hpp:149
BCP_ts_par::end_of_int_params
@ end_of_int_params
Definition: BCP_tmstorage.hpp:45
BCP_parameter_set::entry
char entry(const chr_params key) const
Definition: BCP_parameters.hpp:168
BCP_ts_prob::user
BCP_ts_user * user
Definition: BCP_tmstorage.hpp:86
BCP_ts_par::MaxHeapSize
@ MaxHeapSize
The maximum size of the memory heap the TS can use.
Definition: BCP_tmstorage.hpp:43
BCP_parameter_set::set_entry
void set_entry(const chr_params key, const char val)
Definition: BCP_parameters.hpp:215
BCP_ts_user
Definition: BCP_tmstorage.hpp:125
BCP_ts_user::set_param
void set_param(const BCP_ts_par::chr_params key, const bool val)
Definition: BCP_tmstorage.hpp:152
BCP_ts_prob::cuts
std::map< int, BCP_cut_algo * > cuts
Definition: BCP_tmstorage.hpp:106
BCP_ts_prob::get_message_buffer
virtual BCP_buffer & get_message_buffer()
Definition: BCP_tmstorage.hpp:119
BCP_ts_prob::msg_env
BCP_message_environment * msg_env
Definition: BCP_tmstorage.hpp:90
BCP_ts_prob::vars
std::map< int, BCP_var_algo * > vars
Definition: BCP_tmstorage.hpp:104
BCP_ts_prob::par
BCP_parameter_set< BCP_ts_par > par
Definition: BCP_tmstorage.hpp:92
BCP_ts_user::BCP_ts_user
BCP_ts_user()
Definition: BCP_tmstorage.hpp:166
BCP_enum_process_t.hpp
BCP_ts_par
Definition: BCP_tmstorage.hpp:30
BCP_ts_prob::msg_buf
BCP_buffer msg_buf
Definition: BCP_tmstorage.hpp:94
BCP_node_change
Definition: BCP_node_change.hpp:19
BCP_ts_user::get_param
char get_param(const BCP_ts_par::chr_params key) const
Definition: BCP_tmstorage.hpp:143
BCP_vec< int >
BCP_user_data
Definition: BCP_USER.hpp:19
BCP_parameter_set< BCP_ts_par >
BCP_ts_user::set_param
void set_param(const BCP_ts_par::str_params key, const char *val)
Definition: BCP_tmstorage.hpp:160
BCP_ts_user::setTsProblemPointer
void setTsProblemPointer(BCP_ts_prob *ptr)
Set the pointer.
Definition: BCP_tmstorage.hpp:136
BCP_parameters.hpp
BCP_ts_user::getTsProblemPointer
BCP_ts_prob * getTsProblemPointer()
Get the pointer.
Definition: BCP_tmstorage.hpp:138
BCP_ts_node_data::_desc
BCP_node_change * _desc
Definition: BCP_tmstorage.hpp:68
BCP_message.hpp
BCP_ts_par::end_of_str_params
@ end_of_str_params
Definition: BCP_tmstorage.hpp:54
BCP_ts_prob::process_message
virtual void process_message()
BCP_ts_par::end_of_str_array_params
@ end_of_str_array_params
Definition: BCP_tmstorage.hpp:58
BCP_ts_par::chr_params
chr_params
Definition: BCP_tmstorage.hpp:32
BCP_ts_prob::~BCP_ts_prob
virtual ~BCP_ts_prob()
BCP_ts_par::str_array_params
str_array_params
Definition: BCP_tmstorage.hpp:57
BCP_ts_par::str_params
str_params
Definition: BCP_tmstorage.hpp:52
BCP_ts_node_data::_user
BCP_user_data * _user
Definition: BCP_tmstorage.hpp:69
BCP_problem_core
This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corr...
Definition: BCP_problem_core.hpp:31
BCP_string
This class is a very simple impelementation of a constant length string.
Definition: BCP_string.hpp:13
BCP_ts_user::set_param
void set_param(const BCP_ts_par::int_params key, const int val)
Definition: BCP_tmstorage.hpp:156
BCP_user_class
Definition: BCP_USER.hpp:26
BCP_var_algo
This is the class from which the user should derive her own algorithmic variables.
Definition: BCP_var.hpp:277
BCP_ts_par::NiceLevel
@ NiceLevel
Definition: BCP_tmstorage.hpp:44
BCP_problem_core.hpp
BCP_ts_prob::core
BCP_problem_core * core
Definition: BCP_tmstorage.hpp:96
BCP_ts_par::end_of_chr_params
@ end_of_chr_params
Definition: BCP_tmstorage.hpp:34
BCP_ts_par::dbl_params
dbl_params
Definition: BCP_tmstorage.hpp:48
BCP_ts_prob::positions
BCP_vec< int > positions
positions in the TM of requested nodes/vars/cuts
Definition: BCP_tmstorage.hpp:100
BCP_ts_prob
Definition: BCP_tmstorage.hpp:74
BCP_message_environment
This is an abstract base class that describes the message passing environment.
Definition: BCP_message.hpp:30
BCP_ts_user::~BCP_ts_user
virtual ~BCP_ts_user()
Being virtual, the destructor invokes the destructor for the real type of the object being deleted.
Definition: BCP_tmstorage.hpp:169
BCP_ts_user::unpack_module_data
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the LP process by the Tree Manager.
BCP_ts_user::set_param
void set_param(const BCP_ts_par::dbl_params key, const double val)
Definition: BCP_tmstorage.hpp:158
BCP_ts_prob::BCP_ts_prob
BCP_ts_prob(int my_id, int parent)
Definition: BCP_tmstorage.hpp:110
BCP_ts_prob::packer
BCP_user_pack * packer
Definition: BCP_tmstorage.hpp:88
BCP_ts_par::int_params
int_params
Definition: BCP_tmstorage.hpp:37
BCP_USER.hpp
BCP_process
Definition: BCP_process.hpp:16
BCP_ts_user::set_param
void set_param(const BCP_ts_par::chr_params key, const char val)
Definition: BCP_tmstorage.hpp:154
BCP_ts_node_data
Same as BCP_tm_node_data, just there's no need to use smart pointers in this process.
Definition: BCP_tmstorage.hpp:67
BCP_ts_prob::nodes
std::map< int, BCP_ts_node_data * > nodes
Definition: BCP_tmstorage.hpp:102
BCP_ts_par::LogFileName
@ LogFileName
Definition: BCP_tmstorage.hpp:53
BCP_buffer
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
BCP_ts_par::end_of_dbl_params
@ end_of_dbl_params
Definition: BCP_tmstorage.hpp:49
BCP_ts_prob::indices
BCP_vec< int > indices
a list of indices of nodes/vars/cuts that are requested/tobe deleted
Definition: BCP_tmstorage.hpp:98
BCP_user_pack
Definition: BCP_USER.hpp:48
BCP_ts_par::MessagePassingIsSerial
@ MessagePassingIsSerial
Definition: BCP_tmstorage.hpp:33
BCP_cut_algo
This is the class from which the user should derive her own algorithmic cuts.
Definition: BCP_cut.hpp:242
BCP_process.hpp
BCP_ts_user::get_param
int get_param(const BCP_ts_par::int_params key) const
Definition: BCP_tmstorage.hpp:145
BCP_buffer.hpp