• Main Page
  • Classes
  • Files
  • File List
  • File Members

/build/buildd/clp-1.11.1/Clp/src/ClpMatrixBase.hpp

Go to the documentation of this file.
00001 /* $Id: ClpMatrixBase.hpp 1461 2009-11-06 19:06:43Z stefan $ */
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
00066 
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 {return NULL;}
00087   
00089   virtual CoinBigIndex countBasis(const int * whichColumn, 
00090                                   int & numberColumnBasic)=0;
00092   virtual void fillBasis(ClpSimplex * model,
00093                                  const int * whichColumn, 
00094                                  int & numberColumnBasic,
00095                                  int * row, int * start,
00096                                  int * rowCount, int * columnCount,
00097                                  CoinFactorizationDouble * element)=0;
00101   virtual int scale(ClpModel * , const ClpSimplex * =NULL) const 
00102   { return 1;}
00105   virtual void scaleRowCopy(ClpModel * ) const 
00106   { }
00108   virtual bool canGetRowCopy() const
00109   { return true;}
00113   inline virtual ClpMatrixBase * scaledColumnCopy(ClpModel * ) const 
00114   { return this->clone();}
00115   
00126   virtual bool allElementsInRange(ClpModel * ,
00127                                   double , double ,
00128                                   int =15)
00129   { return true;}
00135   virtual void setDimensions(int numrows, int numcols);
00139   virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00140                                double & smallestPositive, double & largestPositive);
00141   
00144   virtual void unpack(const ClpSimplex * model,CoinIndexedVector * rowArray,
00145                       int column) const =0;
00150   virtual void unpackPacked(ClpSimplex * model,
00151                             CoinIndexedVector * rowArray,
00152                             int column) const =0;
00157   virtual int refresh(ClpSimplex * )
00158   { return 0;}
00159   
00160   // Really scale matrix
00161   virtual void reallyScale(const double * rowScale, const double * columnScale);
00167   virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model,int * inputWeights) const;
00170   virtual void add(const ClpSimplex * model,CoinIndexedVector * rowArray,
00171                    int column, double multiplier) const =0;
00173   virtual void add(const ClpSimplex * model,double * array,
00174                    int column, double multiplier) const =0;
00176   virtual void releasePackedMatrix() const =0;
00178   virtual bool canDoPartialPricing() const;
00180   virtual int hiddenRows() const;
00182   virtual void partialPricing(ClpSimplex * model, double start, double end,
00183                               int & bestSequence, int & numberWanted);
00193   virtual int extendUpdated(ClpSimplex * model,CoinIndexedVector * update,int mode);
00200   virtual void primalExpanded(ClpSimplex * model,int mode);
00210   virtual void dualExpanded(ClpSimplex * model,CoinIndexedVector * array,
00211                             double * other,int mode);
00231   virtual int generalExpanded(ClpSimplex * model,int mode,int & number);
00235   virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
00239   virtual void createVariable(ClpSimplex * model, int & bestSequence);
00242   virtual int checkFeasible(ClpSimplex * model,double & sum) const ;
00244   double reducedCost(ClpSimplex * model,int sequence) const;
00246   virtual void correctSequence(const ClpSimplex * model,int & sequenceIn, int & sequenceOut) ;
00248   
00249   //---------------------------------------------------------------------------
00257   virtual void times(double scalar,
00258                      const double * x, double * y) const=0;
00262   virtual void times(double scalar,
00263                      const double * x, double * y,
00264                      const double * rowScale, 
00265                      const double * columnScale) const;
00269   virtual void transposeTimes(double scalar,
00270                               const double * x, double * y) const = 0;
00274   virtual void transposeTimes(double scalar,
00275                               const double * x, double * y,
00276                               const double * rowScale, 
00277                               const double * columnScale,
00278                               double * spare=NULL) const;
00279 #if COIN_LONG_WORK 
00280   // For long double versions (aborts if not supported)
00281   virtual void times(CoinWorkDouble scalar,
00282                      const CoinWorkDouble * x, CoinWorkDouble * y) const ;
00283   virtual void transposeTimes(CoinWorkDouble scalar,
00284                               const CoinWorkDouble * x, CoinWorkDouble * y) const ;
00285 #endif
00286 
00290   virtual void transposeTimes(const ClpSimplex * model, double scalar,
00291                               const CoinIndexedVector * x,
00292                               CoinIndexedVector * y,
00293                               CoinIndexedVector * z) const = 0;
00298   virtual void subsetTransposeTimes(const ClpSimplex * model,
00299                                     const CoinIndexedVector * x,
00300                                     const CoinIndexedVector * y,
00301                                     CoinIndexedVector * z) const = 0;
00304   virtual bool canCombine(const ClpSimplex * ,
00305                           const CoinIndexedVector * ) const {return false;}
00307   virtual void transposeTimes2(const ClpSimplex * model,
00308                                const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
00309                                const CoinIndexedVector * pi2, 
00310                                CoinIndexedVector * spare,
00311                                double referenceIn, double devex,
00312                                // Array for exact devex to say what is in reference framework
00313                                unsigned int * reference,
00314                                double * weights, double scaleFactor);
00316   virtual void subsetTimes2(const ClpSimplex * model,
00317                             CoinIndexedVector * dj1,
00318                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
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);
00327   virtual void listTransposeTimes(const ClpSimplex * model,
00328                                   double * x,
00329                                   int * y,
00330                                   int number,
00331                                   double * z) const;
00333 
00334 
00335 
00336   virtual ClpMatrixBase * clone() const = 0;
00341   virtual ClpMatrixBase * subsetClone (
00342                                        int numberRows, const int * whichRows,
00343                                        int numberColumns, const int * whichColumns) const;
00345   virtual void backToBasics() {}
00352   inline int type() const
00353   { return type_;}
00355   void setType(int newtype) {type_=newtype;}
00357   void useEffectiveRhs(ClpSimplex * model);
00361   virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
00362                                 bool check=false);
00364   inline int lastRefresh() const
00365   { return lastRefresh_;}
00367   inline int refreshFrequency() const
00368   { return refreshFrequency_;}
00369   inline void setRefreshFrequency(int value)
00370   { refreshFrequency_=value;}
00372   inline bool skipDualCheck() const
00373   { return skipDualCheck_;}
00374   inline void setSkipDualCheck(bool yes)
00375   { skipDualCheck_=yes;}
00378   inline int minimumObjectsScan() const
00379   { return minimumObjectsScan_;}
00380   inline void setMinimumObjectsScan(int value)
00381   { minimumObjectsScan_=value;}
00383   inline int minimumGoodReducedCosts() const
00384   { return minimumGoodReducedCosts_;}
00385   inline void setMinimumGoodReducedCosts(int value)
00386   { minimumGoodReducedCosts_=value;}
00388   inline double startFraction() const
00389   { return startFraction_;}
00390   inline void setStartFraction(double value) 
00391   { startFraction_ = value;}
00393   inline double endFraction() const
00394   { return endFraction_;}
00395   inline void setEndFraction(double value) 
00396   { endFraction_ = value;}
00398   inline double savedBestDj() const
00399   { return savedBestDj_;}
00400   inline void setSavedBestDj(double value) 
00401   { savedBestDj_ = value;}
00403   inline int originalWanted() const
00404   { return originalWanted_;}
00405   inline void setOriginalWanted(int value) 
00406   { originalWanted_ = value;}
00408   inline int currentWanted() const
00409   { return currentWanted_;}
00410   inline void setCurrentWanted(int value) 
00411   { currentWanted_ = value;}
00413   inline int savedBestSequence() const
00414   { return savedBestSequence_;}
00415   inline void setSavedBestSequence(int value) 
00416   { savedBestSequence_ = value;}
00418   
00419   
00420 protected:
00421   
00427   ClpMatrixBase();
00429 public:
00430   virtual ~ClpMatrixBase();
00431 protected:
00432   // Copy
00433   ClpMatrixBase(const ClpMatrixBase&);
00434   // Assignment
00435   ClpMatrixBase& operator=(const ClpMatrixBase&);
00437   
00438   
00439 protected:
00446   double * rhsOffset_;
00448   double startFraction_;
00450   double endFraction_;
00452   double savedBestDj_;
00454   int originalWanted_;
00456   int currentWanted_;
00458   int savedBestSequence_;
00460   int type_;
00462   int lastRefresh_;
00464   int refreshFrequency_;
00466   int minimumObjectsScan_;
00468   int minimumGoodReducedCosts_;
00470   int trueSequenceIn_;
00472   int trueSequenceOut_;
00474   bool skipDualCheck_;
00476 };
00477 // bias for free variables
00478 #define FREE_BIAS 1.0e1
00479 // Acceptance criteria for free variables
00480 #define FREE_ACCEPT 1.0e2
00481 
00482 #endif

Generated on Fri Aug 20 2010 06:29:28 by  doxygen 1.7.1