- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/ApplicationTemplates/osDip/OSDipApp.h

Go to the documentation of this file.

    00001 //===========================================================================//
    00002 // This file is part of the Decomp Solver Framework.                         //
    00003 //                                                                           //
    00004 // Decomp is distributed under the Common Public License as part of the      //
    00005 // COIN-OR repository (http://www.coin-or.org).                              //
    00006 //                                                                           //
    00007 // Author: Matthew Galati, Lehigh University                                 //
    00008 //                                                                           //
    00009 // Copyright (C) 2002-2008, Lehigh University, Matthew Galati, and Ted Ralphs//
    00010 // All Rights Reserved.                                                      //
    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 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         map<int, DecompConstraintSet*> m_modelR;
    00076
    00078         map<int, DecompConstraintSet*> m_modelMasterOnly;
    00079
    00081         void initializeApp(UtilParameters & utilParam);
    00082
    00084         void createModels();
    00085
    00086         //this creates the coupling/core constraint set
    00087         void createModelPart(DecompConstraintSet * model, const int nRowsPart,
    00088                         const int * rowsPart);
    00089
    00090         /* @name Inherited (from virtual) methods. */
    00091         int generateInitVars(DecompVarList & initVars);
    00092
    00093         void createModelMasterOnlys2(vector<int> & masterOnlyCols);
    00094
    00095            /* @name Inherited (from virtual) methods. */
    00097            DecompSolverStatus solveRelaxed(const int             whichBlock,
    00098                                            const double        * redCostX,
    00099                                            const double          convexDual,
    00100                                            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                 //garbage collection on the solvers
    00123                 for (vit = m_osDipBlockSolver.begin(); vit
    00124                                 != m_osDipBlockSolver.end(); vit++) {
    00125
    00126                                 delete *vit;
    00127
    00128                 }
    00129                 //finally delete the factories
    00130
    00131                 delete factoryInit;
    00132         }
    00133
    00134
    00135
    00136
    00137
    00138
    00139 };
    00140
    00141
    00142
    00143 #endif