Dip-All  0.91.0
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 // 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 GAP_DECOMPAPP3_INCLUDED
14 #define GAP_DECOMPAPP3_INCLUDED
15 
16 //===========================================================================//
17 //---
18 //--- Version 3:
19 //--- for relaxation solver, use built-in MILP solver and dense format
20 //--- Version 4:
21 //--- for relaxation solver, use built-in MILP solver and sparse format
22 //---
23 //===========================================================================//
24 
25 
26 //===========================================================================//
27 #include "DecompApp.h"
28 
29 //===========================================================================//
30 #include "GAP_Instance.h"
31 #include "GAP_DecompParam.h"
32 
33 //===========================================================================//
44 //===========================================================================//
45 class GAP_DecompApp : public DecompApp {
46 private:
48  const string m_classTag;
49 
52 
55 
57  double* m_objective;
58 
61  vector<DecompConstraintSet*> m_models;
62 
63 
64 public:
65  /* @name Inherited (from virtual) methods. */
67  void printOriginalColumn(const int index,
68  ostream* os = &cout) const;
69 
70 public:
74  void initializeApp(UtilParameters& utilParam);
75 
77  inline const int getOffsetI(const int i) const {
78  return i * m_instance.getNTasks();
79  }
80  inline const int getIndexIJ(const int i,
81  const int j) const {
82  return (i * m_instance.getNTasks()) + j;
83  }
84 
85  inline pair<int, int> getIndexInv(const int index) const {
86  return make_pair(index / m_instance.getNTasks(),
87  index % m_instance.getNTasks());
88  }
89 
91  int createModels();
95  int whichKnap);
97  vector<int>& whichKnaps);
98 
99 public:
101  inline const GAP_Instance& getInstance() const {
102  return m_instance;
103  }
104  inline const GAP_DecompParam& getParam() const {
105  return m_appParam;
106  }
107  inline const double* getObjective() const {
108  return m_objective;
109  }
110 
111 public:
116  DecompApp (utilParam),
117  m_classTag ("GAP-APP"),
118  m_objective (NULL) {
119  initializeApp(utilParam);
120  }
121 
122  virtual ~GAP_DecompApp() {
125  };
126 };
127 
128 #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:61
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:45
int createModelPartKP(DecompConstraintSet *model)
Guts of constructor.
void initializeApp(UtilParameters &utilParam)
Guts of constructor.
GAP_Instance m_instance
GAP problem instance data.
Definition: GAP_DecompApp.h:42
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:55
int createModels()
TODO comment.
int createModelPartAP(DecompConstraintSet *model)
Guts of constructor.
double * m_objective
The model objective coefficients (original space).
Definition: GAP_DecompApp.h:51
const string m_classTag
Class id tag (for log / debugging).
Definition: GAP_DecompApp.h:39
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:50