/build/buildd/clp-1.12.0/Clp/src/ClpGubMatrix.hpp
Go to the documentation of this file.
00001 /* $Id: ClpGubMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
00002 // Copyright (C) 2003, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef ClpGubMatrix_H
00005 #define ClpGubMatrix_H
00006 
00007 
00008 #include "CoinPragma.hpp"
00009 
00010 #include "ClpPackedMatrix.hpp"
00011 class ClpSimplex;
00020 class ClpGubMatrix : public ClpPackedMatrix {
00021 
00022 public:
00026      virtual ClpMatrixBase * reverseOrderedCopy() const;
00028      virtual CoinBigIndex countBasis(const int * whichColumn,
00029                                      int & numberColumnBasic);
00031      virtual void fillBasis(ClpSimplex * model,
00032                             const int * whichColumn,
00033                             int & numberColumnBasic,
00034                             int * row, int * start,
00035                             int * rowCount, int * columnCount,
00036                             CoinFactorizationDouble * element);
00039      virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
00040                          int column) const ;
00045      virtual void unpackPacked(ClpSimplex * model,
00046                                CoinIndexedVector * rowArray,
00047                                int column) const;
00050      virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
00051                       int column, double multiplier) const ;
00053      virtual void add(const ClpSimplex * model, double * array,
00054                       int column, double multiplier) const;
00056      virtual void partialPricing(ClpSimplex * model, double start, double end,
00057                                  int & bestSequence, int & numberWanted);
00059      virtual int hiddenRows() const;
00061 
00064 
00065      using ClpPackedMatrix::transposeTimes ;
00070      virtual void transposeTimes(const ClpSimplex * model, double scalar,
00071                                  const CoinIndexedVector * x,
00072                                  CoinIndexedVector * y,
00073                                  CoinIndexedVector * z) const;
00079      virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
00080                                       const CoinIndexedVector * x,
00081                                       CoinIndexedVector * y,
00082                                       CoinIndexedVector * z) const;
00086      virtual void subsetTransposeTimes(const ClpSimplex * model,
00087                                        const CoinIndexedVector * x,
00088                                        const CoinIndexedVector * y,
00089                                        CoinIndexedVector * z) const;
00096      virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode);
00102      virtual void primalExpanded(ClpSimplex * model, int mode);
00111      virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
00112                                double * other, int mode);
00130      virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
00134      virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
00136      virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
00140      virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
00141                                 bool check = false);
00154      virtual int synchronize(ClpSimplex * model, int mode);
00156      virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ;
00158 
00159 
00160 
00164      ClpGubMatrix();
00166      virtual ~ClpGubMatrix();
00168 
00172      ClpGubMatrix(const ClpGubMatrix&);
00174      ClpGubMatrix(const CoinPackedMatrix&);
00177      ClpGubMatrix (const ClpGubMatrix & wholeModel,
00178                    int numberRows, const int * whichRows,
00179                    int numberColumns, const int * whichColumns);
00180      ClpGubMatrix (const CoinPackedMatrix & wholeModel,
00181                    int numberRows, const int * whichRows,
00182                    int numberColumns, const int * whichColumns);
00183 
00185      ClpGubMatrix(CoinPackedMatrix * matrix);
00186 
00189      ClpGubMatrix(ClpPackedMatrix * matrix, int numberSets,
00190                   const int * start, const int * end,
00191                   const double * lower, const double * upper,
00192                   const unsigned char * status = NULL);
00193 
00194      ClpGubMatrix& operator=(const ClpGubMatrix&);
00196      virtual ClpMatrixBase * clone() const ;
00199      virtual ClpMatrixBase * subsetClone (
00200           int numberRows, const int * whichRows,
00201           int numberColumns, const int * whichColumns) const ;
00203      void redoSet(ClpSimplex * model, int newKey, int oldKey, int iSet);
00205 
00207 
00208      inline ClpSimplex::Status getStatus(int sequence) const {
00209           return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
00210      }
00211      inline void setStatus(int sequence, ClpSimplex::Status status) {
00212           unsigned char & st_byte = status_[sequence];
00213           st_byte = static_cast<unsigned char>(st_byte & ~7);
00214           st_byte = static_cast<unsigned char>(st_byte | status);
00215      }
00217      inline void setFlagged( int sequence) {
00218           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 64);
00219      }
00220      inline void clearFlagged( int sequence) {
00221           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
00222      }
00223      inline bool flagged(int sequence) const {
00224           return ((status_[sequence] & 64) != 0);
00225      }
00227      inline void setAbove( int sequence) {
00228           unsigned char iStat = status_[sequence];
00229           iStat = static_cast<unsigned char>(iStat & ~24);
00230           status_[sequence] = static_cast<unsigned char>(iStat | 16);
00231      }
00233      inline void setFeasible( int sequence) {
00234           unsigned char iStat = status_[sequence];
00235           iStat = static_cast<unsigned char>(iStat & ~24);
00236           status_[sequence] = static_cast<unsigned char>(iStat | 8);
00237      }
00239      inline void setBelow( int sequence) {
00240           unsigned char iStat = status_[sequence];
00241           iStat = static_cast<unsigned char>(iStat & ~24);
00242           status_[sequence] = iStat;
00243      }
00244      inline double weight( int sequence) const {
00245           int iStat = status_[sequence] & 31;
00246           iStat = iStat >> 3;
00247           return static_cast<double> (iStat - 1);
00248      }
00250      inline int * start() const {
00251           return start_;
00252      }
00254      inline int * end() const {
00255           return end_;
00256      }
00258      inline double * lower() const {
00259           return lower_;
00260      }
00262      inline double * upper() const {
00263           return upper_;
00264      }
00266      inline int * keyVariable() const {
00267           return keyVariable_;
00268      }
00270      inline int * backward() const {
00271           return backward_;
00272      }
00274      inline int numberSets() const {
00275           return numberSets_;
00276      }
00278      void switchOffCheck();
00280 
00281 
00282 protected:
00286 
00287      double sumDualInfeasibilities_;
00289      double sumPrimalInfeasibilities_;
00291      double sumOfRelaxedDualInfeasibilities_;
00293      double sumOfRelaxedPrimalInfeasibilities_;
00295      double infeasibilityWeight_;
00297      int * start_;
00299      int * end_;
00301      double * lower_;
00303      double * upper_;
00305      mutable unsigned char * status_;
00307      unsigned char * saveStatus_;
00309      int * savedKeyVariable_;
00311      int * backward_;
00313      int * backToPivotRow_;
00315      double * changeCost_;
00317      mutable int * keyVariable_;
00321      mutable int * next_;
00323      int * toIndex_;
00324      // Reverse pointer from index to set
00325      int * fromIndex_;
00327      ClpSimplex * model_;
00329      int numberDualInfeasibilities_;
00331      int numberPrimalInfeasibilities_;
00337      int noCheck_;
00339      int numberSets_;
00341      int saveNumber_;
00343      int possiblePivotKey_;
00345      int gubSlackIn_;
00347      int firstGub_;
00349      int lastGub_;
00352      int gubType_;
00354 };
00355 
00356 #endif