00001 //===========================================================================// 00002 // This file is part of the DIP Solver Framework. // 00003 // // 00004 // DIP is distributed under the Eclipse Public License as part of the // 00005 // COIN-OR repository (http://www.coin-or.org). // 00006 // // 00007 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) // 00008 // // 00009 // Conceptual Design: Matthew Galati, SAS Institute Inc. // 00010 // Ted Ralphs, Lehigh University // 00011 // // 00012 // Copyright (C) 2002-2013, Lehigh University, Matthew Galati, Ted Ralphs // 00013 // All Rights Reserved. // 00014 //===========================================================================// 00015 00016 //===========================================================================// 00017 #ifndef AlpsDecompModel_h_ 00018 #define AlpsDecompModel_h_ 00019 00020 //===========================================================================// 00021 #include "Alps.h" 00022 #include "AlpsModel.h" 00023 #include "AlpsDecompParam.h" 00024 00025 00026 //===========================================================================// 00027 #include "DecompAlgo.h" 00028 #include "DecompConstraintSet.h" 00029 00030 //===========================================================================// 00031 #include <string> 00032 00033 //===========================================================================// 00034 class AlpsTreeNode; 00035 00036 //===========================================================================// 00062 //===========================================================================// 00063 00064 //===========================================================================// 00065 class AlpsDecompModel : public AlpsModel { 00066 00067 00068 private: 00069 00070 //----------------------------------------------------------------------// 00075 //----------------------------------------------------------------------// 00079 std::string m_classTag; 00080 00084 AlpsDecompParam m_param; 00085 00089 DecompAlgo* m_decompAlgo; 00090 00094 double m_bestLB; 00095 double m_bestUB; 00096 int m_nodesProcessed; 00097 int m_alpsStatus; 00098 00103 //-----------------------------------------------------------------------// 00108 //-----------------------------------------------------------------------// 00109 public: 00113 AlpsDecompModel() : 00114 AlpsModel (), 00115 m_classTag ("ALPSM"), 00116 m_param (), 00117 m_decompAlgo (NULL) { 00118 } 00119 00120 AlpsDecompModel(UtilParameters& utilParam, 00121 DecompAlgo* decompAlgo) : 00122 AlpsModel (), 00123 m_classTag ("ALPSM"), 00124 m_param (utilParam), 00125 m_decompAlgo(decompAlgo) { 00126 if (decompAlgo == NULL) 00127 throw UtilException("No DecompAlgo algorithm has been set.", 00128 "AlpsDecompModel", "AlpsDecompModel"); 00129 00130 setAlpsSettings(); 00131 } 00132 00136 virtual ~AlpsDecompModel() {} 00142 //-----------------------------------------------------------------------// 00147 //-----------------------------------------------------------------------// 00151 virtual AlpsTreeNode* createRoot(); 00152 00154 virtual bool fathomAllNodes(); 00159 //-----------------------------------------------------------------------// 00164 //-----------------------------------------------------------------------// 00168 AlpsExitStatus solve(); 00169 00173 void setAlpsSettings(); 00174 00178 inline void setDecompAlgo(DecompAlgo* decompAlgo) { 00179 m_decompAlgo = decompAlgo; 00180 } 00185 //-----------------------------------------------------------------------// 00190 //-----------------------------------------------------------------------// 00194 //THINK: return ref? 00195 inline DecompAlgo* getDecompAlgo() { 00196 return m_decompAlgo; 00197 } 00198 00199 inline AlpsDecompParam& getParam() { 00200 return m_param; 00201 } 00202 00203 00207 inline const int getNumCoreRows() const { 00208 return m_decompAlgo->getModelCore().getModel()->getNumRows(); 00209 } 00210 00214 inline const int getNumCoreCols() const { 00215 return m_decompAlgo->getModelCore().getModel()->getNumCols(); 00216 } 00217 00221 inline const std::vector<std::string>& getColNames() const { 00222 return m_decompAlgo->getModelCore().getModel()->getColNames(); 00223 } 00224 00228 inline const std::vector<std::string>& getRowNames() const { 00229 return m_decompAlgo->getModelCore().getModel()->getRowNames(); 00230 } 00231 00235 inline const DecompSolution* getBestSolution() const { 00236 return m_decompAlgo->getXhatIPBest(); 00237 } 00238 00239 const double getGlobalLB() const { 00240 return m_bestLB; 00241 } 00242 const double getGlobalUB() const { 00243 return m_bestUB; 00244 } 00245 const int getSolStatus() const { 00246 return m_alpsStatus; 00247 } 00248 const int getNumNodesProcessed() const { 00249 return m_nodesProcessed; 00250 } 00251 00255 }; 00256 00257 #endif