/home/coin/SVN-release/CoinAll-1.1.0/Clp/src/ClpPlusMinusOneMatrix.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2003, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef ClpPlusMinusOneMatrix_H
00004 #define ClpPlusMinusOneMatrix_H
00005 
00006 
00007 #include "CoinPragma.hpp"
00008 
00009 #include "ClpMatrixBase.hpp"
00010 
00015 class ClpPlusMinusOneMatrix : public ClpMatrixBase {
00016   
00017 public:
00020 
00021    virtual CoinPackedMatrix * getPackedMatrix() const;
00023   virtual bool isColOrdered() const ;
00025   virtual  CoinBigIndex getNumElements() const; 
00027    virtual int getNumCols() const { return numberColumns_; }
00029   virtual int getNumRows() const { return numberRows_; }
00030 
00035   virtual const double * getElements() const; 
00041   virtual const int * getIndices() const
00042   { return indices_;}
00043   // and for advanced use
00044   int * getMutableIndices() const
00045   { return indices_;}
00046 
00047   virtual const CoinBigIndex * getVectorStarts() const;
00049   virtual const int * getVectorLengths() const;
00050 
00052   virtual void deleteCols(const int numDel, const int * indDel);
00054   virtual void deleteRows(const int numDel, const int * indDel);
00056   virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
00058   virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
00059 #ifndef SLIM_CLP
00060 
00064   virtual int appendMatrix(int number, int type,
00065                            const CoinBigIndex * starts, const int * index,
00066                            const double * element, int numberOther=-1);
00067 #endif
00068 
00069   virtual ClpMatrixBase * reverseOrderedCopy() const;
00071   virtual CoinBigIndex countBasis(ClpSimplex * model,
00072                                  const int * whichColumn, 
00073                                  int numberRowBasic,
00074                                   int & numberColumnBasic);
00076   virtual void fillBasis(ClpSimplex * model,
00077                                  const int * whichColumn, 
00078                                  int & numberColumnBasic,
00079                                  int * row, int * start,
00080                                  int * rowCount, int * columnCount,
00081                                  double * element);
00086   virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model,int * inputWeights) const;
00090   virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00091                        double & smallestPositive, double & largestPositive);
00094   virtual void unpack(const ClpSimplex * model,CoinIndexedVector * rowArray,
00095                    int column) const ;
00100   virtual void unpackPacked(ClpSimplex * model,
00101                             CoinIndexedVector * rowArray,
00102                             int column) const;
00105   virtual void add(const ClpSimplex * model,CoinIndexedVector * rowArray,
00106                    int column, double multiplier) const ;
00108   virtual void add(const ClpSimplex * model,double * array,
00109                    int column, double multiplier) const;
00111    virtual void releasePackedMatrix() const;
00117   virtual void setDimensions(int numrows, int numcols);
00119   void checkValid(bool detail) const;
00121 
00127   virtual void times(double scalar,
00128                        const double * x, double * y) const;
00130   virtual void times(double scalar,
00131                      const double * x, double * y,
00132                      const double * rowScale, 
00133                      const double * columnScale) const;
00137     virtual void transposeTimes(double scalar,
00138                                 const double * x, double * y) const;
00140     virtual void transposeTimes(double scalar,
00141                                 const double * x, double * y,
00142                                 const double * rowScale, 
00143                                 const double * columnScale, double * spare=NULL) const;
00148   virtual void transposeTimes(const ClpSimplex * model, double scalar,
00149                               const CoinIndexedVector * x,
00150                               CoinIndexedVector * y,
00151                               CoinIndexedVector * z) const;
00157   virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
00158                               const CoinIndexedVector * x,
00159                               CoinIndexedVector * y,
00160                               CoinIndexedVector * z) const;
00164   virtual void subsetTransposeTimes(const ClpSimplex * model,
00165                                     const CoinIndexedVector * x,
00166                                     const CoinIndexedVector * y,
00167                                     CoinIndexedVector * z) const;
00170   virtual bool canCombine(const ClpSimplex * model,
00171                           const CoinIndexedVector * pi) const;
00173   virtual void transposeTimes2(const ClpSimplex * model,
00174                                const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
00175                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
00176                                CoinIndexedVector * spare,
00177                                double referenceIn, double devex,
00178                                // Array for exact devex to say what is in reference framework
00179                                unsigned int * reference,
00180                                double * weights, double scaleFactor);
00182   virtual void subsetTimes2(const ClpSimplex * model,
00183                                 CoinIndexedVector * dj1,
00184                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
00185                                double referenceIn, double devex,
00186                                // Array for exact devex to say what is in reference framework
00187                                unsigned int * reference,
00188                                double * weights, double scaleFactor);
00190 
00193 
00194   inline CoinBigIndex * startPositive() const
00195   { return startPositive_;}
00197   inline CoinBigIndex * startNegative() const
00198   { return startNegative_;}
00200 
00201 
00205    ClpPlusMinusOneMatrix();
00207    virtual ~ClpPlusMinusOneMatrix();
00209 
00213    ClpPlusMinusOneMatrix(const ClpPlusMinusOneMatrix&);
00220    ClpPlusMinusOneMatrix(const CoinPackedMatrix&);
00222   ClpPlusMinusOneMatrix(int numberRows, int numberColumns,
00223                         bool columnOrdered, const int * indices,
00224                         const CoinBigIndex * startPositive, const CoinBigIndex * startNegative);
00227   ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & wholeModel,
00228                     int numberRows, const int * whichRows,
00229                     int numberColumns, const int * whichColumns);
00230 
00231    ClpPlusMinusOneMatrix& operator=(const ClpPlusMinusOneMatrix&);
00233   virtual ClpMatrixBase * clone() const ;
00236   virtual ClpMatrixBase * subsetClone (
00237                     int numberRows, const int * whichRows,
00238                     int numberColumns, const int * whichColumns) const ;
00240   void passInCopy(int numberRows, int numberColumns,
00241                   bool columnOrdered, int * indices,
00242                   CoinBigIndex * startPositive, CoinBigIndex * startNegative);
00244   virtual bool canDoPartialPricing() const;
00246   virtual void partialPricing(ClpSimplex * model, double start, double end,
00247                       int & bestSequence, int & numberWanted);
00249    
00250     
00251 protected:
00255 
00256   mutable CoinPackedMatrix * matrix_;
00257   mutable int * lengths_;
00259   CoinBigIndex * startPositive_;
00261   CoinBigIndex * startNegative_;
00263   int * indices_;
00265   int numberRows_;
00267   int numberColumns_;
00269   bool columnOrdered_;
00270   
00272 };
00273 
00274 #endif

Generated on Sun Nov 14 14:06:32 2010 for Coin-All by  doxygen 1.4.7