Dip-All  0.91.0
MMKP_Model.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the Decomp Solver Framework. //
3 // //
4 // Decomp is distributed under the Common Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Author: Matthew Galati, Lehigh University //
8 // //
9 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, and Ted Ralphs//
10 // All Rights Reserved. //
11 //===========================================================================//
12 
13 #ifndef MMKPMODEL_INCLUDED
14 #define MMKPMODEL_INCLUDED
15 
16 //===========================================================================//
17 #include "UtilMacros.h"
18 //===========================================================================//
19 #include "DecompConstraintSet.h"
20 //===========================================================================//
21 #include "MMKP_Param.h"
22 #include "MMKP_Instance.h"
23 //===========================================================================//
24 
25 //===========================================================================//
32 //===========================================================================//
33 class MMKP_Model {
34 private:
36  const string m_classTag;
37 
38 
39 public:
40  /* Read data instance. */
41  int readInstance();
42 
43 
44 public:
46  inline const MMKP_Instance & getInstance() const {
47  return m_instance;
48  }
49  inline const MMKP_Param & getParam() const {
50  return m_appParam;
51  }
52  inline const double * getObjective() const {
53  return m_objective;
54  }
55  inline DecompConstraintSet * getModelCore() const {
56  return getModel(m_appParam.ModelNameCore);
57  }
59  return getModel(m_appParam.ModelNameRelax);
60  }
61 
62  inline DecompConstraintSet * getModel(string modelName) const {
63  map<string, DecompConstraintSet*>::const_iterator it;
64  it = m_models.find(modelName);
65  if(it == m_models.end()){
66  cout << "Error: model with name " << modelName << " not defined."
67  << endl;
68  assert(it != m_models.end());
69  return NULL;
70  }
71  return it->second;
72  }
73 
74 public:
78  MMKP_Model(UtilParameters & utilParam) :
79  m_classTag ("MMKP-MOD"),
80  m_objective(NULL ) {
81  //---
82  //--- get application parameters
83  //---
84  m_appParam.getSettings(utilParam);
85  if(m_appParam.LogLevel >= 1)
86  m_appParam.dumpSettings();
87  }
88 
90  UTIL_DELARR(m_objective);
91  UtilDeleteMapPtr(m_models);
92  };
93 };
94 
95 #endif
DecompConstraintSet * getModelRelax() const
Definition: MMKP_Model.h:58
const double * getObjective() const
Definition: MMKP_Model.h:52
int readInstance()
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
MMKP_Model(UtilParameters &utilParam)
Default constructor.
Definition: MMKP_Model.h:78
const MMKP_Instance & getInstance() const
Definition: MMKP_Model.h:46
const string m_classTag
Class id tag (for log / debugging).
Definition: MMKP_Model.h:36
const MMKP_Param & getParam() const
Definition: MMKP_Model.h:49
DecompConstraintSet * getModel(string modelName) const
Definition: MMKP_Model.h:62
DecompConstraintSet * getModelCore() const
Definition: MMKP_Model.h:55
~MMKP_Model()
Default constructor.
Definition: MMKP_Model.h:89
void UtilDeleteMapPtr(std::map< S, T * > &mapPtr, typename std::map< S, T * >::iterator first, typename std::map< S, T * >::iterator last)
Definition: UtilMacros.h:652