Osi trunk
|
00001 // Copyright (C) 2003, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 // This code is licensed under the terms of the Eclipse Public License (EPL). 00004 00005 #ifndef OsiPresolve_H 00006 #define OsiPresolve_H 00007 #include "OsiSolverInterface.hpp" 00008 00009 class CoinPresolveAction; 00010 #include "CoinPresolveMatrix.hpp" 00011 00012 00062 class OsiPresolve { 00063 public: 00065 OsiPresolve(); 00066 00068 virtual ~OsiPresolve(); 00069 00090 virtual OsiSolverInterface *presolvedModel(OsiSolverInterface & origModel, 00091 double feasibilityTolerance=0.0, 00092 bool keepIntegers=true, 00093 int numberPasses=5, 00094 const char * prohibited=NULL, 00095 bool doStatus=true, 00096 const char * rowProhibited=NULL); 00097 00115 virtual void postsolve(bool updateStatus=true); 00116 00118 OsiSolverInterface * model() const; 00119 00121 OsiSolverInterface * originalModel() const; 00122 00124 void setOriginalModel(OsiSolverInterface *model); 00125 00127 const int * originalColumns() const; 00128 00130 const int * originalRows() const; 00131 00133 inline int getNumRows() const 00134 { return nrows_;} 00135 00137 inline int getNumCols() const 00138 { return ncols_;} 00139 00144 inline void setNonLinearValue(double value) 00145 { nonLinearValue_ = value;} 00146 inline double nonLinearValue() const 00147 { return nonLinearValue_;} 00157 inline void setPresolveActions(int action) 00158 { presolveActions_ = (presolveActions_&0xffff0000)|(action&0xffff);} 00159 00160 private: 00165 OsiSolverInterface * originalModel_; 00166 00171 OsiSolverInterface * presolvedModel_; 00172 00178 double nonLinearValue_; 00179 00181 int * originalColumn_; 00182 00184 int * originalRow_; 00185 00187 const CoinPresolveAction *paction_; 00188 00195 int ncols_; 00196 00198 int nrows_; 00199 00201 CoinBigIndex nelems_; 00202 00208 int presolveActions_; 00210 int numberPasses_; 00211 00212 protected: 00221 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob); 00222 00233 virtual void postsolve(CoinPostsolveMatrix &prob); 00234 00241 void gutsOfDestroy(); 00242 }; 00243 #endif