Go to the documentation of this file.00001
00002
00003
00004 #ifndef ClpCholeskyBase_H
00005 #define ClpCholeskyBase_H
00006
00007 #include "CoinPragma.hpp"
00008 #include "CoinFinite.hpp"
00009
00010 #ifndef CLP_LONG_CHOLESKY
00011 #define CLP_LONG_CHOLESKY 0
00012 #endif
00013
00014
00015
00016
00017
00018 #if COIN_LONG_WORK==0
00019 #if CLP_LONG_CHOLESKY>0
00020 #define CHOLESKY_BAD_COMBINATION
00021 #endif
00022 #else
00023 #if CLP_LONG_CHOLESKY==0
00024 #define CHOLESKY_BAD_COMBINATION
00025 #endif
00026 #endif
00027 #ifdef CHOLESKY_BAD_COMBINATION
00028 # warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
00029 "Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
00030 #endif
00031 #if CLP_LONG_CHOLESKY>1
00032 typedef long double longDouble;
00033 #define CHOL_SMALL_VALUE 1.0e-15
00034 #elif CLP_LONG_CHOLESKY==1
00035 typedef double longDouble;
00036 #define CHOL_SMALL_VALUE 1.0e-11
00037 #else
00038 typedef double longDouble;
00039 #define CHOL_SMALL_VALUE 1.0e-11
00040 #endif
00041 class ClpInterior;
00042 class ClpCholeskyDense;
00043 class ClpMatrixBase;
00044
00051 class ClpCholeskyBase {
00052
00053 public:
00062 virtual int order(ClpInterior * model);
00067 virtual int symbolic();
00070 virtual int factorize(const CoinWorkDouble * diagonal, int * rowsDropped) ;
00072 virtual void solve (CoinWorkDouble * region) ;
00075 virtual void solveKKT (CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * diagonal,
00076 CoinWorkDouble diagonalScaleFactor);
00077 private:
00079 int orderAMD();
00080 public:
00082
00085
00086 inline int status() const {
00087 return status_;
00088 }
00090 inline int numberRowsDropped() const {
00091 return numberRowsDropped_;
00092 }
00094 void resetRowsDropped();
00096 inline char * rowsDropped() const {
00097 return rowsDropped_;
00098 }
00100 inline double choleskyCondition() const {
00101 return choleskyCondition_;
00102 }
00104 inline double goDense() const {
00105 return goDense_;
00106 }
00108 inline void setGoDense(double value) {
00109 goDense_ = value;
00110 }
00112 inline int rank() const {
00113 return numberRows_ - numberRowsDropped_;
00114 }
00116 inline int numberRows() const {
00117 return numberRows_;
00118 }
00120 inline CoinBigIndex size() const {
00121 return sizeFactor_;
00122 }
00124 inline longDouble * sparseFactor() const {
00125 return sparseFactor_;
00126 }
00128 inline longDouble * diagonal() const {
00129 return diagonal_;
00130 }
00132 inline longDouble * workDouble() const {
00133 return workDouble_;
00134 }
00136 inline bool kkt() const {
00137 return doKKT_;
00138 }
00140 inline void setKKT(bool yesNo) {
00141 doKKT_ = yesNo;
00142 }
00144 inline void setIntegerParameter(int i, int value) {
00145 integerParameters_[i] = value;
00146 }
00148 inline int getIntegerParameter(int i) {
00149 return integerParameters_[i];
00150 }
00152 inline void setDoubleParameter(int i, double value) {
00153 doubleParameters_[i] = value;
00154 }
00156 inline double getDoubleParameter(int i) {
00157 return doubleParameters_[i];
00158 }
00160
00161
00162 public:
00163
00169 ClpCholeskyBase(int denseThreshold = -1);
00171 virtual ~ClpCholeskyBase();
00173 ClpCholeskyBase(const ClpCholeskyBase&);
00175 ClpCholeskyBase& operator=(const ClpCholeskyBase&);
00177
00178
00179
00180 virtual ClpCholeskyBase * clone() const;
00181
00183 inline int type() const {
00184 if (doKKT_) return 100;
00185 else return type_;
00186 }
00187 protected:
00189 inline void setType(int type) {
00190 type_ = type;
00191 }
00193 inline void setModel(ClpInterior * model) {
00194 model_ = model;
00195 }
00197
00204 int symbolic1(const CoinBigIndex * Astart, const int * Arow);
00208 void symbolic2(const CoinBigIndex * Astart, const int * Arow);
00212 void factorizePart2(int * rowsDropped) ;
00216 void solve(CoinWorkDouble * region, int type);
00218 int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT);
00220 void updateDense(longDouble * d, int * first);
00222
00223 protected:
00227
00228 int type_;
00230 bool doKKT_;
00232 double goDense_;
00234 double choleskyCondition_;
00236 ClpInterior * model_;
00238 int numberTrials_;
00240 int numberRows_;
00242 int status_;
00244 char * rowsDropped_;
00246 int * permuteInverse_;
00248 int * permute_;
00250 int numberRowsDropped_;
00252 longDouble * sparseFactor_;
00254 CoinBigIndex * choleskyStart_;
00256 int * choleskyRow_;
00258 CoinBigIndex * indexStart_;
00260 longDouble * diagonal_;
00262 longDouble * workDouble_;
00264 int * link_;
00265
00266 CoinBigIndex * workInteger_;
00267
00268 int * clique_;
00270 CoinBigIndex sizeFactor_;
00272 CoinBigIndex sizeIndex_;
00274 int firstDense_;
00276 int integerParameters_[64];
00278 double doubleParameters_[64];
00280 ClpMatrixBase * rowCopy_;
00282 char * whichDense_;
00284 longDouble * denseColumn_;
00286 ClpCholeskyDense * dense_;
00288 int denseThreshold_;
00290 };
00291
00292 #endif