Dip  0.92.4
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 // Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9 // Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10 // //
11 // Copyright (C) 2002-2019, Lehigh University, Matthew Galati, and Ted Ralphs//
12 // All Rights Reserved. //
13 //===========================================================================//
14 
15 #ifndef MMKPMODEL_INCLUDED
16 #define MMKPMODEL_INCLUDED
17 
18 //===========================================================================//
19 #include "UtilMacros.h"
20 //===========================================================================//
21 #include "DecompConstraintSet.h"
22 //===========================================================================//
23 #include "MMKP_Param.h"
24 #include "MMKP_Instance.h"
25 //===========================================================================//
26 
27 //===========================================================================//
34 //===========================================================================//
35 class MMKP_Model {
36 private:
38  const string m_classTag;
39 
40 
41 public:
42  /* Read data instance. */
43  int readInstance();
44 
45 
46 public:
48  inline const MMKP_Instance & getInstance() const {
49  return m_instance;
50  }
51  inline const MMKP_Param & getParam() const {
52  return m_appParam;
53  }
54  inline const double * getObjective() const {
55  return m_objective;
56  }
57  inline DecompConstraintSet * getModelCore() const {
58  return getModel(m_appParam.ModelNameCore);
59  }
61  return getModel(m_appParam.ModelNameRelax);
62  }
63 
64  inline DecompConstraintSet * getModel(string modelName) const {
65  map<string, DecompConstraintSet*>::const_iterator it;
66  it = m_models.find(modelName);
67  if(it == m_models.end()){
68  cout << "Error: model with name " << modelName << " not defined."
69  << endl;
70  assert(it != m_models.end());
71  return NULL;
72  }
73  return it->second;
74  }
75 
76 public:
80  MMKP_Model(UtilParameters & utilParam) :
81  m_classTag ("MMKP-MOD"),
82  m_objective(NULL ) {
83  //---
84  //--- get application parameters
85  //---
86  m_appParam.getSettings(utilParam);
87  if(m_appParam.LogLevel >= 1)
88  m_appParam.dumpSettings();
89  }
90 
92  UTIL_DELARR(m_objective);
93  UtilDeleteMapPtr(m_models);
94  };
95 };
96 
97 #endif
DecompConstraintSet * getModelRelax() const
Definition: MMKP_Model.h:60
const double * getObjective() const
Definition: MMKP_Model.h:54
int readInstance()
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
MMKP_Model(UtilParameters &utilParam)
Default constructor.
Definition: MMKP_Model.h:80
const MMKP_Instance & getInstance() const
Definition: MMKP_Model.h:48
const string m_classTag
Class id tag (for log / debugging).
Definition: MMKP_Model.h:38
const MMKP_Param & getParam() const
Definition: MMKP_Model.h:51
DecompConstraintSet * getModel(string modelName) const
Definition: MMKP_Model.h:64
DecompConstraintSet * getModelCore() const
Definition: MMKP_Model.h:57
~MMKP_Model()
Default constructor.
Definition: MMKP_Model.h:91
void UtilDeleteMapPtr(std::map< S, T * > &mapPtr, typename std::map< S, T * >::iterator first, typename std::map< S, T * >::iterator last)
Definition: UtilMacros.h:651