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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Clp/src/ClpPresolve.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpPresolve.hpp 2134 2015-03-22 16:40:43Z forrest $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef ClpPresolve_H
    00007 #define ClpPresolve_H
    00008 #include "ClpSimplex.hpp"
    00009
    00010 class CoinPresolveAction;
    00011 #include "CoinPresolveMatrix.hpp"
    00015 class ClpPresolve {
    00016 public:
    00019
    00020      ClpPresolve();
    00021
    00023      virtual ~ClpPresolve();
    00025
    00041      ClpSimplex * presolvedModel(ClpSimplex & si,
    00042                                  double feasibilityTolerance = 0.0,
    00043                                  bool keepIntegers = true,
    00044                                  int numberPasses = 5,
    00045                                  bool dropNames = false,
    00046                                  bool doRowObjective = false,
    00047                                  const char * prohibitedRows=NULL,
    00048                                  const char * prohibitedColumns=NULL);
    00049 #ifndef CLP_NO_STD
    00050
    00053      int presolvedModelToFile(ClpSimplex &si, std::string fileName,
    00054                               double feasibilityTolerance = 0.0,
    00055                               bool keepIntegers = true,
    00056                               int numberPasses = 5,
    00057                               bool dropNames = false,
    00058                               bool doRowObjective = false);
    00059 #endif
    00060
    00062      ClpSimplex * model() const;
    00064      ClpSimplex * originalModel() const;
    00066      void setOriginalModel(ClpSimplex * model);
    00067
    00069      const int * originalColumns() const;
    00071      const int * originalRows() const;
    00076      inline void setNonLinearValue(double value) {
    00077           nonLinearValue_ = value;
    00078      }
    00079      inline double nonLinearValue() const {
    00080           return nonLinearValue_;
    00081      }
    00083      inline bool doDual() const {
    00084           return (presolveActions_ & 1) == 0;
    00085      }
    00086      inline void setDoDual(bool doDual) {
    00087           if (doDual) presolveActions_  &= ~1;
    00088           else presolveActions_ |= 1;
    00089      }
    00091      inline bool doSingleton() const {
    00092           return (presolveActions_ & 2) == 0;
    00093      }
    00094      inline void setDoSingleton(bool doSingleton) {
    00095           if (doSingleton) presolveActions_  &= ~2;
    00096           else presolveActions_ |= 2;
    00097      }
    00099      inline bool doDoubleton() const {
    00100           return (presolveActions_ & 4) == 0;
    00101      }
    00102      inline void setDoDoubleton(bool doDoubleton) {
    00103           if (doDoubleton) presolveActions_  &= ~4;
    00104           else presolveActions_ |= 4;
    00105      }
    00107      inline bool doTripleton() const {
    00108           return (presolveActions_ & 8) == 0;
    00109      }
    00110      inline void setDoTripleton(bool doTripleton) {
    00111           if (doTripleton) presolveActions_  &= ~8;
    00112           else presolveActions_ |= 8;
    00113      }
    00115      inline bool doTighten() const {
    00116           return (presolveActions_ & 16) == 0;
    00117      }
    00118      inline void setDoTighten(bool doTighten) {
    00119           if (doTighten) presolveActions_  &= ~16;
    00120           else presolveActions_ |= 16;
    00121      }
    00123      inline bool doForcing() const {
    00124           return (presolveActions_ & 32) == 0;
    00125      }
    00126      inline void setDoForcing(bool doForcing) {
    00127           if (doForcing) presolveActions_  &= ~32;
    00128           else presolveActions_ |= 32;
    00129      }
    00131      inline bool doImpliedFree() const {
    00132           return (presolveActions_ & 64) == 0;
    00133      }
    00134      inline void setDoImpliedFree(bool doImpliedfree) {
    00135           if (doImpliedfree) presolveActions_  &= ~64;
    00136           else presolveActions_ |= 64;
    00137      }
    00139      inline bool doDupcol() const {
    00140           return (presolveActions_ & 128) == 0;
    00141      }
    00142      inline void setDoDupcol(bool doDupcol) {
    00143           if (doDupcol) presolveActions_  &= ~128;
    00144           else presolveActions_ |= 128;
    00145      }
    00147      inline bool doDuprow() const {
    00148           return (presolveActions_ & 256) == 0;
    00149      }
    00150      inline void setDoDuprow(bool doDuprow) {
    00151           if (doDuprow) presolveActions_  &= ~256;
    00152           else presolveActions_ |= 256;
    00153      }
    00155      inline bool doDependency() const {
    00156           return (presolveActions_ & 32768) != 0;
    00157      }
    00158      inline void setDoDependency(bool doDependency) {
    00159           if (doDependency) presolveActions_  |= 32768;
    00160           else presolveActions_ &= ~32768;
    00161      }
    00163      inline bool doSingletonColumn() const {
    00164           return (presolveActions_ & 512) == 0;
    00165      }
    00166      inline void setDoSingletonColumn(bool doSingleton) {
    00167           if (doSingleton) presolveActions_  &= ~512;
    00168           else presolveActions_ |= 512;
    00169      }
    00171      inline bool doGubrow() const {
    00172           return (presolveActions_ & 1024) == 0;
    00173      }
    00174      inline void setDoGubrow(bool doGubrow) {
    00175           if (doGubrow) presolveActions_  &= ~1024;
    00176           else presolveActions_ |= 1024;
    00177      }
    00179      inline bool doTwoxTwo() const {
    00180           return (presolveActions_ & 2048) != 0;
    00181      }
    00182      inline void setDoTwoxtwo(bool doTwoxTwo) {
    00183           if (!doTwoxTwo) presolveActions_  &= ~2048;
    00184           else presolveActions_ |= 2048;
    00185      }
    00187      inline bool doIntersection() const {
    00188           return (presolveActions_ & 4096) != 0;
    00189      }
    00190      inline void setDoIntersection(bool doIntersection) {
    00191           if (doIntersection) presolveActions_  &= ~4096;
    00192           else presolveActions_ |= 4096;
    00193      }
    00196      inline int zeroSmall() const {
    00197           return (presolveActions_&(8192|16384))>>13;
    00198      }
    00199      inline void setZeroSmall(int value) {
    00200          presolveActions_  &= ~(8192|16384);
    00201          presolveActions_ |= value<<13;
    00202      }
    00204      inline int presolveActions() const {
    00205           return presolveActions_ & 0xffff;
    00206      }
    00207      inline void setPresolveActions(int action) {
    00208           presolveActions_  = (presolveActions_ & 0xffff0000) | (action & 0xffff);
    00209      }
    00211      inline void setSubstitution(int value) {
    00212           substitution_ = value;
    00213      }
    00215      inline void statistics() {
    00216           presolveActions_ |= 0x80000000;
    00217      }
    00219      int presolveStatus() const;
    00220
    00229      virtual void postsolve(bool updateStatus = true);
    00230
    00232      void destroyPresolve();
    00233
    00235 private:
    00237      ClpSimplex * originalModel_;
    00238
    00240      ClpSimplex * presolvedModel_;
    00246      double nonLinearValue_;
    00248      int * originalColumn_;
    00250      int * originalRow_;
    00252      double * rowObjective_;
    00254      const CoinPresolveAction *paction_;
    00255
    00261      int ncols_;
    00262      int nrows_;
    00263      CoinBigIndex nelems_;
    00265      int numberPasses_;
    00267      int substitution_;
    00268 #ifndef CLP_NO_STD
    00270      std::string saveFile_;
    00271 #endif
    00272
    00276      int presolveActions_;
    00277 protected:
    00281      virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
    00282
    00288      virtual void postsolve(CoinPostsolveMatrix &prob);
    00290      virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
    00291                double feasibilityTolerance,
    00292                bool keepIntegers,
    00293                int numberPasses,
    00294                bool dropNames,
    00295                                                bool doRowObjective,
    00296                                                const char * prohibitedRows=NULL,
    00297                                                const char * prohibitedColumns=NULL);
    00298 };
    00299 #endif