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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Clp/src/ClpPresolve.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpPresolve.hpp 1525 2010-02-26 17:27:59Z mjs $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    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      }
    00075      inline double nonLinearValue() const {
    00076           return nonLinearValue_;
    00077      }
    00079      inline bool doDual() const {
    00080           return (presolveActions_ & 1) == 0;
    00081      }
    00082      inline void setDoDual(bool doDual) {
    00083           if (doDual) presolveActions_  &= ~1;
    00084           else presolveActions_ |= 1;
    00085      }
    00087      inline bool doSingleton() const {
    00088           return (presolveActions_ & 2) == 0;
    00089      }
    00090      inline void setDoSingleton(bool doSingleton) {
    00091           if (doSingleton) presolveActions_  &= ~2;
    00092           else presolveActions_ |= 2;
    00093      }
    00095      inline bool doDoubleton() const {
    00096           return (presolveActions_ & 4) == 0;
    00097      }
    00098      inline void setDoDoubleton(bool doDoubleton) {
    00099           if (doDoubleton) presolveActions_  &= ~4;
    00100           else presolveActions_ |= 4;
    00101      }
    00103      inline bool doTripleton() const {
    00104           return (presolveActions_ & 8) == 0;
    00105      }
    00106      inline void setDoTripleton(bool doTripleton) {
    00107           if (doTripleton) presolveActions_  &= ~8;
    00108           else presolveActions_ |= 8;
    00109      }
    00111      inline bool doTighten() const {
    00112           return (presolveActions_ & 16) == 0;
    00113      }
    00114      inline void setDoTighten(bool doTighten) {
    00115           if (doTighten) presolveActions_  &= ~16;
    00116           else presolveActions_ |= 16;
    00117      }
    00119      inline bool doForcing() const {
    00120           return (presolveActions_ & 32) == 0;
    00121      }
    00122      inline void setDoForcing(bool doForcing) {
    00123           if (doForcing) presolveActions_  &= ~32;
    00124           else presolveActions_ |= 32;
    00125      }
    00127      inline bool doImpliedFree() const {
    00128           return (presolveActions_ & 64) == 0;
    00129      }
    00130      inline void setDoImpliedFree(bool doImpliedfree) {
    00131           if (doImpliedfree) presolveActions_  &= ~64;
    00132           else presolveActions_ |= 64;
    00133      }
    00135      inline bool doDupcol() const {
    00136           return (presolveActions_ & 128) == 0;
    00137      }
    00138      inline void setDoDupcol(bool doDupcol) {
    00139           if (doDupcol) presolveActions_  &= ~128;
    00140           else presolveActions_ |= 128;
    00141      }
    00143      inline bool doDuprow() const {
    00144           return (presolveActions_ & 256) == 0;
    00145      }
    00146      inline void setDoDuprow(bool doDuprow) {
    00147           if (doDuprow) presolveActions_  &= ~256;
    00148           else presolveActions_ |= 256;
    00149      }
    00151      inline bool doSingletonColumn() const {
    00152           return (presolveActions_ & 512) == 0;
    00153      }
    00154      inline void setDoSingletonColumn(bool doSingleton) {
    00155           if (doSingleton) presolveActions_  &= ~512;
    00156           else presolveActions_ |= 512;
    00157      }
    00159      inline bool doGubrow() const {
    00160           return (presolveActions_ & 1024) == 0;
    00161      }
    00162      inline void setDoGubrow(bool doGubrow) {
    00163           if (doGubrow) presolveActions_  &= ~1024;
    00164           else presolveActions_ |= 1024;
    00165      }
    00167      inline int presolveActions() const {
    00168           return presolveActions_ & 0xffff;
    00169      }
    00170      inline void setPresolveActions(int action) {
    00171           presolveActions_  = (presolveActions_ & 0xffff0000) | (action & 0xffff);
    00172      }
    00174      inline void setSubstitution(int value) {
    00175           substitution_ = value;
    00176      }
    00178      inline void statistics() {
    00179           presolveActions_ |= 0x80000000;
    00180      }
    00181
    00190      virtual void postsolve(bool updateStatus = true);
    00191
    00193      void destroyPresolve();
    00194
    00196 private:
    00198      ClpSimplex * originalModel_;
    00199
    00201      ClpSimplex * presolvedModel_;
    00207      double nonLinearValue_;
    00209      int * originalColumn_;
    00211      int * originalRow_;
    00213      double * rowObjective_;
    00215      const CoinPresolveAction *paction_;
    00216
    00222      int ncols_;
    00223      int nrows_;
    00224      CoinBigIndex nelems_;
    00226      int numberPasses_;
    00228      int substitution_;
    00229 #ifndef CLP_NO_STD
    00231      std::string saveFile_;
    00232 #endif
    00233
    00237      int presolveActions_;
    00238 protected:
    00242      virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
    00243
    00249      virtual void postsolve(CoinPostsolveMatrix &prob);
    00251      virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
    00252                double feasibilityTolerance,
    00253                bool keepIntegers,
    00254                int numberPasses,
    00255                bool dropNames,
    00256                bool doRowObjective);
    00257 };
    00258 #endif