- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Cgl-0.52.0/Clp/src/ClpPresolve.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2002, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003
    00004 #ifndef ClpPresolve_H
    00005 #define ClpPresolve_H
    00006 #include "ClpSimplex.hpp"
    00007
    00008 class CoinPresolveAction;
    00009 #include "CoinPresolveMatrix.hpp"
    00013 class ClpPresolve {
    00014 public:
    00017
    00018   ClpPresolve();
    00019
    00021   virtual ~ClpPresolve();
    00023
    00039   ClpSimplex * presolvedModel(ClpSimplex & si,
    00040                               double feasibilityTolerance=0.0,
    00041                               bool keepIntegers=true,
    00042                               int numberPasses=5,
    00043                               bool dropNames=false,
    00044                               bool doRowObjective=false);
    00045 #ifndef CLP_NO_STD
    00046
    00049   int presolvedModelToFile(ClpSimplex &si,std::string fileName,
    00050                            double feasibilityTolerance=0.0,
    00051                            bool keepIntegers=true,
    00052                            int numberPasses=5,
    00053                            bool doRowObjective=false);
    00054 #endif
    00055
    00057   ClpSimplex * model() const;
    00059   ClpSimplex * originalModel() const;
    00061   void setOriginalModel(ClpSimplex * model);
    00062
    00064   const int * originalColumns() const;
    00066   const int * originalRows() const;
    00071   inline void setNonLinearValue(double value)
    00072   { nonLinearValue_ = value;}
    00073   inline double nonLinearValue() const
    00074     { return nonLinearValue_;}
    00076   inline bool doDual() const
    00077   { return (presolveActions_&1)==0;}
    00078   inline void setDoDual(bool doDual)
    00079   { if (doDual) presolveActions_  &= ~1; else presolveActions_ |= 1;}
    00081   inline bool doSingleton() const
    00082   { return (presolveActions_&2)==0;}
    00083   inline void setDoSingleton(bool doSingleton)
    00084   { if (doSingleton) presolveActions_  &= ~2; else presolveActions_ |= 2;}
    00086   inline bool doDoubleton() const
    00087   { return (presolveActions_&4)==0;}
    00088   inline void setDoDoubleton(bool doDoubleton)
    00089   { if (doDoubleton) presolveActions_  &= ~4; else presolveActions_ |= 4;}
    00091   inline bool doTripleton() const
    00092   { return (presolveActions_&8)==0;}
    00093   inline void setDoTripleton(bool doTripleton)
    00094   { if (doTripleton) presolveActions_  &= ~8; else presolveActions_ |= 8;}
    00096   inline bool doTighten() const
    00097   { return (presolveActions_&16)==0;}
    00098   inline void setDoTighten(bool doTighten)
    00099   { if (doTighten) presolveActions_  &= ~16; else presolveActions_ |= 16;}
    00101   inline bool doForcing() const
    00102   { return (presolveActions_&32)==0;}
    00103   inline void setDoForcing(bool doForcing)
    00104   { if (doForcing) presolveActions_  &= ~32; else presolveActions_ |= 32;}
    00106   inline bool doImpliedFree() const
    00107   { return (presolveActions_&64)==0;}
    00108   inline void setDoImpliedFree(bool doImpliedfree)
    00109   { if (doImpliedfree) presolveActions_  &= ~64; else presolveActions_ |= 64;}
    00111   inline bool doDupcol() const
    00112   { return (presolveActions_&128)==0;}
    00113   inline void setDoDupcol(bool doDupcol)
    00114   { if (doDupcol) presolveActions_  &= ~128; else presolveActions_ |= 128;}
    00116   inline bool doDuprow() const
    00117   { return (presolveActions_&256)==0;}
    00118   inline void setDoDuprow(bool doDuprow)
    00119   { if (doDuprow) presolveActions_  &= ~256; else presolveActions_ |= 256;}
    00121   inline bool doSingletonColumn() const
    00122   { return (presolveActions_&512)==0;}
    00123   inline void setDoSingletonColumn(bool doSingleton)
    00124   { if (doSingleton) presolveActions_  &= ~512; else presolveActions_ |= 512;}
    00126   inline int presolveActions() const
    00127   { return presolveActions_&0xffff;}
    00128   inline void setPresolveActions(int action)
    00129   { presolveActions_  = (presolveActions_&0xffff0000)|(action&0xffff);}
    00131   inline void setSubstitution(int value)
    00132   { substitution_=value;}
    00134   inline void statistics()
    00135   { presolveActions_ |= 0x80000000;}
    00136
    00145   virtual void postsolve(bool updateStatus=true);
    00146
    00148   void destroyPresolve();
    00149
    00151 private:
    00153   ClpSimplex * originalModel_;
    00154
    00156   ClpSimplex * presolvedModel_;
    00162   double nonLinearValue_;
    00164   int * originalColumn_;
    00166   int * originalRow_;
    00168   double * rowObjective_;
    00170   const CoinPresolveAction *paction_;
    00171
    00177   int ncols_;
    00178   int nrows_;
    00179   CoinBigIndex nelems_;
    00181   int numberPasses_;
    00183   int substitution_;
    00184 #ifndef CLP_NO_STD
    00186   std::string saveFile_;
    00187 #endif
    00188
    00192   int presolveActions_;
    00193 protected:
    00197   virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
    00198
    00204   virtual void postsolve(CoinPostsolveMatrix &prob);
    00206   virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
    00207                                             double feasibilityTolerance,
    00208                                             bool keepIntegers,
    00209                                             int numberPasses,
    00210                                             bool dropNames,
    00211                                             bool doRowObjective);
    00212 };
    00213 #endif