/build/buildd/clp-1.12.0/Clp/src/ClpGubDynamicMatrix.hpp
Go to the documentation of this file.
00001 /* $Id: ClpGubDynamicMatrix.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 ClpGubDynamicMatrix_H
00005 #define ClpGubDynamicMatrix_H
00006 
00007 
00008 #include "CoinPragma.hpp"
00009 
00010 #include "ClpGubMatrix.hpp"
00018 class ClpGubDynamicMatrix : public ClpGubMatrix {
00019 
00020 public:
00023 
00024      virtual void partialPricing(ClpSimplex * model, double start, double end,
00025                                  int & bestSequence, int & numberWanted);
00036      virtual int synchronize(ClpSimplex * model, int mode);
00038      virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
00042      virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
00044      void insertNonBasic(int sequence, int iSet);
00048      virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
00049                                 bool check = false);
00050 
00051      using ClpPackedMatrix::times ;
00055      virtual void times(double scalar,
00056                         const double * x, double * y) const;
00060      virtual int checkFeasible(ClpSimplex * model, double & sum) const;
00062      void cleanData(ClpSimplex * model);
00064 
00065 
00066 
00070      ClpGubDynamicMatrix();
00072      virtual ~ClpGubDynamicMatrix();
00074 
00078      ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
00083      ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
00084                          int numberColumns, const int * starts,
00085                          const double * lower, const double * upper,
00086                          const int * startColumn, const int * row,
00087                          const double * element, const double * cost,
00088                          const double * lowerColumn = NULL, const double * upperColumn = NULL,
00089                          const unsigned char * status = NULL);
00090 
00091      ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
00093      virtual ClpMatrixBase * clone() const ;
00095 
00097 
00098      enum DynamicStatus {
00099           inSmall = 0x01,
00100           atUpperBound = 0x02,
00101           atLowerBound = 0x03
00102      };
00104      inline bool flagged(int i) const {
00105           return (dynamicStatus_[i] & 8) != 0;
00106      }
00107      inline void setFlagged(int i) {
00108           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
00109      }
00110      inline void unsetFlagged(int i) {
00111           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
00112      }
00113      inline void setDynamicStatus(int sequence, DynamicStatus status) {
00114           unsigned char & st_byte = dynamicStatus_[sequence];
00115           st_byte = static_cast<unsigned char>(st_byte & ~7);
00116           st_byte = static_cast<unsigned char>(st_byte | status);
00117      }
00118      inline DynamicStatus getDynamicStatus(int sequence) const {
00119           return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
00120      }
00122      inline double objectiveOffset() const {
00123           return objectiveOffset_;
00124      }
00126      inline CoinBigIndex * startColumn() const {
00127           return startColumn_;
00128      }
00130      inline int * row() const {
00131           return row_;
00132      }
00134      inline double * element() const {
00135           return element_;
00136      }
00138      inline double * cost() const {
00139           return cost_;
00140      }
00142      inline int * fullStart() const {
00143           return fullStart_;
00144      }
00146      inline int * id() const {
00147           return id_;
00148      }
00150      inline double * lowerColumn() const {
00151           return lowerColumn_;
00152      }
00154      inline double * upperColumn() const {
00155           return upperColumn_;
00156      }
00158      inline double * lowerSet() const {
00159           return lowerSet_;
00160      }
00162      inline double * upperSet() const {
00163           return upperSet_;
00164      }
00166      inline int numberGubColumns() const {
00167           return numberGubColumns_;
00168      }
00170      inline int firstAvailable() const {
00171           return firstAvailable_;
00172      }
00174      inline void setFirstAvailable(int value) {
00175           firstAvailable_ = value;
00176      }
00178      inline int firstDynamic() const {
00179           return firstDynamic_;
00180      }
00182      inline int lastDynamic() const {
00183           return lastDynamic_;
00184      }
00186      inline int numberElements() const {
00187           return numberElements_;
00188      }
00190      inline unsigned char * gubRowStatus() const {
00191           return status_;
00192      }
00194      inline unsigned char * dynamicStatus() const {
00195           return dynamicStatus_;
00196      }
00198      int whichSet (int sequence) const;
00200 
00201 
00202 protected:
00206 
00207      double objectiveOffset_;
00209      CoinBigIndex * startColumn_;
00211      int * row_;
00213      double * element_;
00215      double * cost_;
00217      int * fullStart_;
00219      int * id_;
00221      unsigned char * dynamicStatus_;
00223      double * lowerColumn_;
00225      double * upperColumn_;
00227      double * lowerSet_;
00229      double * upperSet_;
00231      int numberGubColumns_;
00233      int firstAvailable_;
00235      int savedFirstAvailable_;
00237      int firstDynamic_;
00239      int lastDynamic_;
00241      int numberElements_;
00243 };
00244 
00245 #endif