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

- File List
- File Members

# /home/coin/svn-release/Bcps-0.93.10/Clp/src/ClpPresolve.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpPresolve.hpp 1928 2013-04-06 12:54:16Z stefan $ */
    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 doSingletonColumn() const {
    00156           return (presolveActions_ & 512) == 0;
    00157      }
    00158      inline void setDoSingletonColumn(bool doSingleton) {
    00159           if (doSingleton) presolveActions_  &= ~512;
    00160           else presolveActions_ |= 512;
    00161      }
    00163      inline bool doGubrow() const {
    00164           return (presolveActions_ & 1024) == 0;
    00165      }
    00166      inline void setDoGubrow(bool doGubrow) {
    00167           if (doGubrow) presolveActions_  &= ~1024;
    00168           else presolveActions_ |= 1024;
    00169      }
    00171      inline bool doTwoxTwo() const {
    00172           return (presolveActions_ & 2048) != 0;
    00173      }
    00174      inline void setDoTwoxtwo(bool doTwoxTwo) {
    00175           if (!doTwoxTwo) presolveActions_  &= ~2048;
    00176           else presolveActions_ |= 2048;
    00177      }
    00179      inline int presolveActions() const {
    00180           return presolveActions_ & 0xffff;
    00181      }
    00182      inline void setPresolveActions(int action) {
    00183           presolveActions_  = (presolveActions_ & 0xffff0000) | (action & 0xffff);
    00184      }
    00186      inline void setSubstitution(int value) {
    00187           substitution_ = value;
    00188      }
    00190      inline void statistics() {
    00191           presolveActions_ |= 0x80000000;
    00192      }
    00194      int presolveStatus() const;
    00195
    00204      virtual void postsolve(bool updateStatus = true);
    00205
    00207      void destroyPresolve();
    00208
    00210 private:
    00212      ClpSimplex * originalModel_;
    00213
    00215      ClpSimplex * presolvedModel_;
    00221      double nonLinearValue_;
    00223      int * originalColumn_;
    00225      int * originalRow_;
    00227      double * rowObjective_;
    00229      const CoinPresolveAction *paction_;
    00230
    00236      int ncols_;
    00237      int nrows_;
    00238      CoinBigIndex nelems_;
    00240      int numberPasses_;
    00242      int substitution_;
    00243 #ifndef CLP_NO_STD
    00245      std::string saveFile_;
    00246 #endif
    00247
    00251      int presolveActions_;
    00252 protected:
    00256      virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
    00257
    00263      virtual void postsolve(CoinPostsolveMatrix &prob);
    00265      virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
    00266                double feasibilityTolerance,
    00267                bool keepIntegers,
    00268                int numberPasses,
    00269                bool dropNames,
    00270                                                bool doRowObjective,
    00271                                                const char * prohibitedRows=NULL,
    00272                                                const char * prohibitedColumns=NULL);
    00273 };
    00274 #endif