Dip  0.92.4
GAP_DecompApp3.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 GAP_DECOMPAPP3_INCLUDED
16 #define GAP_DECOMPAPP3_INCLUDED
17 
18 //===========================================================================//
19 //---
20 //--- Version 3:
21 //--- for relaxation solver, use built-in MILP solver and dense format
22 //--- Version 4:
23 //--- for relaxation solver, use built-in MILP solver and sparse format
24 //---
25 //===========================================================================//
26 
27 
28 //===========================================================================//
29 #include "DecompApp.h"
30 
31 //===========================================================================//
32 #include "GAP_Instance.h"
33 #include "GAP_DecompParam.h"
34 
35 //===========================================================================//
46 //===========================================================================//
47 class GAP_DecompApp : public DecompApp {
48 private:
50  const string m_classTag;
51 
54 
57 
59  double* m_objective;
60 
63  vector<DecompConstraintSet*> m_models;
64 
65 
66 public:
67  /* @name Inherited (from virtual) methods. */
69  void printOriginalColumn(const int index,
70  ostream* os = &cout) const;
71 
72 public:
76  void initializeApp(UtilParameters& utilParam);
77 
79  inline const int getOffsetI(const int i) const {
80  return i * m_instance.getNTasks();
81  }
82  inline const int getIndexIJ(const int i,
83  const int j) const {
84  return (i * m_instance.getNTasks()) + j;
85  }
86 
87  inline pair<int, int> getIndexInv(const int index) const {
88  return make_pair(index / m_instance.getNTasks(),
89  index % m_instance.getNTasks());
90  }
91 
93  int createModels();
97  int whichKnap);
99  vector<int>& whichKnaps);
100 
101 public:
103  inline const GAP_Instance& getInstance() const {
104  return m_instance;
105  }
106  inline const GAP_DecompParam& getParam() const {
107  return m_appParam;
108  }
109  inline const double* getObjective() const {
110  return m_objective;
111  }
112 
113 public:
118  DecompApp (utilParam),
119  m_classTag ("GAP-APP"),
120  m_objective (NULL) {
121  initializeApp(utilParam);
122  }
123 
124  virtual ~GAP_DecompApp() {
127  };
128 };
129 
130 #endif
void UtilDeleteVectorPtr(vector< T * > &vectorPtr, typename vector< T * >::iterator first, typename vector< T * >::iterator last)
Definition: UtilMacros.h:288
const int getIndexIJ(const int i, const int j) const
Guts of constructor.
vector< DecompConstraintSet * > m_models
Store pointers to the various model constraint systems, so their memory can be deleted.
const int getNTasks() const
Definition: GAP_Instance.h:63
void printOriginalColumn(const int index, ostream *os=&cout) const
Print an original column (format for this app).
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
const GAP_Instance & getInstance() const
Some access methods to private data.
virtual ~GAP_DecompApp()
Default constructor.
const double * getObjective() const
Guts of constructor.
GAP_DecompParam m_appParam
Application specific parameters.
Definition: GAP_DecompApp.h:47
int createModelPartKP(DecompConstraintSet *model)
Guts of constructor.
GAP_Instance m_instance
GAP problem instance data.
Definition: GAP_DecompApp.h:44
GAP_DecompApp(UtilParameters &utilParam)
Default constructor.
const int getOffsetI(const int i) const
Helper methods for indexing.
map< string, DecompConstraintSet * > m_models
The various model constraint systems used for different algorithms, keyed by a unique string (model n...
Definition: GAP_DecompApp.h:57
int createModels()
TODO comment.
int createModelPartAP(DecompConstraintSet *model)
Guts of constructor.
double * m_objective
The model objective coefficients (original space).
Definition: GAP_DecompApp.h:53
const string m_classTag
Class id tag (for log / debugging).
Definition: GAP_DecompApp.h:41
const GAP_DecompParam & getParam() const
Guts of constructor.
pair< int, int > getIndexInv(const int index) const
Guts of constructor.
The main application class.
Definition: DecompApp.h:48
void initializeApp()
Guts of constructor.