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

- File List
- File Members

# /home/coin/SVN-release/Bcps-0.91.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 bool doGubrow() const
    00127   { return (presolveActions_&1024)==0;}
    00128   inline void setDoGubrow(bool doGubrow)
    00129   { if (doGubrow) presolveActions_  &= ~1024; else presolveActions_ |= 1024;}
    00131   inline int presolveActions() const
    00132   { return presolveActions_&0xffff;}
    00133   inline void setPresolveActions(int action)
    00134   { presolveActions_  = (presolveActions_&0xffff0000)|(action&0xffff);}
    00136   inline void setSubstitution(int value)
    00137   { substitution_=value;}
    00139   inline void statistics()
    00140   { presolveActions_ |= 0x80000000;}
    00141
    00150   virtual void postsolve(bool updateStatus=true);
    00151
    00153   void destroyPresolve();
    00154
    00156 private:
    00158   ClpSimplex * originalModel_;
    00159
    00161   ClpSimplex * presolvedModel_;
    00167   double nonLinearValue_;
    00169   int * originalColumn_;
    00171   int * originalRow_;
    00173   double * rowObjective_;
    00175   const CoinPresolveAction *paction_;
    00176
    00182   int ncols_;
    00183   int nrows_;
    00184   CoinBigIndex nelems_;
    00186   int numberPasses_;
    00188   int substitution_;
    00189 #ifndef CLP_NO_STD
    00191   std::string saveFile_;
    00192 #endif
    00193
    00197   int presolveActions_;
    00198 protected:
    00202   virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
    00203
    00209   virtual void postsolve(CoinPostsolveMatrix &prob);
    00211   virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
    00212                                             double feasibilityTolerance,
    00213                                             bool keepIntegers,
    00214                                             int numberPasses,
    00215                                             bool dropNames,
    00216                                             bool doRowObjective);
    00217 };
    00218 #endif