ClpPresolve.hpp

Go to the documentation of this file.
00001 /* $Id: ClpPresolve.hpp 2074 2014-12-10 09:43:54Z 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 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 bool doIntersection() const {
00180           return (presolveActions_ & 4096) != 0;
00181      }
00182      inline void setDoIntersection(bool doIntersection) {
00183           if (doIntersection) presolveActions_  &= ~4096;
00184           else presolveActions_ |= 4096;
00185      }
00188      inline int zeroSmall() const {
00189           return (presolveActions_&(8192|16384))>>13;
00190      }
00191      inline void setZeroSmall(int value) {
00192          presolveActions_  &= ~(8192|16384);
00193          presolveActions_ |= value<<13;
00194      }
00196      inline int presolveActions() const {
00197           return presolveActions_ & 0xffff;
00198      }
00199      inline void setPresolveActions(int action) {
00200           presolveActions_  = (presolveActions_ & 0xffff0000) | (action & 0xffff);
00201      }
00203      inline void setSubstitution(int value) {
00204           substitution_ = value;
00205      }
00207      inline void statistics() {
00208           presolveActions_ |= 0x80000000;
00209      }
00211      int presolveStatus() const;
00212 
00221      virtual void postsolve(bool updateStatus = true);
00222 
00224      void destroyPresolve();
00225 
00227 private:
00229      ClpSimplex * originalModel_;
00230 
00232      ClpSimplex * presolvedModel_;
00238      double nonLinearValue_;
00240      int * originalColumn_;
00242      int * originalRow_;
00244      double * rowObjective_;
00246      const CoinPresolveAction *paction_;
00247 
00253      int ncols_;
00254      int nrows_;
00255      CoinBigIndex nelems_;
00257      int numberPasses_;
00259      int substitution_;
00260 #ifndef CLP_NO_STD
00262      std::string saveFile_;
00263 #endif
00264 
00268      int presolveActions_;
00269 protected:
00273      virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
00274 
00280      virtual void postsolve(CoinPostsolveMatrix &prob);
00282      virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
00283                double feasibilityTolerance,
00284                bool keepIntegers,
00285                int numberPasses,
00286                bool dropNames,
00287                                                bool doRowObjective,
00288                                                const char * prohibitedRows=NULL,
00289                                                const char * prohibitedColumns=NULL);
00290 };
00291 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 8 Mar 2015 for Clp by  doxygen 1.6.1