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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Clp/src/ClpDynamicMatrix.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpDynamicMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
    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];
    00109           else return 0.0;
    00110      }
    00112      inline double columnUpper(int sequence) const {
    00113           if (columnUpper_) return columnUpper_[sequence];
    00114           else return COIN_DBL_MAX;
    00115      }
    00116
    00118
    00119
    00120
    00124      ClpDynamicMatrix();
    00131      ClpDynamicMatrix(ClpSimplex * model, int numberSets,
    00132                       int numberColumns, const int * starts,
    00133                       const double * lower, const double * upper,
    00134                       const int * startColumn, const int * row,
    00135                       const double * element, const double * cost,
    00136                       const double * columnLower = NULL, const double * columnUpper = NULL,
    00137                       const unsigned char * status = NULL,
    00138                       const unsigned char * dynamicStatus = NULL);
    00139
    00141      virtual ~ClpDynamicMatrix();
    00143
    00147      ClpDynamicMatrix(const ClpDynamicMatrix&);
    00149      ClpDynamicMatrix(const CoinPackedMatrix&);
    00150
    00151      ClpDynamicMatrix& operator=(const ClpDynamicMatrix&);
    00153      virtual ClpMatrixBase * clone() const ;
    00155
    00157
    00158      inline ClpSimplex::Status getStatus(int sequence) const {
    00159           return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
    00160      }
    00161      inline void setStatus(int sequence, ClpSimplex::Status status) {
    00162           unsigned char & st_byte = status_[sequence];
    00163           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00164           st_byte = static_cast<unsigned char>(st_byte | status);
    00165      }
    00167      inline int numberSets() const {
    00168           return numberSets_;
    00169      }
    00171      inline bool flagged(int i) const {
    00172           return (dynamicStatus_[i] & 8) != 0;
    00173      }
    00174      inline void setFlagged(int i) {
    00175           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
    00176      }
    00177      inline void unsetFlagged(int i) {
    00178           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
    00179      }
    00180      inline void setDynamicStatus(int sequence, DynamicStatus status) {
    00181           unsigned char & st_byte = dynamicStatus_[sequence];
    00182           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00183           st_byte = static_cast<unsigned char>(st_byte | status);
    00184      }
    00185      inline DynamicStatus getDynamicStatus(int sequence) const {
    00186           return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
    00187      }
    00189      inline double objectiveOffset() const {
    00190           return objectiveOffset_;
    00191      }
    00193      inline CoinBigIndex * startColumn() const {
    00194           return startColumn_;
    00195      }
    00197      inline int * row() const {
    00198           return row_;
    00199      }
    00201      inline double * element() const {
    00202           return element_;
    00203      }
    00205      inline double * cost() const {
    00206           return cost_;
    00207      }
    00209      inline int * id() const {
    00210           return id_;
    00211      }
    00213      inline double * columnLower() const {
    00214           return columnLower_;
    00215      }
    00217      inline double * columnUpper() const {
    00218           return columnUpper_;
    00219      }
    00221      inline double * lowerSet() const {
    00222           return lowerSet_;
    00223      }
    00225      inline double * upperSet() const {
    00226           return upperSet_;
    00227      }
    00229      inline int numberGubColumns() const {
    00230           return numberGubColumns_;
    00231      }
    00233      inline int firstAvailable() const {
    00234           return firstAvailable_;
    00235      }
    00237      inline int firstDynamic() const {
    00238           return firstDynamic_;
    00239      }
    00241      inline int lastDynamic() const {
    00242           return lastDynamic_;
    00243      }
    00245      inline int numberStaticRows() const {
    00246           return numberStaticRows_;
    00247      }
    00249      inline int numberElements() const {
    00250           return numberElements_;
    00251      }
    00252      inline int * keyVariable() const {
    00253           return keyVariable_;
    00254      }
    00256      void switchOffCheck();
    00258      inline unsigned char * gubRowStatus() const {
    00259           return status_;
    00260      }
    00262      inline unsigned char * dynamicStatus() const {
    00263           return dynamicStatus_;
    00264      }
    00266      int whichSet (int sequence) const;
    00268
    00269
    00270 protected:
    00274
    00275      double sumDualInfeasibilities_;
    00277      double sumPrimalInfeasibilities_;
    00279      double sumOfRelaxedDualInfeasibilities_;
    00281      double sumOfRelaxedPrimalInfeasibilities_;
    00283      double savedBestGubDual_;
    00285      int savedBestSet_;
    00287      int * backToPivotRow_;
    00289      mutable int * keyVariable_;
    00291      int * toIndex_;
    00292      // Reverse pointer from index to set
    00293      int * fromIndex_;
    00295      int numberSets_;
    00297      int numberActiveSets_;
    00299      double objectiveOffset_;
    00301      double * lowerSet_;
    00303      double * upperSet_;
    00305      unsigned char * status_;
    00307      ClpSimplex * model_;
    00309      int firstAvailable_;
    00311      int firstAvailableBefore_;
    00313      int firstDynamic_;
    00315      int lastDynamic_;
    00317      int numberStaticRows_;
    00319      int numberElements_;
    00321      int numberDualInfeasibilities_;
    00323      int numberPrimalInfeasibilities_;
    00329      int noCheck_;
    00331      double infeasibilityWeight_;
    00333      int numberGubColumns_;
    00335      int maximumGubColumns_;
    00337      int maximumElements_;
    00339      int * startSet_;
    00341      int * next_;
    00343      CoinBigIndex * startColumn_;
    00345      int * row_;
    00347      double * element_;
    00349      double * cost_;
    00351      int * id_;
    00353      unsigned char * dynamicStatus_;
    00355      double * columnLower_;
    00357      double * columnUpper_;
    00359 };
    00360
    00361 #endif