MMKP_Model.h

Go to the documentation of this file.
00001 //===========================================================================//
00002 // This file is part of the Decomp Solver Framework.                         //
00003 //                                                                           //
00004 // Decomp is distributed under the Common Public License as part of the      //
00005 // COIN-OR repository (http://www.coin-or.org).                              //
00006 //                                                                           //
00007 // Author: Matthew Galati, Lehigh University                                 //
00008 //                                                                           //
00009 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, and Ted Ralphs//
00010 // All Rights Reserved.                                                      //
00011 //===========================================================================//
00012 
00013 #ifndef MMKPMODEL_INCLUDED
00014 #define MMKPMODEL_INCLUDED
00015 
00016 //===========================================================================//
00017 #include "UtilMacros.h"
00018 //===========================================================================//
00019 #include "DecompConstraintSet.h"
00020 //===========================================================================//
00021 #include "MMKP_Param.h"
00022 #include "MMKP_Instance.h"
00023 //===========================================================================//
00024 
00025 //===========================================================================//
00032 //===========================================================================//
00033 class MMKP_Model {
00034 private:
00036    const string m_classTag;
00037 
00038    
00039 public:
00040    /* Read data instance. */
00041    int readInstance();
00042 
00043 
00044 public:
00046    inline const MMKP_Instance & getInstance() const {
00047       return m_instance;
00048    }
00049    inline const MMKP_Param & getParam() const {
00050       return m_appParam;
00051    }
00052    inline const double * getObjective() const {
00053       return m_objective;
00054    }
00055    inline DecompConstraintSet * getModelCore() const {
00056       return getModel(m_appParam.ModelNameCore);
00057    }
00058    inline DecompConstraintSet * getModelRelax() const {
00059       return getModel(m_appParam.ModelNameRelax);
00060    }
00061 
00062    inline DecompConstraintSet * getModel(string modelName) const {
00063       map<string, DecompConstraintSet*>::const_iterator it;
00064       it = m_models.find(modelName);
00065       if(it == m_models.end()){
00066          cout << "Error: model with name " << modelName << " not defined."
00067               << endl;
00068          assert(it != m_models.end());
00069          return NULL;
00070       }
00071       return it->second;
00072    }
00073    
00074 public:
00078    MMKP_Model(UtilParameters & utilParam) : 
00079       m_classTag ("MMKP-MOD"),
00080       m_objective(NULL      ) {
00081       //---
00082       //--- get application parameters
00083       //---
00084       m_appParam.getSettings(utilParam);
00085       if(m_appParam.LogLevel >= 1)
00086          m_appParam.dumpSettings(); 
00087    }
00088    
00089    ~MMKP_Model() {
00090       UTIL_DELARR(m_objective);
00091       UtilDeleteMapPtr(m_models);
00092    };
00093 };
00094 
00095 #endif

Generated on 5 Apr 2015 for Dip-All by  doxygen 1.6.1