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

- File List
- File Members

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

Go to the documentation of this file.

    00001 /* $Id: ClpMatrixBase.hpp 1525 2010-02-26 17:27:59Z mjs $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 #ifndef ClpMatrixBase_H
    00005 #define ClpMatrixBase_H
    00006
    00007 #include "CoinPragma.hpp"
    00008 #include "CoinFinite.hpp"
    00009
    00010 #include "CoinPackedMatrix.hpp"
    00011 class CoinIndexedVector;
    00012 class ClpSimplex;
    00013 class ClpModel;
    00014
    00028 class ClpMatrixBase  {
    00029
    00030 public:
    00033
    00034      virtual CoinPackedMatrix * getPackedMatrix() const = 0;
    00036      virtual bool isColOrdered() const = 0;
    00038      virtual CoinBigIndex getNumElements() const = 0;
    00040      virtual int getNumCols() const = 0;
    00042      virtual int getNumRows() const = 0;
    00043
    00048      virtual const double * getElements() const = 0;
    00054      virtual const int * getIndices() const = 0;
    00055
    00056      virtual const CoinBigIndex * getVectorStarts() const = 0;
    00058      virtual const int * getVectorLengths() const = 0 ;
    00060      virtual int getVectorLength(int index) const ;
    00062      virtual void deleteCols(const int numDel, const int * indDel) = 0;
    00064      virtual void deleteRows(const int numDel, const int * indDel) = 0;
    00065 #ifndef CLP_NO_VECTOR
    00067      virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
    00069      virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
    00070 #endif
    00071
    00074      virtual void modifyCoefficient(int row, int column, double newElement,
    00075                                     bool keepZero = false);
    00080      virtual int appendMatrix(int number, int type,
    00081                               const CoinBigIndex * starts, const int * index,
    00082                               const double * element, int numberOther = -1);
    00083
    00086      virtual ClpMatrixBase * reverseOrderedCopy() const {
    00087           return NULL;
    00088      }
    00089
    00091      virtual CoinBigIndex countBasis(const int * whichColumn,
    00092                                      int & numberColumnBasic) = 0;
    00094      virtual void fillBasis(ClpSimplex * model,
    00095                             const int * whichColumn,
    00096                             int & numberColumnBasic,
    00097                             int * row, int * start,
    00098                             int * rowCount, int * columnCount,
    00099                             CoinFactorizationDouble * element) = 0;
    00103      virtual int scale(ClpModel * , const ClpSimplex * = NULL) const {
    00104           return 1;
    00105      }
    00108      virtual void scaleRowCopy(ClpModel * ) const { }
    00110      virtual bool canGetRowCopy() const {
    00111           return true;
    00112      }
    00116      inline virtual ClpMatrixBase * scaledColumnCopy(ClpModel * ) const {
    00117           return this->clone();
    00118      }
    00119
    00130      virtual bool allElementsInRange(ClpModel * ,
    00131                                      double , double ,
    00132                                      int = 15) {
    00133           return true;
    00134      }
    00140      virtual void setDimensions(int numrows, int numcols);
    00144      virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
    00145                                   double & smallestPositive, double & largestPositive);
    00146
    00149      virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
    00150                          int column) const = 0;
    00155      virtual void unpackPacked(ClpSimplex * model,
    00156                                CoinIndexedVector * rowArray,
    00157                                int column) const = 0;
    00162      virtual int refresh(ClpSimplex * ) {
    00163           return 0;
    00164      }
    00165
    00166      // Really scale matrix
    00167      virtual void reallyScale(const double * rowScale, const double * columnScale);
    00173      virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
    00176      virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
    00177                       int column, double multiplier) const = 0;
    00179      virtual void add(const ClpSimplex * model, double * array,
    00180                       int column, double multiplier) const = 0;
    00182      virtual void releasePackedMatrix() const = 0;
    00184      virtual bool canDoPartialPricing() const;
    00186      virtual int hiddenRows() const;
    00188      virtual void partialPricing(ClpSimplex * model, double start, double end,
    00189                                  int & bestSequence, int & numberWanted);
    00199      virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode);
    00206      virtual void primalExpanded(ClpSimplex * model, int mode);
    00216      virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
    00217                                double * other, int mode);
    00237      virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
    00241      virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
    00245      virtual void createVariable(ClpSimplex * model, int & bestSequence);
    00248      virtual int checkFeasible(ClpSimplex * model, double & sum) const ;
    00250      double reducedCost(ClpSimplex * model, int sequence) const;
    00252      virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ;
    00254
    00255      //---------------------------------------------------------------------------
    00263      virtual void times(double scalar,
    00264                         const double * x, double * y) const = 0;
    00268      virtual void times(double scalar,
    00269                         const double * x, double * y,
    00270                         const double * rowScale,
    00271                         const double * columnScale) const;
    00275      virtual void transposeTimes(double scalar,
    00276                                  const double * x, double * y) const = 0;
    00280      virtual void transposeTimes(double scalar,
    00281                                  const double * x, double * y,
    00282                                  const double * rowScale,
    00283                                  const double * columnScale,
    00284                                  double * spare = NULL) const;
    00285 #if COIN_LONG_WORK
    00286      // For long double versions (aborts if not supported)
    00287      virtual void times(CoinWorkDouble scalar,
    00288                         const CoinWorkDouble * x, CoinWorkDouble * y) const ;
    00289      virtual void transposeTimes(CoinWorkDouble scalar,
    00290                                  const CoinWorkDouble * x, CoinWorkDouble * y) const ;
    00291 #endif
    00292
    00296      virtual void transposeTimes(const ClpSimplex * model, double scalar,
    00297                                  const CoinIndexedVector * x,
    00298                                  CoinIndexedVector * y,
    00299                                  CoinIndexedVector * z) const = 0;
    00304      virtual void subsetTransposeTimes(const ClpSimplex * model,
    00305                                        const CoinIndexedVector * x,
    00306                                        const CoinIndexedVector * y,
    00307                                        CoinIndexedVector * z) const = 0;
    00310      virtual bool canCombine(const ClpSimplex * ,
    00311                              const CoinIndexedVector * ) const {
    00312           return false;
    00313      }
    00315      virtual void transposeTimes2(const ClpSimplex * model,
    00316                                   const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
    00317                                   const CoinIndexedVector * pi2,
    00318                                   CoinIndexedVector * spare,
    00319                                   double referenceIn, double devex,
    00320                                   // Array for exact devex to say what is in reference framework
    00321                                   unsigned int * reference,
    00322                                   double * weights, double scaleFactor);
    00324      virtual void subsetTimes2(const ClpSimplex * model,
    00325                                CoinIndexedVector * dj1,
    00326                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
    00327                                double referenceIn, double devex,
    00328                                // Array for exact devex to say what is in reference framework
    00329                                unsigned int * reference,
    00330                                double * weights, double scaleFactor);
    00335      virtual void listTransposeTimes(const ClpSimplex * model,
    00336                                      double * x,
    00337                                      int * y,
    00338                                      int number,
    00339                                      double * z) const;
    00341
    00342
    00343
    00344      virtual ClpMatrixBase * clone() const = 0;
    00349      virtual ClpMatrixBase * subsetClone (
    00350           int numberRows, const int * whichRows,
    00351           int numberColumns, const int * whichColumns) const;
    00353      virtual void backToBasics() {}
    00360      inline int type() const {
    00361           return type_;
    00362      }
    00364      void setType(int newtype) {
    00365           type_ = newtype;
    00366      }
    00368      void useEffectiveRhs(ClpSimplex * model);
    00372      virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
    00373                                 bool check = false);
    00375      inline int lastRefresh() const {
    00376           return lastRefresh_;
    00377      }
    00379      inline int refreshFrequency() const {
    00380           return refreshFrequency_;
    00381      }
    00382      inline void setRefreshFrequency(int value) {
    00383           refreshFrequency_ = value;
    00384      }
    00386      inline bool skipDualCheck() const {
    00387           return skipDualCheck_;
    00388      }
    00389      inline void setSkipDualCheck(bool yes) {
    00390           skipDualCheck_ = yes;
    00391      }
    00394      inline int minimumObjectsScan() const {
    00395           return minimumObjectsScan_;
    00396      }
    00397      inline void setMinimumObjectsScan(int value) {
    00398           minimumObjectsScan_ = value;
    00399      }
    00401      inline int minimumGoodReducedCosts() const {
    00402           return minimumGoodReducedCosts_;
    00403      }
    00404      inline void setMinimumGoodReducedCosts(int value) {
    00405           minimumGoodReducedCosts_ = value;
    00406      }
    00408      inline double startFraction() const {
    00409           return startFraction_;
    00410      }
    00411      inline void setStartFraction(double value) {
    00412           startFraction_ = value;
    00413      }
    00415      inline double endFraction() const {
    00416           return endFraction_;
    00417      }
    00418      inline void setEndFraction(double value) {
    00419           endFraction_ = value;
    00420      }
    00422      inline double savedBestDj() const {
    00423           return savedBestDj_;
    00424      }
    00425      inline void setSavedBestDj(double value) {
    00426           savedBestDj_ = value;
    00427      }
    00429      inline int originalWanted() const {
    00430           return originalWanted_;
    00431      }
    00432      inline void setOriginalWanted(int value) {
    00433           originalWanted_ = value;
    00434      }
    00436      inline int currentWanted() const {
    00437           return currentWanted_;
    00438      }
    00439      inline void setCurrentWanted(int value) {
    00440           currentWanted_ = value;
    00441      }
    00443      inline int savedBestSequence() const {
    00444           return savedBestSequence_;
    00445      }
    00446      inline void setSavedBestSequence(int value) {
    00447           savedBestSequence_ = value;
    00448      }
    00450
    00451
    00452 protected:
    00453
    00459      ClpMatrixBase();
    00461 public:
    00462      virtual ~ClpMatrixBase();
    00463 protected:
    00464      // Copy
    00465      ClpMatrixBase(const ClpMatrixBase&);
    00466      // Assignment
    00467      ClpMatrixBase& operator=(const ClpMatrixBase&);
    00469
    00470
    00471 protected:
    00478      double * rhsOffset_;
    00480      double startFraction_;
    00482      double endFraction_;
    00484      double savedBestDj_;
    00486      int originalWanted_;
    00488      int currentWanted_;
    00490      int savedBestSequence_;
    00492      int type_;
    00494      int lastRefresh_;
    00496      int refreshFrequency_;
    00498      int minimumObjectsScan_;
    00500      int minimumGoodReducedCosts_;
    00502      int trueSequenceIn_;
    00504      int trueSequenceOut_;
    00506      bool skipDualCheck_;
    00508 };
    00509 // bias for free variables
    00510 #define FREE_BIAS 1.0e1
    00511 // Acceptance criteria for free variables
    00512 #define FREE_ACCEPT 1.0e2
    00513
    00514 #endif