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_;} 00166 inline void setPresolveActions(int action) 00167 { presolveActions_ = (presolveActions_&0xffff0000)|(action&0xffff);} 00168 00169 private: 00174 OsiSolverInterface * originalModel_; 00175 00180 OsiSolverInterface * presolvedModel_; 00181 00187 double nonLinearValue_; 00188 00190 int * originalColumn_; 00191 00193 int * originalRow_; 00194 00196 const CoinPresolveAction *paction_; 00197 00204 int ncols_; 00205 00207 int nrows_; 00208 00210 CoinBigIndex nelems_; 00211 00217 int presolveActions_; 00219 int numberPasses_; 00220 00221 protected: 00230 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob); 00231 00242 virtual void postsolve(CoinPostsolveMatrix &prob); 00243 00250 void gutsOfDestroy(); 00251 }; 00252 #endif