# ClpDynamicMatrix.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpDynamicMatrix.hpp 1755 2011-06-28 18:24:31Z lou $ */
    00002 // Copyright (C) 2004, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef ClpDynamicMatrix_H
    00007 #define ClpDynamicMatrix_H
    00008
    00009
    00010 #include "CoinPragma.hpp"
    00011
    00012 #include "ClpPackedMatrix.hpp"
    00013 class ClpSimplex;
    00020 class ClpDynamicMatrix : public ClpPackedMatrix {
    00021
    00022 public:
    00024      enum DynamicStatus {
    00025           soloKey = 0x00,
    00026           inSmall = 0x01,
    00027           atUpperBound = 0x02,
    00028           atLowerBound = 0x03
    00029      };
    00032
    00033      virtual void partialPricing(ClpSimplex * model, double start, double end,
    00034                                  int & bestSequence, int & numberWanted);
    00035
    00039      virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
    00043      virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
    00044                                 bool check = false);
    00045
    00046      using ClpPackedMatrix::times ;
    00050      virtual void times(double scalar,
    00051                         const double * x, double * y) const;
    00053      void modifyOffset(int sequence, double amount);
    00055      double keyValue(int iSet) const;
    00064      virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
    00065                                double * other, int mode);
    00083      virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
    00088      virtual int refresh(ClpSimplex * model);
    00092      virtual void createVariable(ClpSimplex * model, int & bestSequence);
    00094      virtual double reducedCost( ClpSimplex * model, int sequence) const;
    00096      void gubCrash();
    00098      void writeMps(const char * name);
    00100      void initialProblem();
    00102      int addColumn(int numberEntries, const int * row, const double * element,
    00103                    double cost, double lower, double upper, int iSet,
    00104                    DynamicStatus status);
    00109      virtual void packDown(const int * , int ) {}
    00111      inline double columnLower(int sequence) const {
    00112           if (columnLower_) return columnLower_[sequence];
    00113           else return 0.0;
    00114      }
    00116      inline double columnUpper(int sequence) const {
    00117           if (columnUpper_) return columnUpper_[sequence];
    00118           else return COIN_DBL_MAX;
    00119      }
    00120
    00122
    00123
    00124
    00128      ClpDynamicMatrix();
    00135      ClpDynamicMatrix(ClpSimplex * model, int numberSets,
    00136                       int numberColumns, const int * starts,
    00137                       const double * lower, const double * upper,
    00138                       const CoinBigIndex * startColumn, const int * row,
    00139                       const double * element, const double * cost,
    00140                       const double * columnLower = NULL, const double * columnUpper = NULL,
    00141                       const unsigned char * status = NULL,
    00142                       const unsigned char * dynamicStatus = NULL);
    00143
    00145      virtual ~ClpDynamicMatrix();
    00147
    00151      ClpDynamicMatrix(const ClpDynamicMatrix&);
    00153      ClpDynamicMatrix(const CoinPackedMatrix&);
    00154
    00155      ClpDynamicMatrix& operator=(const ClpDynamicMatrix&);
    00157      virtual ClpMatrixBase * clone() const ;
    00159
    00161
    00162      inline ClpSimplex::Status getStatus(int sequence) const {
    00163           return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
    00164      }
    00165      inline void setStatus(int sequence, ClpSimplex::Status status) {
    00166           unsigned char & st_byte = status_[sequence];
    00167           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00168           st_byte = static_cast<unsigned char>(st_byte | status);
    00169      }
    00171      inline bool flaggedSlack(int i) const {
    00172           return (status_[i] & 8) != 0;
    00173      }
    00174      inline void setFlaggedSlack(int i) {
    00175           status_[i] = static_cast<unsigned char>(status_[i] | 8);
    00176      }
    00177      inline void unsetFlaggedSlack(int i) {
    00178           status_[i] = static_cast<unsigned char>(status_[i] & ~8);
    00179      }
    00181      inline int numberSets() const {
    00182           return numberSets_;
    00183      }
    00185      inline int numberGubEntries() const
    00186      { return startSet_[numberSets_];}
    00188      inline int * startSets() const
    00189      { return startSet_;}
    00191      inline bool flagged(int i) const {
    00192           return (dynamicStatus_[i] & 8) != 0;
    00193      }
    00194      inline void setFlagged(int i) {
    00195           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
    00196      }
    00197      inline void unsetFlagged(int i) {
    00198           dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
    00199      }
    00200      inline void setDynamicStatus(int sequence, DynamicStatus status) {
    00201           unsigned char & st_byte = dynamicStatus_[sequence];
    00202           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00203           st_byte = static_cast<unsigned char>(st_byte | status);
    00204      }
    00205      inline DynamicStatus getDynamicStatus(int sequence) const {
    00206           return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
    00207      }
    00209      inline double objectiveOffset() const {
    00210           return objectiveOffset_;
    00211      }
    00213      inline CoinBigIndex * startColumn() const {
    00214           return startColumn_;
    00215      }
    00217      inline int * row() const {
    00218           return row_;
    00219      }
    00221      inline double * element() const {
    00222           return element_;
    00223      }
    00225      inline double * cost() const {
    00226           return cost_;
    00227      }
    00229      inline int * id() const {
    00230           return id_;
    00231      }
    00233      inline double * columnLower() const {
    00234           return columnLower_;
    00235      }
    00237      inline double * columnUpper() const {
    00238           return columnUpper_;
    00239      }
    00241      inline double * lowerSet() const {
    00242           return lowerSet_;
    00243      }
    00245      inline double * upperSet() const {
    00246           return upperSet_;
    00247      }
    00249      inline int numberGubColumns() const {
    00250           return numberGubColumns_;
    00251      }
    00253      inline int firstAvailable() const {
    00254           return firstAvailable_;
    00255      }
    00257      inline int firstDynamic() const {
    00258           return firstDynamic_;
    00259      }
    00261      inline int lastDynamic() const {
    00262           return lastDynamic_;
    00263      }
    00265      inline int numberStaticRows() const {
    00266           return numberStaticRows_;
    00267      }
    00269      inline int numberElements() const {
    00270           return numberElements_;
    00271      }
    00272      inline int * keyVariable() const {
    00273           return keyVariable_;
    00274      }
    00276      void switchOffCheck();
    00278      inline unsigned char * gubRowStatus() const {
    00279           return status_;
    00280      }
    00282      inline unsigned char * dynamicStatus() const {
    00283           return dynamicStatus_;
    00284      }
    00286      int whichSet (int sequence) const;
    00288
    00289
    00290 protected:
    00294
    00295      double sumDualInfeasibilities_;
    00297      double sumPrimalInfeasibilities_;
    00299      double sumOfRelaxedDualInfeasibilities_;
    00301      double sumOfRelaxedPrimalInfeasibilities_;
    00303      double savedBestGubDual_;
    00305      int savedBestSet_;
    00307      int * backToPivotRow_;
    00309      mutable int * keyVariable_;
    00311      int * toIndex_;
    00312      // Reverse pointer from index to set
    00313      int * fromIndex_;
    00315      int numberSets_;
    00317      int numberActiveSets_;
    00319      double objectiveOffset_;
    00321      double * lowerSet_;
    00323      double * upperSet_;
    00325      unsigned char * status_;
    00327      ClpSimplex * model_;
    00329      int firstAvailable_;
    00331      int firstAvailableBefore_;
    00333      int firstDynamic_;
    00335      int lastDynamic_;
    00337      int numberStaticRows_;
    00339      int numberElements_;
    00341      int numberDualInfeasibilities_;
    00343      int numberPrimalInfeasibilities_;
    00349      int noCheck_;
    00351      double infeasibilityWeight_;
    00353      int numberGubColumns_;
    00355      int maximumGubColumns_;
    00357      int maximumElements_;
    00359      int * startSet_;
    00361      int * next_;
    00363      CoinBigIndex * startColumn_;
    00365      int * row_;
    00367      double * element_;
    00369      double * cost_;
    00371      int * id_;
    00373      unsigned char * dynamicStatus_;
    00375      double * columnLower_;
    00377      double * columnUpper_;
    00379 };
    00380
    00381 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines