OSDipApp.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-2008, Lehigh University, Matthew Galati, and Ted Ralphs//
10 // All Rights Reserved. //
11 //===========================================================================//
12 
13 #ifndef OSDIPAPP_H
14 #define OSDIPAPP_H
15 
16 // --------------------------------------------------------------------- //
17 #include "DecompApp.h"
18 #include "DecompParam.h"
19 
20 // --------------------------------------------------------------------- //
21 #include "OSDipInterface.h"
22 #include "OSDipParam.h"
23 #include "OSDipBlockSolver.h"
24 #include "OSInstance.h"
26 
27 // --------------------------------------------------------------------- //
37 // --------------------------------------------------------------------- //
38 class OSDipApp: public DecompApp {
39 public:
40 
42 
44  std::vector<OSDipBlockSolver* > m_osDipBlockSolver;
45 
47  std::vector<OSInstance* > m_blockOSInstances;
48 
50  std::vector<std::set<int> > m_blockVars;
51 
53  std::set<int> m_blockVarsAll;
54 
56  std::set<int> m_coreConstraintIndexes;
57 
59  std::vector<std::string > m_blockFactories;
60 
62  const std::string m_classTag;
63 
66 
69 
71  double *m_objective;
72 
74  DecompConstraintSet *m_modelC;
75  std::map<int, DecompConstraintSet*> m_modelR;
76 
78  std::map<int, DecompConstraintSet*> m_modelMasterOnly;
79 
81  void initializeApp(UtilParameters & utilParam);
82 
84  void createModels();
85 
86  //this creates the coupling/core constraint set
87  void createModelPart(DecompConstraintSet * model, const int nRowsPart,
88  const int * rowsPart);
89 
90  /* @name Inherited (from virtual) methods. */
91  int generateInitVars(DecompVarList & initVars);
92 
93  void createModelMasterOnlys2(std::vector<int> & masterOnlyCols);
94 
95  /* @name Inherited (from virtual) methods. */
97  DecompSolverStatus solveRelaxed(const int whichBlock,
98  const double * redCostX,
99  const double convexDual,
100  std::list<DecompVar*> & vars);
101 
102 
103  int generateCuts(const double* x, DecompCutList & newCuts);
104 
105  bool APPisUserFeasible(const double* x, const int n_cols,
106  const double tolZero);
107 
109  OSDipApp(UtilParameters & utilParam) :
110  DecompApp(utilParam), m_classTag("OSDip-APP"), m_objective(NULL) {
111  initializeApp(utilParam);
112  }
113 
114  virtual ~OSDipApp() {
115  std::cout << "INSIDE OSDip DECOMP DESTRUCTOR" << std::endl;
116  std::vector<OSDipBlockSolver*>::iterator vit;
117  UTIL_DELARR( m_objective);
118  UTIL_DELPTR( m_modelC);
119  UtilDeleteMapPtr( m_modelR);
120  UtilDeleteMapPtr( m_modelMasterOnly);
121 
122  //garbage collection on the solvers
123  for (vit = m_osDipBlockSolver.begin(); vit
124  != m_osDipBlockSolver.end(); vit++) {
125 
126  delete *vit;
127 
128  }
129  //finally delete the factories
130 
131  delete factoryInit;
132  }
133 
134 
135 
136 
137 
138 
139 };
140 
141 
142 
143 #endif
bool APPisUserFeasible(const double *x, const int n_cols, const double tolZero)
Definition: OSDipApp.cpp:720
DecompConstraintSet * m_modelC
The model constraint systems used for different algos.
Definition: OSDipApp.h:74
std::map< int, DecompConstraintSet * > m_modelR
Definition: OSDipApp.h:75
const std::string m_classTag
Class id tag (for log / debugging).
Definition: OSDipApp.h:62
void createModelMasterOnlys2(std::vector< int > &masterOnlyCols)
Definition: OSDipApp.cpp:404
std::vector< OSDipBlockSolver * > m_osDipBlockSolver
m_osDipBlockSolver is a vector OSDipBlockSolvers
Definition: OSDipApp.h:44
OSDipParam m_appParam
Application specific parameters.
Definition: OSDipApp.h:68
void initializeApp(UtilParameters &utilParam)
Initialize application.
Definition: OSDipApp.cpp:23
void createModels()
Create model parts.
Definition: OSDipApp.cpp:293
std::set< int > m_blockVarsAll
m_blockVarsAll is the set of all variables that appear in a block
Definition: OSDipApp.h:53
std::map< int, DecompConstraintSet * > m_modelMasterOnly
The model constraint system used master only vars.
Definition: OSDipApp.h:78
OSDipApp(UtilParameters &utilParam)
Default constructor.
Definition: OSDipApp.h:109
void createModelPart(DecompConstraintSet *model, const int nRowsPart, const int *rowsPart)
Definition: OSDipApp.cpp:197
std::vector< OSInstance * > m_blockOSInstances
m_blockOSInstances is a vector with an osinstance for each block
Definition: OSDipApp.h:47
double * m_objective
The model objective coefficients (original space).
Definition: OSDipApp.h:71
int generateCuts(const double *x, DecompCutList &newCuts)
Definition: OSDipApp.cpp:709
OS_DipInterface m_osInterface
the OS interface
Definition: OSDipApp.h:65
std::vector< std::set< int > > m_blockVars
m_blockVars is a vector with the set of variables for each block
Definition: OSDipApp.h:50
DecompSolverStatus solveRelaxed(const int whichBlock, const double *redCostX, const double convexDual, std::list< DecompVar * > &vars)
Solve the relaxed problem.
Definition: OSDipApp.cpp:590
std::set< int > m_coreConstraintIndexes
m_coreConstraintIndexes is the set core constraint indexes
Definition: OSDipApp.h:56
OSDipFactoryInitializer * factoryInit
Definition: OSDipApp.h:41
int generateInitVars(DecompVarList &initVars)
Definition: OSDipApp.cpp:457
std::vector< std::string > m_blockFactories
m_blockFactories is a vector solver factory for each block
Definition: OSDipApp.h:59
virtual ~OSDipApp()
Definition: OSDipApp.h:114
void fint fint fint real fint real * x