DecompApp.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef DECOMP_APP_INCLUDED
00015 #define DECOMP_APP_INCLUDED
00016
00017
00018 #include "UtilParameters.h"
00019 #include "DecompParam.h"
00020 #include "DecompModel.h"
00021 #include "DecompSolution.h"
00022 #include "DecompConstraintSet.h"
00023
00024
00041
00042 class DecompApp {
00043
00044 private:
00048 DecompApp(const DecompApp&);
00049 DecompApp& operator=(const DecompApp&);
00050
00051 private:
00055 static const char* m_classTag;
00056
00057 protected:
00061 ostream* m_osLog;
00062
00063 public:
00067 DecompParam m_param;
00068
00072 DecompModel m_model;
00073 map<int, DecompConstraintSet*> m_modelCore;
00074 map<int, DecompConstraintSet*> m_modelRelax;
00075
00076 public:
00077
00081 void startupLog();
00082
00083
00084
00085
00086
00087 int createModel();
00088
00089
00090 virtual void APPcreateModel(double *& objCoeff,
00091 map<int, DecompConstraintSet*> & modelCore,
00092 map<int, DecompConstraintSet*> & modelRelax) = 0;
00093
00094
00095 virtual bool APPisUserFeasible(const double* x,
00096 const int n_cols,
00097 const double tolZero) {
00098 return true;
00099 };
00100
00101 virtual int APPheuristics(const double* xhat,
00102 vector<DecompSolution*> & xhatIPFeas) {
00103 return 1;
00104 }
00105
00106 virtual int generateInitVars(DecompVarList& initVars,
00107 int whichModel);
00108
00109
00110 virtual int generateCuts(const double* x,
00111 const DecompConstraintSet& modelCore,
00112 const DecompConstraintSet& modelRelax,
00113 DecompCutList& newCuts);
00114
00115 virtual decompStat APPsolveRelaxed(const int whichModel,
00116 const double* redCostX,
00117 const double* origCost,
00118 const double alpha,
00119 const int n_origCols,
00120 const bool checkRC,
00121 const bool checkDup,
00122 OsiSolverInterface* m_subprobSI,
00123 list<DecompVar*> & vars) {
00124 return STAT_UNKNOWN;
00125 }
00126
00127
00128 virtual void printOriginalColumn(const int index,
00129 ostream* os = &cout) const;
00130
00131 virtual void printOriginalSolution(const int n_cols,
00132 const double* solution,
00133 ostream* os = &cout) const;
00134
00135
00136 public:
00137 DecompApp(UtilParameters& utilParam) :
00138 m_osLog(&cout),
00139 m_param(),
00140 m_model(),
00141 m_modelCore(),
00142 m_modelRelax() {
00143 m_param.getSettings(utilParam);
00144 startupLog();
00145 };
00146 virtual ~DecompApp() {
00147 map<int, DecompConstraintSet*>::iterator it;
00148
00149 for (it = m_modelCore.begin(); it != m_modelCore.end(); it++) {
00150 UTIL_DELPTR(it->second);
00151 }
00152
00153 for (it = m_modelRelax.begin(); it != m_modelRelax.end(); it++) {
00154 UTIL_DELPTR(it->second);
00155 }
00156 };
00157 };
00158
00159 #endif