- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Blis-0.91.0/Clp/src/ClpDynamicMatrix.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003 #ifndef ClpDynamicMatrix_H
    00004 #define ClpDynamicMatrix_H
    00005
    00006
    00007 #include "CoinPragma.hpp"
    00008
    00009 #include "ClpPackedMatrix.hpp"
    00010 class ClpSimplex;
    00017 class ClpDynamicMatrix : public ClpPackedMatrix {
    00018
    00019 public:
    00021   enum DynamicStatus {
    00022     soloKey = 0x00,
    00023     inSmall = 0x01,
    00024     atUpperBound = 0x02,
    00025     atLowerBound = 0x03
    00026   };
    00029
    00030   virtual void partialPricing(ClpSimplex * model, double start, double end,
    00031                       int & bestSequence, int & numberWanted);
    00032
    00036   virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
    00040   virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
    00041                                 bool check=false);
    00042
    00043   using ClpPackedMatrix::times ;
    00047   virtual void times(double scalar,
    00048                        const double * x, double * y) const;
    00050   void modifyOffset(int sequence, double amount);
    00052   double keyValue(int iSet) const;
    00061   virtual void dualExpanded(ClpSimplex * model,CoinIndexedVector * array,
    00062                             double * other,int mode);
    00080   virtual int generalExpanded(ClpSimplex * model,int mode,int & number);
    00085   virtual int refresh(ClpSimplex * model);
    00089   virtual void createVariable(ClpSimplex * model, int & bestSequence);
    00091   virtual double reducedCost( ClpSimplex * model,int sequence) const;
    00093   void gubCrash();
    00095   void initialProblem();
    00097   int addColumn(int numberEntries,const int * row, const double * element,
    00098                  double cost, double lower, double upper, int iSet,
    00099                  DynamicStatus status);
    00104   virtual void packDown(const int * in, int numberToPack) {}
    00106   inline double columnLower(int sequence) const
    00107   { if (columnLower_) return columnLower_[sequence]; else return 0.0;}
    00109   inline double columnUpper(int sequence) const
    00110   { if (columnUpper_) return columnUpper_[sequence]; else return COIN_DBL_MAX;}
    00111
    00113
    00114
    00115
    00119    ClpDynamicMatrix();
    00126   ClpDynamicMatrix(ClpSimplex * model, int numberSets,
    00127                    int numberColumns, const int * starts,
    00128                    const double * lower, const double * upper,
    00129                    const int * startColumn, const int * row,
    00130                    const double * element, const double * cost,
    00131                    const double * columnLower=NULL, const double * columnUpper=NULL,
    00132                    const unsigned char * status=NULL,
    00133                    const unsigned char * dynamicStatus=NULL);
    00134
    00136    virtual ~ClpDynamicMatrix();
    00138
    00142    ClpDynamicMatrix(const ClpDynamicMatrix&);
    00144    ClpDynamicMatrix(const CoinPackedMatrix&);
    00145
    00146    ClpDynamicMatrix& operator=(const ClpDynamicMatrix&);
    00148   virtual ClpMatrixBase * clone() const ;
    00150
    00152
    00153   inline ClpSimplex::Status getStatus(int sequence) const
    00154   {return static_cast<ClpSimplex::Status> (status_[sequence]&7);}
    00155   inline void setStatus(int sequence, ClpSimplex::Status status)
    00156   {
    00157     unsigned char & st_byte = status_[sequence];
    00158     st_byte = static_cast<unsigned char>(st_byte & ~7);
    00159     st_byte = static_cast<unsigned char>(st_byte | status);
    00160   }
    00162   inline int numberSets() const
    00163   { return numberSets_;}
    00165   inline bool flagged(int i) const {
    00166     return (dynamicStatus_[i]&8)!=0;
    00167   }
    00168   inline void setFlagged(int i) {
    00169     dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
    00170   }
    00171   inline void unsetFlagged(int i) {
    00172     dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
    00173   }
    00174   inline void setDynamicStatus(int sequence, DynamicStatus status)
    00175   {
    00176     unsigned char & st_byte = dynamicStatus_[sequence];
    00177     st_byte = static_cast<unsigned char>(st_byte & ~7);
    00178     st_byte = static_cast<unsigned char>(st_byte | status);
    00179   }
    00180   inline DynamicStatus getDynamicStatus(int sequence) const
    00181   {return static_cast<DynamicStatus> (dynamicStatus_[sequence]&7);}
    00183   inline double objectiveOffset() const
    00184   { return objectiveOffset_;}
    00186   inline CoinBigIndex * startColumn() const
    00187   { return startColumn_;}
    00189   inline int * row() const
    00190   { return row_;}
    00192   inline double * element() const
    00193   { return element_;}
    00195   inline double * cost() const
    00196   { return cost_;}
    00198   inline int * id() const
    00199   { return id_;}
    00201   inline double * columnLower() const
    00202   { return columnLower_;}
    00204   inline double * columnUpper() const
    00205   { return columnUpper_;}
    00207   inline double * lowerSet() const
    00208   { return lowerSet_;}
    00210   inline double * upperSet() const
    00211   { return upperSet_;}
    00213   inline int numberGubColumns() const
    00214   { return numberGubColumns_;}
    00216   inline int firstAvailable() const
    00217   { return firstAvailable_;}
    00219   inline int firstDynamic() const
    00220   { return firstDynamic_;}
    00222   inline int lastDynamic() const
    00223   { return lastDynamic_;}
    00225   inline int numberStaticRows() const
    00226   { return numberStaticRows_;}
    00228   inline int numberElements() const
    00229   { return numberElements_;}
    00230   inline int * keyVariable() const
    00231   { return keyVariable_;}
    00233   void switchOffCheck();
    00235   inline unsigned char * gubRowStatus() const
    00236   { return status_;}
    00238   inline unsigned char * dynamicStatus() const
    00239   { return dynamicStatus_;}
    00241   int whichSet (int sequence) const;
    00243
    00244
    00245 protected:
    00249
    00250   double sumDualInfeasibilities_;
    00252   double sumPrimalInfeasibilities_;
    00254   double sumOfRelaxedDualInfeasibilities_;
    00256   double sumOfRelaxedPrimalInfeasibilities_;
    00258   double savedBestGubDual_;
    00260   int savedBestSet_;
    00262   int * backToPivotRow_;
    00264   mutable int * keyVariable_;
    00266   int * toIndex_;
    00267   // Reverse pointer from index to set
    00268   int * fromIndex_;
    00270   int numberSets_;
    00272   int numberActiveSets_;
    00274   double objectiveOffset_;
    00276   double * lowerSet_;
    00278   double * upperSet_;
    00280   unsigned char * status_;
    00282   ClpSimplex * model_;
    00284   int firstAvailable_;
    00286   int firstAvailableBefore_;
    00288   int firstDynamic_;
    00290   int lastDynamic_;
    00292   int numberStaticRows_;
    00294   int numberElements_;
    00296   int numberDualInfeasibilities_;
    00298   int numberPrimalInfeasibilities_;
    00304   int noCheck_;
    00306   double infeasibilityWeight_;
    00308   int numberGubColumns_;
    00310   int maximumGubColumns_;
    00312   int maximumElements_;
    00314   int * startSet_;
    00316   int * next_;
    00318   CoinBigIndex * startColumn_;
    00320   int * row_;
    00322   double * element_;
    00324   double * cost_;
    00326   int * id_;
    00328   unsigned char * dynamicStatus_;
    00330   double * columnLower_;
    00332   double * columnUpper_;
    00334 };
    00335
    00336 #endif