00001 // Copyright (C) 2005, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 #ifndef _CSP_TM_H 00004 #define _CSP_TM_H 00005 00006 #include <OsiClpSolverInterface.hpp> 00007 00008 #include "BCP_parameters.hpp" 00009 #include "BCP_tm_user.hpp" 00010 00011 #include "CSP_tm_param.hpp" 00012 #include "CSP_lp_param.hpp" 00013 00014 #include "CSP.hpp" 00015 #include "CSP_var.hpp" 00016 00017 //############################################################################# 00018 00019 class CSP_var; 00020 00021 //############################################################################# 00022 00023 class CSP_tm : public BCP_tm_user { 00024 public: 00025 BCP_parameter_set<CSP_tm_par> tm_par; 00026 BCP_parameter_set<CSP_lp_par> lp_par; 00027 CSPROBLEM* csproblem; 00028 00029 public: 00030 // constructor 00031 CSP_tm() : csproblem(0) {} 00032 00033 //destructor 00034 ~CSP_tm() { 00035 delete csproblem; 00036 } 00037 00038 //========================================================================== 00039 // Here are the user defined functions. For each of them a default is given 00040 // which can be overridden when the concrete user class is defined. 00041 //========================================================================== 00042 00049 virtual void 00050 pack_module_data(BCP_buffer& buf, BCP_process_t ptype); 00051 00059 // *LL* : we use the generic solution, so the default is OK. 00060 // *LL* : otherwise override this AND CSP_lp::pack_feasible_solution() 00061 virtual BCP_solution* 00062 unpack_feasible_solution(BCP_buffer& buf) { 00063 return BCP_tm_user::unpack_feasible_solution(buf); 00064 } 00065 00066 //-------------------------------------------------------------------------- 00076 // *LL* : set packing constraints are the core constraint, no core vars, no 00077 // *LL* : core matrix. 00078 virtual void 00079 initialize_core(BCP_vec<BCP_var_core*>& vars, 00080 BCP_vec<BCP_cut_core*>& cuts, 00081 BCP_lp_relax*& matrix); 00082 //-------------------------------------------------------------------------- 00092 // *LL* : the enumerated vars are the added vars 00093 virtual void 00094 create_root(BCP_vec<BCP_var*>& added_vars, 00095 BCP_vec<BCP_cut*>& added_cuts, 00096 BCP_user_data*& user_data); 00097 00098 //-------------------------------------------------------------------------- 00100 virtual void 00101 display_feasible_solution(const BCP_solution* sol); 00102 00103 //-------------------------------------------------------------------------- 00106 // *LL* : there's just one phase and we want to generate algo vars. 00107 virtual void 00108 init_new_phase(int phase, BCP_column_generation& colgen, 00109 CoinSearchTreeBase*& candidates); 00110 00111 //-------------------------------------------------------------------------- 00119 // *LL* : default is fine 00120 #if 0 00121 virtual bool compare_tree_nodes(const BCP_tm_node* node0, 00122 const BCP_tm_node* node1); 00123 #endif 00124 }; 00125 00126 #endif