BCP_tm_user.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_TM_USER_FUN_H
4 #define _BCP_TM_USER_FUN_H
5 
6 // This file is fully docified.
7 
8 #include "BCP_math.hpp"
9 #include "BCP_enum.hpp"
10 #include "BCP_enum_process_t.hpp"
11 #include "BCP_vector.hpp"
12 #include "BCP_string.hpp"
13 #include "BCP_buffer.hpp"
14 #include "BCP_solution.hpp"
15 #include "BCP_warmstart.hpp"
16 #include "BCP_var.hpp"
17 #include "BCP_cut.hpp"
18 #include "BCP_matrix.hpp"
19 #include "BCP_tm_param.hpp"
20 #include "BCP_tm_node.hpp"
21 #include "BCP_enum_tm.hpp"
22 #include "BCP_enum_process_t.hpp"
23 #include "BCP_USER.hpp"
24 
25 class BCP_lp_statistics;
26 
27 //#############################################################################
28 
58 class BCP_tm_user : public BCP_user_class {
59 private:
60  mutable BCP_tm_prob * p;
61 public:
68  void setTmProblemPointer(BCP_tm_prob * ptr) { p = ptr; }
71  BCP_tm_prob * getTmProblemPointer() const { return p; }
76  double upper_bound() const;
81  double lower_bound() const;
86  char get_param(const BCP_tm_par::chr_params key) const;
89  int get_param(const BCP_tm_par::int_params key) const;
91  double get_param(const BCP_tm_par::dbl_params key) const;
93  const BCP_string& get_param(const BCP_tm_par::str_params key) const;
94 
96  void set_param(const BCP_tm_par::chr_params key, const bool val);
98  void set_param(const BCP_tm_par::chr_params key, const char val);
100  void set_param(const BCP_tm_par::int_params key, const int val);
102  void set_param(const BCP_tm_par::dbl_params key, const double val);
104  void set_param(const BCP_tm_par::str_params key, const char * val);
107  //===========================================================================
110  BCP_tm_user() : p(0) {}
113  virtual ~BCP_tm_user() {}
116  //===========================================================================
117  // Here are the user defined functions. For each of them a default is given
118  // which can be overridden when the concrete user class is defined.
119  //===========================================================================
120 
130  virtual void
132 
140  virtual BCP_solution*
142 
147  virtual bool
148  replace_solution(const BCP_solution* old_sol, const BCP_solution* new_sol);
149 
152  //--------------------------------------------------------------------------
154  int process_id() const;
156  void
157  send_message(const int target, const BCP_buffer& buf);
159  void
160  broadcast_message(const BCP_process_t proc_type, const BCP_buffer& buf);
163  virtual void
165  //--------------------------------------------------------------------------
177  virtual void
180  BCP_lp_relax*& matrix);
181  //-------------------------------------------------------------------------
191  virtual void
192  create_root(BCP_vec<BCP_var*>& added_vars,
193  BCP_vec<BCP_cut*>& added_cuts,
194  BCP_user_data*& user_data);
197  //--------------------------------------------------------------------------
199  virtual void
201 
202  //--------------------------------------------------------------------------
207  virtual void
208  display_node_information(BCP_tree& search_tree,
209  const BCP_tm_node& node);
210 
211  //--------------------------------------------------------------------------
215  virtual void
216  display_node_information(BCP_tree& search_tree,
217  const BCP_tm_node& node,
218  bool after_processing_node);
219 
220  //--------------------------------------------------------------------------
222  virtual void
224 
225  //---------------------------------------------------------------------------
230  virtual void
231  init_new_phase(int phase,
232  BCP_column_generation& colgen,
233  CoinSearchTreeBase*& candidates);
236  //---------------------------------------------------------------------------
247  virtual void
248  change_candidate_heap(CoinSearchTreeManager& candidates,
249  const bool new_solution);
251 };
252 
253 //#############################################################################
254 
255 #endif
virtual void display_feasible_solution(const BCP_solution *sol)
Display a feasible solution.
double upper_bound() const
Return what is the best known upper bound (might be BCP_DBL_MAX)
Definition: BCP_tm_user.cpp:15
virtual void pack_module_data(BCP_buffer &buf, BCP_process_t ptype)
Pack the initial information (info that the user wants to send over) for the process specified by the...
Definition: BCP_tm_user.cpp:52
virtual void change_candidate_heap(CoinSearchTreeManager &candidates, const bool new_solution)
dbl_params
Double parameters.
BCP_process_t
This enumerative constant describes the various process types.
virtual void display_final_information(const BCP_lp_statistics &lp_stat)
Display information after BCP finished processing the search tree.
BCP_tm_user()
Being virtual, the destructor invokes the destructor for the real type of the object being deleted...
char get_param(const BCP_tm_par::chr_params key) const
Definition: BCP_tm_user.cpp:26
NO OLD DOC.
Definition: BCP_lp.hpp:56
NO OLD DOC.
This class is a very simple impelementation of a constant length string.
Definition: BCP_string.hpp:13
void setTmProblemPointer(BCP_tm_prob *ptr)
Set the pointer.
Definition: BCP_tm_user.hpp:69
void send_message(const int target, const BCP_buffer &buf)
Send a message to a particular process.
virtual BCP_solution * unpack_feasible_solution(BCP_buffer &buf)
Unpack a MIP feasible solution that was packed by the BCP_lp_user::pack_feasible_solution() method...
Definition: BCP_tm_user.cpp:57
void set_param(const BCP_tm_par::chr_params key, const bool val)
Definition: BCP_tm_user.cpp:38
chr_params
Character parameters.
BCP_tm_prob * p
Definition: BCP_tm_user.hpp:60
void fint fint fint * phase
NO OLD DOC.
Definition: BCP_tm.hpp:136
virtual void process_message(BCP_buffer &buf)
Process a message that has been sent by another process&#39; user part to this process&#39; user part...
virtual void init_new_phase(int phase, BCP_column_generation &colgen, CoinSearchTreeBase *&candidates)
Do whatever initialization is necessary before the phase-th phase.
void broadcast_message(const BCP_process_t proc_type, const BCP_buffer &buf)
Broadcast the message to all processes of the given type.
int_params
Integer parameters.
virtual void create_root(BCP_vec< BCP_var * > &added_vars, BCP_vec< BCP_cut * > &added_cuts, BCP_user_data *&user_data)
Create the set of extra variables and cuts that should be added to the formulation in the root node...
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
BCP_tm_prob * getTmProblemPointer() const
Get the pointer.
Definition: BCP_tm_user.hpp:71
virtual void initialize_core(BCP_vec< BCP_var_core * > &vars, BCP_vec< BCP_cut_core * > &cuts, BCP_lp_relax *&matrix)
Create the core of the problem by filling out the last three arguments.
BCP_column_generation
This enumerative constant describes what to do when a search tree node becomes fathomable for the cur...
Definition: BCP_enum.hpp:65
The BCP_tm_user class is the base class from which the user can derive a problem specific class to be...
Definition: BCP_tm_user.hpp:58
virtual bool replace_solution(const BCP_solution *old_sol, const BCP_solution *new_sol)
Decide whether to replace old_sol with new_sol.
Definition: BCP_tm_user.cpp:88
virtual void display_node_information(BCP_tree &search_tree, const BCP_tm_node &node)
Display user information just before a new node is sent to the LP or diving into a node is acknowledg...
int process_id() const
What is the process id of the current process.
Definition: BCP_tm_user.cpp:98
virtual ~BCP_tm_user()
Being virtual, the destructor invokes the destructor for the real type of the object being deleted...
An object of type BCP_lp_relax holds the description of an lp relaxation.
Definition: BCP_matrix.hpp:267
str_params
String parameters.
double lower_bound() const
Return a global lower bound.
Definition: BCP_tm_user.cpp:17
This is the abstract base class for a solution to a Mixed Integer Programming problem.