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

- File List
- File Members

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

Go to the documentation of this file.

    00001 /* $Id: ClpMatrixBase.hpp 1753 2011-06-19 16:27:26Z 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 ClpMatrixBase_H
    00007 #define ClpMatrixBase_H
    00008
    00009 #include "CoinPragma.hpp"
    00010 #include "CoinTypes.hpp"
    00011
    00012 #include "CoinPackedMatrix.hpp"
    00013 class CoinIndexedVector;
    00014 class ClpSimplex;
    00015 class ClpModel;
    00016
    00030 class ClpMatrixBase  {
    00031
    00032 public:
    00035
    00036      virtual CoinPackedMatrix * getPackedMatrix() const = 0;
    00038      virtual bool isColOrdered() const = 0;
    00040      virtual CoinBigIndex getNumElements() const = 0;
    00042      virtual int getNumCols() const = 0;
    00044      virtual int getNumRows() const = 0;
    00045
    00050      virtual const double * getElements() const = 0;
    00056      virtual const int * getIndices() const = 0;
    00057
    00058      virtual const CoinBigIndex * getVectorStarts() const = 0;
    00060      virtual const int * getVectorLengths() const = 0 ;
    00062      virtual int getVectorLength(int index) const ;
    00064      virtual void deleteCols(const int numDel, const int * indDel) = 0;
    00066      virtual void deleteRows(const int numDel, const int * indDel) = 0;
    00067 #ifndef CLP_NO_VECTOR
    00069      virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
    00071      virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
    00072 #endif
    00073
    00076      virtual void modifyCoefficient(int row, int column, double newElement,
    00077                                     bool keepZero = false);
    00082      virtual int appendMatrix(int number, int type,
    00083                               const CoinBigIndex * starts, const int * index,
    00084                               const double * element, int numberOther = -1);
    00085
    00088      virtual ClpMatrixBase * reverseOrderedCopy() const {
    00089           return NULL;
    00090      }
    00091
    00093      virtual CoinBigIndex countBasis(const int * whichColumn,
    00094                                      int & numberColumnBasic) = 0;
    00096      virtual void fillBasis(ClpSimplex * model,
    00097                             const int * whichColumn,
    00098                             int & numberColumnBasic,
    00099                             int * row, int * start,
    00100                             int * rowCount, int * columnCount,
    00101                             CoinFactorizationDouble * element) = 0;
    00105      virtual int scale(ClpModel * , const ClpSimplex * = NULL) const {
    00106           return 1;
    00107      }
    00110      virtual void scaleRowCopy(ClpModel * ) const { }
    00112      virtual bool canGetRowCopy() const {
    00113           return true;
    00114      }
    00118      inline virtual ClpMatrixBase * scaledColumnCopy(ClpModel * ) const {
    00119           return this->clone();
    00120      }
    00121
    00132      virtual bool allElementsInRange(ClpModel * ,
    00133                                      double , double ,
    00134                                      int = 15) {
    00135           return true;
    00136      }
    00142      virtual void setDimensions(int numrows, int numcols);
    00146      virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
    00147                                   double & smallestPositive, double & largestPositive);
    00148
    00151      virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
    00152                          int column) const = 0;
    00157      virtual void unpackPacked(ClpSimplex * model,
    00158                                CoinIndexedVector * rowArray,
    00159                                int column) const = 0;
    00164      virtual int refresh(ClpSimplex * ) {
    00165           return 0;
    00166      }
    00167
    00168      // Really scale matrix
    00169      virtual void reallyScale(const double * rowScale, const double * columnScale);
    00175      virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
    00178      virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
    00179                       int column, double multiplier) const = 0;
    00181      virtual void add(const ClpSimplex * model, double * array,
    00182                       int column, double multiplier) const = 0;
    00184      virtual void releasePackedMatrix() const = 0;
    00186      virtual bool canDoPartialPricing() const;
    00188      virtual int hiddenRows() const;
    00190      virtual void partialPricing(ClpSimplex * model, double start, double end,
    00191                                  int & bestSequence, int & numberWanted);
    00201      virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode);
    00208      virtual void primalExpanded(ClpSimplex * model, int mode);
    00218      virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
    00219                                double * other, int mode);
    00239      virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
    00243      virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
    00247      virtual void createVariable(ClpSimplex * model, int & bestSequence);
    00250      virtual int checkFeasible(ClpSimplex * model, double & sum) const ;
    00252      double reducedCost(ClpSimplex * model, int sequence) const;
    00254      virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ;
    00256
    00257      //---------------------------------------------------------------------------
    00265      virtual void times(double scalar,
    00266                         const double * x, double * y) const = 0;
    00270      virtual void times(double scalar,
    00271                         const double * x, double * y,
    00272                         const double * rowScale,
    00273                         const double * columnScale) const;
    00277      virtual void transposeTimes(double scalar,
    00278                                  const double * x, double * y) const = 0;
    00282      virtual void transposeTimes(double scalar,
    00283                                  const double * x, double * y,
    00284                                  const double * rowScale,
    00285                                  const double * columnScale,
    00286                                  double * spare = NULL) const;
    00287 #if COIN_LONG_WORK
    00288      // For long double versions (aborts if not supported)
    00289      virtual void times(CoinWorkDouble scalar,
    00290                         const CoinWorkDouble * x, CoinWorkDouble * y) const ;
    00291      virtual void transposeTimes(CoinWorkDouble scalar,
    00292                                  const CoinWorkDouble * x, CoinWorkDouble * y) const ;
    00293 #endif
    00294
    00298      virtual void transposeTimes(const ClpSimplex * model, double scalar,
    00299                                  const CoinIndexedVector * x,
    00300                                  CoinIndexedVector * y,
    00301                                  CoinIndexedVector * z) const = 0;
    00306      virtual void subsetTransposeTimes(const ClpSimplex * model,
    00307                                        const CoinIndexedVector * x,
    00308                                        const CoinIndexedVector * y,
    00309                                        CoinIndexedVector * z) const = 0;
    00312      virtual bool canCombine(const ClpSimplex * ,
    00313                              const CoinIndexedVector * ) const {
    00314           return false;
    00315      }
    00317      virtual void transposeTimes2(const ClpSimplex * model,
    00318                                   const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
    00319                                   const CoinIndexedVector * pi2,
    00320                                   CoinIndexedVector * spare,
    00321                                   double referenceIn, double devex,
    00322                                   // Array for exact devex to say what is in reference framework
    00323                                   unsigned int * reference,
    00324                                   double * weights, double scaleFactor);
    00326      virtual void subsetTimes2(const ClpSimplex * model,
    00327                                CoinIndexedVector * dj1,
    00328                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
    00329                                double referenceIn, double devex,
    00330                                // Array for exact devex to say what is in reference framework
    00331                                unsigned int * reference,
    00332                                double * weights, double scaleFactor);
    00337      virtual void listTransposeTimes(const ClpSimplex * model,
    00338                                      double * x,
    00339                                      int * y,
    00340                                      int number,
    00341                                      double * z) const;
    00343
    00344
    00345
    00346      virtual ClpMatrixBase * clone() const = 0;
    00351      virtual ClpMatrixBase * subsetClone (
    00352           int numberRows, const int * whichRows,
    00353           int numberColumns, const int * whichColumns) const;
    00355      virtual void backToBasics() {}
    00362      inline int type() const {
    00363           return type_;
    00364      }
    00366      void setType(int newtype) {
    00367           type_ = newtype;
    00368      }
    00370      void useEffectiveRhs(ClpSimplex * model);
    00374      virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
    00375                                 bool check = false);
    00377      inline int lastRefresh() const {
    00378           return lastRefresh_;
    00379      }
    00381      inline int refreshFrequency() const {
    00382           return refreshFrequency_;
    00383      }
    00384      inline void setRefreshFrequency(int value) {
    00385           refreshFrequency_ = value;
    00386      }
    00388      inline bool skipDualCheck() const {
    00389           return skipDualCheck_;
    00390      }
    00391      inline void setSkipDualCheck(bool yes) {
    00392           skipDualCheck_ = yes;
    00393      }
    00396      inline int minimumObjectsScan() const {
    00397           return minimumObjectsScan_;
    00398      }
    00399      inline void setMinimumObjectsScan(int value) {
    00400           minimumObjectsScan_ = value;
    00401      }
    00403      inline int minimumGoodReducedCosts() const {
    00404           return minimumGoodReducedCosts_;
    00405      }
    00406      inline void setMinimumGoodReducedCosts(int value) {
    00407           minimumGoodReducedCosts_ = value;
    00408      }
    00410      inline double startFraction() const {
    00411           return startFraction_;
    00412      }
    00413      inline void setStartFraction(double value) {
    00414           startFraction_ = value;
    00415      }
    00417      inline double endFraction() const {
    00418           return endFraction_;
    00419      }
    00420      inline void setEndFraction(double value) {
    00421           endFraction_ = value;
    00422      }
    00424      inline double savedBestDj() const {
    00425           return savedBestDj_;
    00426      }
    00427      inline void setSavedBestDj(double value) {
    00428           savedBestDj_ = value;
    00429      }
    00431      inline int originalWanted() const {
    00432           return originalWanted_;
    00433      }
    00434      inline void setOriginalWanted(int value) {
    00435           originalWanted_ = value;
    00436      }
    00438      inline int currentWanted() const {
    00439           return currentWanted_;
    00440      }
    00441      inline void setCurrentWanted(int value) {
    00442           currentWanted_ = value;
    00443      }
    00445      inline int savedBestSequence() const {
    00446           return savedBestSequence_;
    00447      }
    00448      inline void setSavedBestSequence(int value) {
    00449           savedBestSequence_ = value;
    00450      }
    00452
    00453
    00454 protected:
    00455
    00461      ClpMatrixBase();
    00463 public:
    00464      virtual ~ClpMatrixBase();
    00465 protected:
    00466      // Copy
    00467      ClpMatrixBase(const ClpMatrixBase&);
    00468      // Assignment
    00469      ClpMatrixBase& operator=(const ClpMatrixBase&);
    00471
    00472
    00473 protected:
    00480      double * rhsOffset_;
    00482      double startFraction_;
    00484      double endFraction_;
    00486      double savedBestDj_;
    00488      int originalWanted_;
    00490      int currentWanted_;
    00492      int savedBestSequence_;
    00494      int type_;
    00496      int lastRefresh_;
    00498      int refreshFrequency_;
    00500      int minimumObjectsScan_;
    00502      int minimumGoodReducedCosts_;
    00504      int trueSequenceIn_;
    00506      int trueSequenceOut_;
    00508      bool skipDualCheck_;
    00510 };
    00511 // bias for free variables
    00512 #define FREE_BIAS 1.0e1
    00513 // Acceptance criteria for free variables
    00514 #define FREE_ACCEPT 1.0e2
    00515
    00516 #endif