/home/coin/SVN-release/Bcp-1.2.1/Bcp/src/include/BCP_tmstorage.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2007, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef _BCP_TMSTORAGE_H
00004 #define _BCP_TMSTORAGE_H
00005 
00006 #include <map>
00007 
00008 #include "BCP_enum_process_t.hpp"
00009 #include "BCP_buffer.hpp"
00010 #include "BCP_message.hpp"
00011 #include "BCP_parameters.hpp"
00012 #include "BCP_process.hpp"
00013 #include "BCP_USER.hpp"
00014 #include "BCP_problem_core.hpp"
00015 
00016 //#############################################################################
00017 
00018 class BCP_var_algo;
00019 class BCP_cut_algo;
00020 
00021 class BCP_node_change;
00022 
00023 //#############################################################################
00024 
00025 class BCP_ts_prob;
00026 class BCP_ts_user;
00027 
00028 //#############################################################################
00029 
00030 struct BCP_ts_par {
00031 
00032     enum chr_params {
00033         MessagePassingIsSerial,
00034         end_of_chr_params
00035     };
00036 
00037     enum int_params {
00043         MaxHeapSize,
00044         NiceLevel,
00045         end_of_int_params
00046     };
00047 
00048     enum dbl_params{
00049         end_of_dbl_params
00050     };
00051 
00052     enum str_params{
00053         LogFileName,
00054         end_of_str_params
00055     };
00056 
00057     enum str_array_params{
00058         end_of_str_array_params
00059     };
00060 
00061 };
00062     
00063 //#############################################################################
00064 
00067 struct BCP_ts_node_data {
00068     BCP_node_change* _desc;
00069     BCP_user_data*   _user;
00070 };
00071 
00072 //#############################################################################
00073 
00074 class BCP_ts_prob : public BCP_process {
00075 private:
00079     BCP_ts_prob(const BCP_ts_prob&);
00081     BCP_ts_prob& operator=(const BCP_ts_prob&);
00084 public:
00086     BCP_ts_user* user;
00088     BCP_user_pack* packer;
00090     BCP_message_environment* msg_env;
00092     BCP_parameter_set<BCP_ts_par> par;
00094     BCP_buffer msg_buf;
00096     BCP_problem_core* core;
00098     BCP_vec<int> indices;
00100     BCP_vec<int> positions;
00102     std::map<int, BCP_ts_node_data*> nodes; // *FIXME*: maybe hash_map better ?
00104     std::map<int, BCP_var_algo*> vars; // *FIXME*: maybe hash_map better ?
00106     std::map<int, BCP_cut_algo*> cuts; // *FIXME*: maybe hash_map better ?
00107 
00108 public:
00110     BCP_ts_prob(int my_id, int parent) :
00111         BCP_process(my_id, parent),
00112         user(0),
00113         msg_env(0),
00114         core(new BCP_problem_core) {}
00116     virtual ~BCP_ts_prob();
00117 
00118 public:
00119     virtual BCP_buffer& get_message_buffer() { return msg_buf; }
00120     virtual void process_message();
00121 };
00122 
00123 //#############################################################################
00124 
00125 class BCP_ts_user : public BCP_user_class {
00126 private:
00127     BCP_ts_prob * p;
00128 public:
00135 
00136     void setTsProblemPointer(BCP_ts_prob * ptr) { p = ptr; }
00138     BCP_ts_prob * getTsProblemPointer() { return p; }
00143     inline char              get_param(const BCP_ts_par::chr_params key) const{
00144         return p->par.entry(key); }
00145     inline int               get_param(const BCP_ts_par::int_params key) const{
00146         return p->par.entry(key); }
00147     inline double            get_param(const BCP_ts_par::dbl_params key) const{
00148         return p->par.entry(key); }
00149     inline const BCP_string& get_param(const BCP_ts_par::str_params key) const{
00150         return p->par.entry(key); }
00151 
00152     inline void set_param(const BCP_ts_par::chr_params key, const bool val) {
00153         p->par.set_entry(key, val); }
00154     inline void set_param(const BCP_ts_par::chr_params key, const char val) {
00155         p->par.set_entry(key, val); }
00156     inline void set_param(const BCP_ts_par::int_params key, const int val) {
00157         p->par.set_entry(key, val); }
00158     inline void set_param(const BCP_ts_par::dbl_params key, const double val) {
00159         p->par.set_entry(key, val); }
00160     inline void set_param(const BCP_ts_par::str_params key, const char * val) {
00161         p->par.set_entry(key, val); }
00162 
00163     //=========================================================================
00166     BCP_ts_user() : p(0) {}
00169     virtual ~BCP_ts_user() {}
00172     //=========================================================================
00173     // Here are the user defined functions. For each of them a default is
00174     // given which can be overridden when the concrete user class is defined.
00175     //=========================================================================
00176 
00183     virtual void
00184     unpack_module_data(BCP_buffer & buf);
00185 };
00186 
00187 #endif
00188 

Generated on Thu Jan 15 03:00:59 2009 for coin-Bcp by  doxygen 1.4.7