Clp trunk
ClpPlusMinusOneMatrix.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 // Copyright (C) 2003, 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 ClpPlusMinusOneMatrix_H
00007 #define ClpPlusMinusOneMatrix_H
00008 
00009 
00010 #include "CoinPragma.hpp"
00011 
00012 #include "ClpMatrixBase.hpp"
00013 
00018 class ClpPlusMinusOneMatrix : public ClpMatrixBase {
00019 
00020 public:
00023 
00024      virtual CoinPackedMatrix * getPackedMatrix() const;
00026      virtual bool isColOrdered() const ;
00028      virtual  CoinBigIndex getNumElements() const;
00030      virtual int getNumCols() const {
00031           return numberColumns_;
00032      }
00034      virtual int getNumRows() const {
00035           return numberRows_;
00036      }
00037 
00042      virtual const double * getElements() const;
00048      virtual const int * getIndices() const {
00049           return indices_;
00050      }
00051      // and for advanced use
00052      int * getMutableIndices() const {
00053           return indices_;
00054      }
00055 
00056      virtual const CoinBigIndex * getVectorStarts() const;
00058      virtual const int * getVectorLengths() const;
00059 
00061      virtual void deleteCols(const int numDel, const int * indDel);
00063      virtual void deleteRows(const int numDel, const int * indDel);
00065      virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
00067      virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
00068 #ifndef SLIM_CLP
00069 
00073      virtual int appendMatrix(int number, int type,
00074                               const CoinBigIndex * starts, const int * index,
00075                               const double * element, int numberOther = -1);
00076 #endif
00077 
00078      virtual ClpMatrixBase * reverseOrderedCopy() const;
00080      virtual CoinBigIndex countBasis(
00081           const int * whichColumn,
00082           int & numberColumnBasic);
00084      virtual void fillBasis(ClpSimplex * model,
00085                             const int * whichColumn,
00086                             int & numberColumnBasic,
00087                             int * row, int * start,
00088                             int * rowCount, int * columnCount,
00089                             CoinFactorizationDouble * element);
00094      virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
00098      virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00099                                   double & smallestPositive, double & largestPositive);
00102      virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
00103                          int column) const ;
00108      virtual void unpackPacked(ClpSimplex * model,
00109                                CoinIndexedVector * rowArray,
00110                                int column) const;
00113      virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
00114                       int column, double multiplier) const ;
00116      virtual void add(const ClpSimplex * model, double * array,
00117                       int column, double multiplier) const;
00119      virtual void releasePackedMatrix() const;
00125      virtual void setDimensions(int numrows, int numcols);
00127      void checkValid(bool detail) const;
00129 
00135      virtual void times(double scalar,
00136                         const double * x, double * y) const;
00138      virtual void times(double scalar,
00139                         const double * x, double * y,
00140                         const double * rowScale,
00141                         const double * columnScale) const;
00145      virtual void transposeTimes(double scalar,
00146                                  const double * x, double * y) const;
00148      virtual void transposeTimes(double scalar,
00149                                  const double * x, double * y,
00150                                  const double * rowScale,
00151                                  const double * columnScale, double * spare = NULL) const;
00156      virtual void transposeTimes(const ClpSimplex * model, double scalar,
00157                                  const CoinIndexedVector * x,
00158                                  CoinIndexedVector * y,
00159                                  CoinIndexedVector * z) const;
00165      virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
00166                                       const CoinIndexedVector * x,
00167                                       CoinIndexedVector * y,
00168                                       CoinIndexedVector * z) const;
00172      virtual void subsetTransposeTimes(const ClpSimplex * model,
00173                                        const CoinIndexedVector * x,
00174                                        const CoinIndexedVector * y,
00175                                        CoinIndexedVector * z) const;
00178      virtual bool canCombine(const ClpSimplex * model,
00179                              const CoinIndexedVector * pi) const;
00181      virtual void transposeTimes2(const ClpSimplex * model,
00182                                   const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
00183                                   const CoinIndexedVector * pi2,
00184                                   CoinIndexedVector * spare,
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      virtual void subsetTimes2(const ClpSimplex * model,
00191                                CoinIndexedVector * dj1,
00192                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
00193                                double referenceIn, double devex,
00194                                // Array for exact devex to say what is in reference framework
00195                                unsigned int * reference,
00196                                double * weights, double scaleFactor);
00198 
00201 
00202      inline CoinBigIndex * startPositive() const {
00203           return startPositive_;
00204      }
00206      inline CoinBigIndex * startNegative() const {
00207           return startNegative_;
00208      }
00210 
00211 
00215      ClpPlusMinusOneMatrix();
00217      virtual ~ClpPlusMinusOneMatrix();
00219 
00223      ClpPlusMinusOneMatrix(const ClpPlusMinusOneMatrix&);
00230      ClpPlusMinusOneMatrix(const CoinPackedMatrix&);
00232      ClpPlusMinusOneMatrix(int numberRows, int numberColumns,
00233                            bool columnOrdered, const int * indices,
00234                            const CoinBigIndex * startPositive, const CoinBigIndex * startNegative);
00237      ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & wholeModel,
00238                             int numberRows, const int * whichRows,
00239                             int numberColumns, const int * whichColumns);
00240 
00241      ClpPlusMinusOneMatrix& operator=(const ClpPlusMinusOneMatrix&);
00243      virtual ClpMatrixBase * clone() const ;
00246      virtual ClpMatrixBase * subsetClone (
00247           int numberRows, const int * whichRows,
00248           int numberColumns, const int * whichColumns) const ;
00250      void passInCopy(int numberRows, int numberColumns,
00251                      bool columnOrdered, int * indices,
00252                      CoinBigIndex * startPositive, CoinBigIndex * startNegative);
00254      virtual bool canDoPartialPricing() const;
00256      virtual void partialPricing(ClpSimplex * model, double start, double end,
00257                                  int & bestSequence, int & numberWanted);
00259 
00260 
00261 protected:
00265 
00266      mutable CoinPackedMatrix * matrix_;
00267      mutable int * lengths_;
00269      CoinBigIndex * startPositive_;
00271      CoinBigIndex * startNegative_;
00273      int * indices_;
00275      int numberRows_;
00277      int numberColumns_;
00279      bool columnOrdered_;
00280 
00282 };
00283 
00284 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines