Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef ClpPresolve_H
00006 #define ClpPresolve_H
00007 #include "ClpSimplex.hpp"
00008
00009 class CoinPresolveAction;
00010 #include "CoinPresolveMatrix.hpp"
00014 class ClpPresolve {
00015 public:
00018
00019 ClpPresolve();
00020
00022 virtual ~ClpPresolve();
00024
00040 ClpSimplex * presolvedModel(ClpSimplex & si,
00041 double feasibilityTolerance=0.0,
00042 bool keepIntegers=true,
00043 int numberPasses=5,
00044 bool dropNames=false,
00045 bool doRowObjective=false);
00046 #ifndef CLP_NO_STD
00047
00050 int presolvedModelToFile(ClpSimplex &si,std::string fileName,
00051 double feasibilityTolerance=0.0,
00052 bool keepIntegers=true,
00053 int numberPasses=5,
00054 bool doRowObjective=false);
00055 #endif
00056
00058 ClpSimplex * model() const;
00060 ClpSimplex * originalModel() const;
00062 void setOriginalModel(ClpSimplex * model);
00063
00065 const int * originalColumns() const;
00067 const int * originalRows() const;
00072 inline void setNonLinearValue(double value)
00073 { nonLinearValue_ = value;}
00074 inline double nonLinearValue() const
00075 { return nonLinearValue_;}
00077 inline bool doDual() const
00078 { return (presolveActions_&1)==0;}
00079 inline void setDoDual(bool doDual)
00080 { if (doDual) presolveActions_ &= ~1; else presolveActions_ |= 1;}
00082 inline bool doSingleton() const
00083 { return (presolveActions_&2)==0;}
00084 inline void setDoSingleton(bool doSingleton)
00085 { if (doSingleton) presolveActions_ &= ~2; else presolveActions_ |= 2;}
00087 inline bool doDoubleton() const
00088 { return (presolveActions_&4)==0;}
00089 inline void setDoDoubleton(bool doDoubleton)
00090 { if (doDoubleton) presolveActions_ &= ~4; else presolveActions_ |= 4;}
00092 inline bool doTripleton() const
00093 { return (presolveActions_&8)==0;}
00094 inline void setDoTripleton(bool doTripleton)
00095 { if (doTripleton) presolveActions_ &= ~8; else presolveActions_ |= 8;}
00097 inline bool doTighten() const
00098 { return (presolveActions_&16)==0;}
00099 inline void setDoTighten(bool doTighten)
00100 { if (doTighten) presolveActions_ &= ~16; else presolveActions_ |= 16;}
00102 inline bool doForcing() const
00103 { return (presolveActions_&32)==0;}
00104 inline void setDoForcing(bool doForcing)
00105 { if (doForcing) presolveActions_ &= ~32; else presolveActions_ |= 32;}
00107 inline bool doImpliedFree() const
00108 { return (presolveActions_&64)==0;}
00109 inline void setDoImpliedFree(bool doImpliedfree)
00110 { if (doImpliedfree) presolveActions_ &= ~64; else presolveActions_ |= 64;}
00112 inline bool doDupcol() const
00113 { return (presolveActions_&128)==0;}
00114 inline void setDoDupcol(bool doDupcol)
00115 { if (doDupcol) presolveActions_ &= ~128; else presolveActions_ |= 128;}
00117 inline bool doDuprow() const
00118 { return (presolveActions_&256)==0;}
00119 inline void setDoDuprow(bool doDuprow)
00120 { if (doDuprow) presolveActions_ &= ~256; else presolveActions_ |= 256;}
00122 inline bool doSingletonColumn() const
00123 { return (presolveActions_&512)==0;}
00124 inline void setDoSingletonColumn(bool doSingleton)
00125 { if (doSingleton) presolveActions_ &= ~512; else presolveActions_ |= 512;}
00127 inline bool doGubrow() const
00128 { return (presolveActions_&1024)==0;}
00129 inline void setDoGubrow(bool doGubrow)
00130 { if (doGubrow) presolveActions_ &= ~1024; else presolveActions_ |= 1024;}
00132 inline int presolveActions() const
00133 { return presolveActions_&0xffff;}
00134 inline void setPresolveActions(int action)
00135 { presolveActions_ = (presolveActions_&0xffff0000)|(action&0xffff);}
00137 inline void setSubstitution(int value)
00138 { substitution_=value;}
00140 inline void statistics()
00141 { presolveActions_ |= 0x80000000;}
00142
00151 virtual void postsolve(bool updateStatus=true);
00152
00154 void destroyPresolve();
00155
00157 private:
00159 ClpSimplex * originalModel_;
00160
00162 ClpSimplex * presolvedModel_;
00168 double nonLinearValue_;
00170 int * originalColumn_;
00172 int * originalRow_;
00174 double * rowObjective_;
00176 const CoinPresolveAction *paction_;
00177
00183 int ncols_;
00184 int nrows_;
00185 CoinBigIndex nelems_;
00187 int numberPasses_;
00189 int substitution_;
00190 #ifndef CLP_NO_STD
00191
00192 std::string saveFile_;
00193 #endif
00194
00198 int presolveActions_;
00199 protected:
00203 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
00204
00210 virtual void postsolve(CoinPostsolveMatrix &prob);
00212 virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
00213 double feasibilityTolerance,
00214 bool keepIntegers,
00215 int numberPasses,
00216 bool dropNames,
00217 bool doRowObjective);
00218 };
00219 #endif