coin-Bcp
CSP_tm.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _CSP_TM_H
4 #define _CSP_TM_H
5 
7 
8 #include "BCP_parameters.hpp"
9 #include "BCP_tm_user.hpp"
10 
11 #include "CSP_tm_param.hpp"
12 #include "CSP_lp_param.hpp"
13 
14 #include "CSP.hpp"
15 #include "CSP_var.hpp"
16 
17 //#############################################################################
18 
19 class CSP_var;
20 
21 //#############################################################################
22 
23 class CSP_tm : public BCP_tm_user {
24 public:
28 
29 public:
30  // constructor
31  CSP_tm() : csproblem(0) {}
32 
33  //destructor
34  ~CSP_tm() {
35  delete csproblem;
36  }
37 
38  //==========================================================================
39  // Here are the user defined functions. For each of them a default is given
40  // which can be overridden when the concrete user class is defined.
41  //==========================================================================
42 
49  virtual void
51 
59  // *LL* : we use the generic solution, so the default is OK.
60  // *LL* : otherwise override this AND CSP_lp::pack_feasible_solution()
61  virtual BCP_solution*
64  }
65 
67  // *LL* : done
68  virtual void
70  CSP_var_pack(var, buf);
71  }
73  // *LL* : done
74  virtual BCP_var_algo*
76  return CSP_var_unpack(buf);
77  }
78 
80  // *LL* : needs to be written when we start to add cuts. Not for now.
81  virtual void
83  BCP_tm_user::pack_cut_algo(cut, buf);
84  }
86  // *LL* : needs to be written when we start to add cuts. Not for now.
87  virtual BCP_cut_algo*
89  return BCP_tm_user::unpack_cut_algo(buf);
90  }
91 
92  //--------------------------------------------------------------------------
102  // *LL* : set packing constraints are the core constraint, no core vars, no
103  // *LL* : core matrix.
104  virtual void
107  BCP_lp_relax*& matrix);
108  //--------------------------------------------------------------------------
118  // *LL* : the enumerated vars are the added vars, and since now we
119  // *LL* : enumerate everything, the pricing status is price nothing.
120  virtual void
121  create_root(BCP_vec<BCP_var*>& added_vars,
122  BCP_vec<BCP_cut*>& added_cuts,
123  BCP_user_data*& user_data,
124  BCP_pricing_status& pricing_status);
125 
126  //--------------------------------------------------------------------------
128  virtual void
130 
131  //--------------------------------------------------------------------------
134  // *LL* : default is fine, there's just one phase
135  virtual void
136  init_new_phase(int phase, BCP_column_generation& colgen);
137 
138  //--------------------------------------------------------------------------
146  // *LL* : default is fine
147  virtual bool compare_tree_nodes(const BCP_tm_node* node0,
148  const BCP_tm_node* node1) {
149  return BCP_tm_user::compare_tree_nodes(node0, node1);
150  }
151 };
152 
153 #endif
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...
CSP_tm()
Definition: CSP_tm.hpp:31
virtual void pack_cut_algo(const BCP_cut_algo *cut, BCP_buffer &buf)
Pack an algorithmic cut.
Definition: CSP_tm.hpp:82
virtual BCP_cut_algo * unpack_cut_algo(BCP_buffer &buf)
Unpack an algorithmic cut.
Definition: CSP_tm.hpp:88
This is the class from which the user should derive her own algorithmic cuts.
Definition: BCP_cut.hpp:242
BCP_process_t
This enumerative constant describes the various process types.
BCP_parameter_set< CSP_tm_par > tm_par
Definition: CSP_tm.hpp:25
virtual BCP_var_algo * unpack_var_algo(BCP_buffer &buf)
Unpack an algorithmic variable.
Definition: CSP_tm.hpp:75
virtual void init_new_phase(int phase, BCP_column_generation &colgen)
Do whatever initialization is necessary before the phase-th phase.
virtual bool compare_tree_nodes(const BCP_tm_node *node0, const BCP_tm_node *node1)
Definition: CSP_tm.hpp:147
BCP_parameter_set< CSP_lp_par > lp_par
Definition: CSP_tm.hpp:26
~CSP_tm()
Definition: CSP_tm.hpp:34
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...
virtual void create_root(BCP_vec< BCP_var * > &added_vars, BCP_vec< BCP_cut * > &added_cuts, BCP_user_data *&user_data, BCP_pricing_status &pricing_status)
Create the set of extra variables and cuts that should be added to the formulation in the root node...
CSPROBLEM * csproblem
Definition: CSP_tm.hpp:27
virtual void pack_var_algo(const BCP_var_algo *var, BCP_buffer &buf)
Pack an algorithmic variable.
Definition: CSP_tm.hpp:69
This is the class from which the user should derive her own algorithmic variables.
Definition: BCP_var.hpp:277
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
static BCP_var_algo * CSP_var_unpack(BCP_buffer &buf)
Definition: CSP_var.hpp:72
static void CSP_var_pack(const BCP_var_algo *var, BCP_buffer &buf)
Definition: CSP_var.hpp:78
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: CSP_tm.hpp:62
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 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.
An object of type BCP_lp_relax holds the description of an lp relaxation.
Definition: BCP_matrix.hpp:267
virtual void display_feasible_solution(const BCP_solution *sol)
Display a feasible solution.
This is the abstract base class for a solution to a Mixed Integer Programming problem.