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

- File List
- File Members

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

Go to the documentation of this file.

    00001 /* $Id: ClpDynamicMatrix.hpp 1458 2009-11-05 12:34:07Z forrest $ */
    00002 // Copyright (C) 2004, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 #ifndef ClpDynamicMatrix_H
    00005 #define ClpDynamicMatrix_H
    00006
    00007
    00008 #include "CoinPragma.hpp"
    00009
    00010 #include "ClpPackedMatrix.hpp"
    00011 class ClpSimplex;
    00018 class ClpDynamicMatrix : public ClpPackedMatrix {
    00019
    00020 public:
    00022   enum DynamicStatus {
    00023     soloKey = 0x00,
    00024     inSmall = 0x01,
    00025     atUpperBound = 0x02,
    00026     atLowerBound = 0x03
    00027   };
    00030
    00031   virtual void partialPricing(ClpSimplex * model, double start, double end,
    00032                       int & bestSequence, int & numberWanted);
    00033
    00037   virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
    00041   virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
    00042                                 bool check=false);
    00043
    00044   using ClpPackedMatrix::times ;
    00048   virtual void times(double scalar,
    00049                        const double * x, double * y) const;
    00051   void modifyOffset(int sequence, double amount);
    00053   double keyValue(int iSet) const;
    00062   virtual void dualExpanded(ClpSimplex * model,CoinIndexedVector * array,
    00063                             double * other,int mode);
    00081   virtual int generalExpanded(ClpSimplex * model,int mode,int & number);
    00086   virtual int refresh(ClpSimplex * model);
    00090   virtual void createVariable(ClpSimplex * model, int & bestSequence);
    00092   virtual double reducedCost( ClpSimplex * model,int sequence) const;
    00094   void gubCrash();
    00096   void initialProblem();
    00098   int addColumn(int numberEntries,const int * row, const double * element,
    00099                  double cost, double lower, double upper, int iSet,
    00100                  DynamicStatus status);
    00105   virtual void packDown(const int * , int ) {}
    00107   inline double columnLower(int sequence) const
    00108   { if (columnLower_) return columnLower_[sequence]; else return 0.0;}
    00110   inline double columnUpper(int sequence) const
    00111   { if (columnUpper_) return columnUpper_[sequence]; else return COIN_DBL_MAX;}
    00112
    00114
    00115
    00116
    00120    ClpDynamicMatrix();
    00127   ClpDynamicMatrix(ClpSimplex * model, int numberSets,
    00128                    int numberColumns, const int * starts,
    00129                    const double * lower, const double * upper,
    00130                    const int * startColumn, const int * row,
    00131                    const double * element, const double * cost,
    00132                    const double * columnLower=NULL, const double * columnUpper=NULL,
    00133                    const unsigned char * status=NULL,
    00134                    const unsigned char * dynamicStatus=NULL);
    00135
    00137    virtual ~ClpDynamicMatrix();
    00139
    00143    ClpDynamicMatrix(const ClpDynamicMatrix&);
    00145    ClpDynamicMatrix(const CoinPackedMatrix&);
    00146
    00147    ClpDynamicMatrix& operator=(const ClpDynamicMatrix&);
    00149   virtual ClpMatrixBase * clone() const ;
    00151
    00153
    00154   inline ClpSimplex::Status getStatus(int sequence) const
    00155   {return static_cast<ClpSimplex::Status> (status_[sequence]&7);}
    00156   inline void setStatus(int sequence, ClpSimplex::Status status)
    00157   {
    00158     unsigned char & st_byte = status_[sequence];
    00159     st_byte = static_cast<unsigned char>(st_byte & ~7);
    00160     st_byte = static_cast<unsigned char>(st_byte | status);
    00161   }
    00163   inline int numberSets() const
    00164   { return numberSets_;}
    00166   inline bool flagged(int i) const {
    00167     return (dynamicStatus_[i]&8)!=0;
    00168   }
    00169   inline void setFlagged(int i) {
    00170     dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
    00171   }
    00172   inline void unsetFlagged(int i) {
    00173     dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
    00174   }
    00175   inline void setDynamicStatus(int sequence, DynamicStatus status)
    00176   {
    00177     unsigned char & st_byte = dynamicStatus_[sequence];
    00178     st_byte = static_cast<unsigned char>(st_byte & ~7);
    00179     st_byte = static_cast<unsigned char>(st_byte | status);
    00180   }
    00181   inline DynamicStatus getDynamicStatus(int sequence) const
    00182   {return static_cast<DynamicStatus> (dynamicStatus_[sequence]&7);}
    00184   inline double objectiveOffset() const
    00185   { return objectiveOffset_;}
    00187   inline CoinBigIndex * startColumn() const
    00188   { return startColumn_;}
    00190   inline int * row() const
    00191   { return row_;}
    00193   inline double * element() const
    00194   { return element_;}
    00196   inline double * cost() const
    00197   { return cost_;}
    00199   inline int * id() const
    00200   { return id_;}
    00202   inline double * columnLower() const
    00203   { return columnLower_;}
    00205   inline double * columnUpper() const
    00206   { return columnUpper_;}
    00208   inline double * lowerSet() const
    00209   { return lowerSet_;}
    00211   inline double * upperSet() const
    00212   { return upperSet_;}
    00214   inline int numberGubColumns() const
    00215   { return numberGubColumns_;}
    00217   inline int firstAvailable() const
    00218   { return firstAvailable_;}
    00220   inline int firstDynamic() const
    00221   { return firstDynamic_;}
    00223   inline int lastDynamic() const
    00224   { return lastDynamic_;}
    00226   inline int numberStaticRows() const
    00227   { return numberStaticRows_;}
    00229   inline int numberElements() const
    00230   { return numberElements_;}
    00231   inline int * keyVariable() const
    00232   { return keyVariable_;}
    00234   void switchOffCheck();
    00236   inline unsigned char * gubRowStatus() const
    00237   { return status_;}
    00239   inline unsigned char * dynamicStatus() const
    00240   { return dynamicStatus_;}
    00242   int whichSet (int sequence) const;
    00244
    00245
    00246 protected:
    00250
    00251   double sumDualInfeasibilities_;
    00253   double sumPrimalInfeasibilities_;
    00255   double sumOfRelaxedDualInfeasibilities_;
    00257   double sumOfRelaxedPrimalInfeasibilities_;
    00259   double savedBestGubDual_;
    00261   int savedBestSet_;
    00263   int * backToPivotRow_;
    00265   mutable int * keyVariable_;
    00267   int * toIndex_;
    00268   // Reverse pointer from index to set
    00269   int * fromIndex_;
    00271   int numberSets_;
    00273   int numberActiveSets_;
    00275   double objectiveOffset_;
    00277   double * lowerSet_;
    00279   double * upperSet_;
    00281   unsigned char * status_;
    00283   ClpSimplex * model_;
    00285   int firstAvailable_;
    00287   int firstAvailableBefore_;
    00289   int firstDynamic_;
    00291   int lastDynamic_;
    00293   int numberStaticRows_;
    00295   int numberElements_;
    00297   int numberDualInfeasibilities_;
    00299   int numberPrimalInfeasibilities_;
    00305   int noCheck_;
    00307   double infeasibilityWeight_;
    00309   int numberGubColumns_;
    00311   int maximumGubColumns_;
    00313   int maximumElements_;
    00315   int * startSet_;
    00317   int * next_;
    00319   CoinBigIndex * startColumn_;
    00321   int * row_;
    00323   double * element_;
    00325   double * cost_;
    00327   int * id_;
    00329   unsigned char * dynamicStatus_;
    00331   double * columnLower_;
    00333   double * columnUpper_;
    00335 };
    00336
    00337 #endif