00001 // Copyright (C) 2000, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 #ifndef _BCP_CG_USER_H 00004 #define _BCP_CG_USER_H 00005 00006 // This file is fully docified. 00007 00008 #include "BCP_math.hpp" 00009 00010 #include "BCP_vector.hpp" 00011 00012 #include "BCP_cg_param.hpp" 00013 #include "BCP_string.hpp" 00014 00015 class BCP_cg_prob; 00016 class BCP_buffer; 00017 class BCP_var; 00018 class BCP_var_algo; 00019 class BCP_cut; 00020 class BCP_cut_algo; 00021 00051 class BCP_cg_user { 00052 private: 00053 BCP_cg_prob * p; 00054 public: 00061 00062 void setCgProblemPointer(BCP_cg_prob * ptr) { p = ptr; } 00064 BCP_cg_prob * getCgProblemPointer() { return p; } 00070 double upper_bound() const; 00072 int current_phase() const; 00075 int current_level() const; 00078 int current_index() const; 00081 int current_iteration() const; 00086 00087 char get_param(const BCP_cg_par::chr_params key) const; 00089 int get_param(const BCP_cg_par::int_params key) const; 00091 double get_param(const BCP_cg_par::dbl_params key) const; 00093 const BCP_string& get_param(const BCP_cg_par::str_params key) const; 00094 00096 void set_param(const BCP_cg_par::chr_params key, const bool val); 00098 void set_param(const BCP_cg_par::chr_params key, const char val); 00100 void set_param(const BCP_cg_par::int_params key, const int val); 00102 void set_param(const BCP_cg_par::dbl_params key, const double val); 00104 void set_param(const BCP_cg_par::str_params key, const char * val); 00111 void send_cut(const BCP_cut& cut); 00112 00113 //=========================================================================== 00116 BCP_cg_user() : p(0) {} 00119 virtual ~BCP_cg_user() {} 00122 //=========================================================================== 00123 // Here are the user defined functions. For each of them a default is given 00124 // which can be overridden when the concrete user class is defined. 00125 //=========================================================================== 00131 virtual void 00132 unpack_module_data(BCP_buffer & buf); 00133 00134 //--------------------------------------------------------------------------- 00140 virtual void 00141 unpack_primal_solution(BCP_buffer& buf); 00142 00143 //--------------------------------------------------------------------------- 00147 virtual void 00148 generate_cuts(BCP_vec<BCP_var*>& vars, BCP_vec<double>& x); 00149 00150 //--------------------------------------------------------------------------- 00155 virtual void 00156 pack_cut_algo(const BCP_cut_algo* cut, BCP_buffer& buf); 00157 00158 //--------------------------------------------------------------------------- 00162 virtual BCP_var_algo* 00163 unpack_var_algo(BCP_buffer& buf); 00164 }; 00165 00166 #endif