DecompApp.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-2007, Lehigh University, Matthew Galati, and Ted Ralphs//
00010 // All Rights Reserved.                                                      //
00011 //===========================================================================//
00012 
00013 
00014 #ifndef DECOMP_APP_INCLUDED
00015 #define DECOMP_APP_INCLUDED
00016 
00017 /*-----------------------------------------------------------------------*/
00018 #include "UtilParameters.h"
00019 #include "DecompParam.h"
00020 #include "DecompModel.h"
00021 #include "DecompSolution.h"
00022 #include "DecompConstraintSet.h"
00023 
00024 /*-----------------------------------------------------------------------*/
00041 /*-----------------------------------------------------------------------*/
00042 class DecompApp {
00043 
00044 private:
00048    DecompApp(const DecompApp&);
00049    DecompApp& operator=(const DecompApp&);
00050 
00051 private:
00055    static const char* m_classTag;
00056 
00057 protected:
00061    ostream* m_osLog;
00062 
00063 public:
00067    DecompParam m_param;
00068 
00072    DecompModel                    m_model;
00073    map<int, DecompConstraintSet*> m_modelCore;
00074    map<int, DecompConstraintSet*> m_modelRelax;
00075 
00076 public:
00077    //set log file
00081    void startupLog();
00082 
00083    //base layer needs to do some kind of check to make sure this actually
00084    //got done - but also nice to have user version... so base createModel
00085    //and user uesrCreateModel() which is pure?, in base userCreateModel
00086    //gets called and checked that it returns good information
00087    int createModel();
00088    //interface method idea of Gardner - so it is very clear
00089    //what they can and cannot override and what they must
00090    virtual void APPcreateModel(double                        *& objCoeff,
00091                                map<int, DecompConstraintSet*> & modelCore,
00092                                map<int, DecompConstraintSet*> & modelRelax) = 0;
00093 
00094    //?
00095    virtual bool APPisUserFeasible(const double* x,
00096                                   const int      n_cols,
00097                                   const double   tolZero) {
00098       return true;
00099    };
00100 
00101    virtual int APPheuristics(const double*              xhat,
00102                              vector<DecompSolution*>  & xhatIPFeas) {
00103       return 1;
00104    }
00105 
00106    virtual int generateInitVars(DecompVarList& initVars,
00107                                 int whichModel);
00108 
00109    //APPgenerateCuts?
00110    virtual int generateCuts(const double*               x,
00111                             const DecompConstraintSet& modelCore,
00112                             const DecompConstraintSet& modelRelax,
00113                             DecompCutList&              newCuts);
00114 
00115    virtual decompStat APPsolveRelaxed(const int             whichModel,
00116                                       const double*         redCostX,
00117                                       const double*         origCost,
00118                                       const double          alpha,
00119                                       const int             n_origCols,
00120                                       const bool            checkRC,
00121                                       const bool            checkDup,
00122                                       OsiSolverInterface*   m_subprobSI,
00123                                       list<DecompVar*>    & vars) {
00124       return STAT_UNKNOWN;
00125    }
00126 
00127 
00128    virtual void printOriginalColumn(const int   index,
00129                                     ostream*    os = &cout) const;
00130 
00131    virtual void printOriginalSolution(const int      n_cols,
00132                                       const double* solution,
00133                                       ostream* os = &cout) const;
00134 
00135    //Cut(this){
00136 public:
00137    DecompApp(UtilParameters& utilParam) :
00138       m_osLog(&cout),
00139       m_param(),
00140       m_model(),
00141       m_modelCore(),
00142       m_modelRelax() {
00143       m_param.getSettings(utilParam);
00144       startupLog();
00145    };
00146    virtual ~DecompApp() {
00147       map<int, DecompConstraintSet*>::iterator it;
00148 
00149       for (it = m_modelCore.begin(); it != m_modelCore.end(); it++) {
00150          UTIL_DELPTR(it->second);
00151       }
00152 
00153       for (it = m_modelRelax.begin(); it != m_modelRelax.end(); it++) {
00154          UTIL_DELPTR(it->second);
00155       }
00156    };
00157 };
00158 
00159 #endif

Generated on 5 Apr 2015 for Dip-All by  doxygen 1.6.1