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_vector.hpp" 00009 00010 #include "BCP_cg_param.hpp" 00011 #include "BCP_string.hpp" 00012 00013 class BCP_cg_prob; 00014 class BCP_buffer; 00015 class BCP_var; 00016 class BCP_var_algo; 00017 class BCP_cut; 00018 class BCP_cut_algo; 00019 00049 class BCP_cg_user { 00050 private: 00051 BCP_cg_prob * p; 00052 public: 00059 00060 void setCgProblemPointer(BCP_cg_prob * ptr) { p = ptr; } 00062 BCP_cg_prob * getCgProblemPointer() { return p; } 00068 double upper_bound() const; 00070 int current_phase() const; 00073 int current_level() const; 00076 int current_index() const; 00079 int current_iteration() const; 00084 00085 char get_param(const BCP_cg_par::chr_params key) const; 00087 int get_param(const BCP_cg_par::int_params key) const; 00089 double get_param(const BCP_cg_par::dbl_params key) const; 00091 const BCP_string& get_param(const BCP_cg_par::str_params key) const; 00092 00094 void set_param(const BCP_cg_par::chr_params key, const bool val); 00096 void set_param(const BCP_cg_par::chr_params key, const char val); 00098 void set_param(const BCP_cg_par::int_params key, const int val); 00100 void set_param(const BCP_cg_par::dbl_params key, const double val); 00102 void set_param(const BCP_cg_par::str_params key, const char * val); 00109 void send_cut(const BCP_cut& cut); 00110 00111 //=========================================================================== 00114 BCP_cg_user() : p(0) {} 00117 virtual ~BCP_cg_user() {} 00120 //=========================================================================== 00121 // Here are the user defined functions. For each of them a default is given 00122 // which can be overridden when the concrete user class is defined. 00123 //=========================================================================== 00129 virtual void 00130 unpack_module_data(BCP_buffer & buf); 00131 00132 //--------------------------------------------------------------------------- 00138 virtual void 00139 unpack_primal_solution(BCP_buffer& buf); 00140 00141 //--------------------------------------------------------------------------- 00145 virtual void 00146 generate_cuts(BCP_vec<BCP_var*>& vars, BCP_vec<double>& x); 00147 00148 //--------------------------------------------------------------------------- 00153 virtual void 00154 pack_cut_algo(const BCP_cut_algo* cut, BCP_buffer& buf); 00155 00156 //--------------------------------------------------------------------------- 00160 virtual BCP_var_algo* 00161 unpack_var_algo(BCP_buffer& buf); 00162 }; 00163 00164 #endif