00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef OSDIPAPP_H
00014 #define OSDIPAPP_H
00015
00016
00017 #include "DecompApp.h"
00018 #include "DecompParam.h"
00019
00020
00021 #include "OSDipInterface.h"
00022 #include "OSDipParam.h"
00023 #include "OSDipBlockSolver.h"
00024 #include "OSInstance.h"
00025 #include "OSDipFactoryInitializer.h"
00026
00027
00037
00038 class OSDipApp: public DecompApp {
00039 public:
00040
00041 OSDipFactoryInitializer *factoryInit;
00042
00044 std::vector<OSDipBlockSolver* > m_osDipBlockSolver;
00045
00047 std::vector<OSInstance* > m_blockOSInstances;
00048
00050 std::vector<std::set<int> > m_blockVars;
00051
00053 std::set<int> m_blockVarsAll;
00054
00056 std::set<int> m_coreConstraintIndexes;
00057
00059 std::vector<std::string > m_blockFactories;
00060
00062 const std::string m_classTag;
00063
00065 OS_DipInterface m_osInterface;
00066
00068 OSDipParam m_appParam;
00069
00071 double *m_objective;
00072
00074 DecompConstraintSet *m_modelC;
00075 std::map<int, DecompConstraintSet*> m_modelR;
00076
00078 std::map<int, DecompConstraintSet*> m_modelMasterOnly;
00079
00081 void initializeApp(UtilParameters & utilParam);
00082
00084 void createModels();
00085
00086
00087 void createModelPart(DecompConstraintSet * model, const int nRowsPart,
00088 const int * rowsPart);
00089
00090
00091 int generateInitVars(DecompVarList & initVars);
00092
00093 void createModelMasterOnlys2(std::vector<int> & masterOnlyCols);
00094
00095
00097 DecompSolverStatus solveRelaxed(const int whichBlock,
00098 const double * redCostX,
00099 const double convexDual,
00100 std::list<DecompVar*> & vars);
00101
00102
00103 int generateCuts(const double* x, DecompCutList & newCuts);
00104
00105 bool APPisUserFeasible(const double* x, const int n_cols,
00106 const double tolZero);
00107
00109 OSDipApp(UtilParameters & utilParam) :
00110 DecompApp(utilParam), m_classTag("OSDip-APP"), m_objective(NULL) {
00111 initializeApp(utilParam);
00112 }
00113
00114 virtual ~OSDipApp() {
00115 std::cout << "INSIDE OSDip DECOMP DESTRUCTOR" << std::endl;
00116 std::vector<OSDipBlockSolver*>::iterator vit;
00117 UTIL_DELARR( m_objective);
00118 UTIL_DELPTR( m_modelC);
00119 UtilDeleteMapPtr( m_modelR);
00120 UtilDeleteMapPtr( m_modelMasterOnly);
00121
00122
00123 for (vit = m_osDipBlockSolver.begin(); vit
00124 != m_osDipBlockSolver.end(); vit++) {
00125
00126 delete *vit;
00127
00128 }
00129
00130
00131 delete factoryInit;
00132 }
00133
00134
00135
00136
00137
00138
00139 };
00140
00141
00142
00143 #endif