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

- File List
- File Members

# /home/coin/svn-release/Bcps-0.93.11/Clp/src/ClpCholeskyBase.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpCholeskyBase.hpp 1722 2011-04-17 09:58:37Z stefan $ */
    00002 // Copyright (C) 2003, 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 ClpCholeskyBase_H
    00007 #define ClpCholeskyBase_H
    00008
    00009 #include "CoinPragma.hpp"
    00010 #include "CoinTypes.hpp"
    00011 //#define CLP_LONG_CHOLESKY 0
    00012 #ifndef CLP_LONG_CHOLESKY
    00013 #define CLP_LONG_CHOLESKY 0
    00014 #endif
    00015 /* valid combinations are
    00016    CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0
    00017    CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1
    00018    CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1
    00019 */
    00020 #if COIN_LONG_WORK==0
    00021 #if CLP_LONG_CHOLESKY>0
    00022 #define CHOLESKY_BAD_COMBINATION
    00023 #endif
    00024 #else
    00025 #if CLP_LONG_CHOLESKY==0
    00026 #define CHOLESKY_BAD_COMBINATION
    00027 #endif
    00028 #endif
    00029 #ifdef CHOLESKY_BAD_COMBINATION
    00030 #  warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
    00031 "Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
    00032 #endif
    00033 #if CLP_LONG_CHOLESKY>1
    00034 typedef long double longDouble;
    00035 #define CHOL_SMALL_VALUE 1.0e-15
    00036 #elif CLP_LONG_CHOLESKY==1
    00037 typedef double longDouble;
    00038 #define CHOL_SMALL_VALUE 1.0e-11
    00039 #else
    00040 typedef double longDouble;
    00041 #define CHOL_SMALL_VALUE 1.0e-11
    00042 #endif
    00043 class ClpInterior;
    00044 class ClpCholeskyDense;
    00045 class ClpMatrixBase;
    00046
    00053 class ClpCholeskyBase  {
    00054
    00055 public:
    00064      virtual int order(ClpInterior * model);
    00069      virtual int symbolic();
    00072      virtual int factorize(const CoinWorkDouble * diagonal, int * rowsDropped) ;
    00074      virtual void solve (CoinWorkDouble * region) ;
    00077      virtual void solveKKT (CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * diagonal,
    00078                             CoinWorkDouble diagonalScaleFactor);
    00079 private:
    00081      int orderAMD();
    00082 public:
    00084
    00087
    00088      inline int status() const {
    00089           return status_;
    00090      }
    00092      inline int numberRowsDropped() const {
    00093           return numberRowsDropped_;
    00094      }
    00096      void resetRowsDropped();
    00098      inline char * rowsDropped() const {
    00099           return rowsDropped_;
    00100      }
    00102      inline double choleskyCondition() const {
    00103           return choleskyCondition_;
    00104      }
    00106      inline double goDense() const {
    00107           return goDense_;
    00108      }
    00110      inline void setGoDense(double value) {
    00111           goDense_ = value;
    00112      }
    00114      inline int rank() const {
    00115           return numberRows_ - numberRowsDropped_;
    00116      }
    00118      inline int numberRows() const {
    00119           return numberRows_;
    00120      }
    00122      inline CoinBigIndex size() const {
    00123           return sizeFactor_;
    00124      }
    00126      inline longDouble * sparseFactor() const {
    00127           return sparseFactor_;
    00128      }
    00130      inline longDouble * diagonal() const {
    00131           return diagonal_;
    00132      }
    00134      inline longDouble * workDouble() const {
    00135           return workDouble_;
    00136      }
    00138      inline bool kkt() const {
    00139           return doKKT_;
    00140      }
    00142      inline void setKKT(bool yesNo) {
    00143           doKKT_ = yesNo;
    00144      }
    00146      inline void setIntegerParameter(int i, int value) {
    00147           integerParameters_[i] = value;
    00148      }
    00150      inline int getIntegerParameter(int i) {
    00151           return integerParameters_[i];
    00152      }
    00154      inline void setDoubleParameter(int i, double value) {
    00155           doubleParameters_[i] = value;
    00156      }
    00158      inline double getDoubleParameter(int i) {
    00159           return doubleParameters_[i];
    00160      }
    00162
    00163
    00164 public:
    00165
    00171      ClpCholeskyBase(int denseThreshold = -1);
    00173      virtual ~ClpCholeskyBase();
    00175      ClpCholeskyBase(const ClpCholeskyBase&);
    00177      ClpCholeskyBase& operator=(const ClpCholeskyBase&);
    00179
    00180
    00181
    00182      virtual ClpCholeskyBase * clone() const;
    00183
    00185      inline int type() const {
    00186           if (doKKT_) return 100;
    00187           else return type_;
    00188      }
    00189 protected:
    00191      inline void setType(int type) {
    00192           type_ = type;
    00193      }
    00195      inline void setModel(ClpInterior * model) {
    00196           model_ = model;
    00197      }
    00199
    00206      int symbolic1(const CoinBigIndex * Astart, const int * Arow);
    00210      void symbolic2(const CoinBigIndex * Astart, const int * Arow);
    00214      void factorizePart2(int * rowsDropped) ;
    00218      void solve(CoinWorkDouble * region, int type);
    00220      int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT);
    00222      void updateDense(longDouble * d, /*longDouble * work,*/ int * first);
    00224
    00225 protected:
    00229
    00230      int type_;
    00232      bool doKKT_;
    00234      double goDense_;
    00236      double choleskyCondition_;
    00238      ClpInterior * model_;
    00240      int numberTrials_;
    00242      int numberRows_;
    00244      int status_;
    00246      char * rowsDropped_;
    00248      int * permuteInverse_;
    00250      int * permute_;
    00252      int numberRowsDropped_;
    00254      longDouble * sparseFactor_;
    00256      CoinBigIndex * choleskyStart_;
    00258      int * choleskyRow_;
    00260      CoinBigIndex * indexStart_;
    00262      longDouble * diagonal_;
    00264      longDouble * workDouble_;
    00266      int * link_;
    00267      // Integer work array
    00268      CoinBigIndex * workInteger_;
    00269      // Clique information
    00270      int * clique_;
    00272      CoinBigIndex sizeFactor_;
    00274      CoinBigIndex sizeIndex_;
    00276      int firstDense_;
    00278      int integerParameters_[64];
    00280      double doubleParameters_[64];
    00282      ClpMatrixBase * rowCopy_;
    00284      char * whichDense_;
    00286      longDouble * denseColumn_;
    00288      ClpCholeskyDense * dense_;
    00290      int denseThreshold_;
    00292 };
    00293
    00294 #endif