00001 // Copyright (C) 2003, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 00004 #ifndef OsiPresolve_H 00005 #define OsiPresolve_H 00006 #include "OsiSolverInterface.hpp" 00007 00008 class CoinPresolveAction; 00009 #include "CoinPresolveMatrix.hpp" 00010 00011 00061 class OsiPresolve { 00062 public: 00064 OsiPresolve(); 00065 00067 virtual ~OsiPresolve(); 00068 00089 virtual OsiSolverInterface *presolvedModel(OsiSolverInterface & origModel, 00090 double feasibilityTolerance=0.0, 00091 bool keepIntegers=true, 00092 int numberPasses=5, 00093 const char * prohibited=NULL, 00094 bool doStatus=true, 00095 const char * rowProhibited=NULL); 00096 00114 virtual void postsolve(bool updateStatus=true); 00115 00117 OsiSolverInterface * model() const; 00118 00120 OsiSolverInterface * originalModel() const; 00121 00123 void setOriginalModel(OsiSolverInterface *model); 00124 00126 const int * originalColumns() const; 00127 00129 const int * originalRows() const; 00130 00132 inline int getNumRows() const 00133 { return nrows_;} 00134 00136 inline int getNumCols() const 00137 { return ncols_;} 00138 00143 inline void setNonLinearValue(double value) 00144 { nonLinearValue_ = value;} 00145 inline double nonLinearValue() const 00146 { return nonLinearValue_;} 00156 inline void setPresolveActions(int action) 00157 { presolveActions_ = (presolveActions_&0xffff0000)|(action&0xffff);} 00158 00159 private: 00164 OsiSolverInterface * originalModel_; 00165 00170 OsiSolverInterface * presolvedModel_; 00171 00177 double nonLinearValue_; 00178 00180 int * originalColumn_; 00181 00183 int * originalRow_; 00184 00186 const CoinPresolveAction *paction_; 00187 00194 int ncols_; 00195 00197 int nrows_; 00198 00200 CoinBigIndex nelems_; 00201 00207 int presolveActions_; 00209 int numberPasses_; 00210 00211 protected: 00220 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob); 00221 00232 virtual void postsolve(CoinPostsolveMatrix &prob); 00233 00240 void gutsOfDestroy(); 00241 }; 00242 #endif