Clp  1.17.8
ClpCholeskyBase.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 // Copyright (C) 2003, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef ClpCholeskyBase_H
7 #define ClpCholeskyBase_H
8 
9 #include "CoinPragma.hpp"
10 #include "CoinTypes.hpp"
11 //#define CLP_LONG_CHOLESKY 0
12 #ifndef CLP_LONG_CHOLESKY
13 #define CLP_LONG_CHOLESKY 0
14 #endif
15 /* valid combinations are
16  CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0
17  CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1
18  CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1
19 */
20 #if COIN_LONG_WORK == 0
21 #if CLP_LONG_CHOLESKY > 0
22 #define CHOLESKY_BAD_COMBINATION
23 #endif
24 #else
25 #if CLP_LONG_CHOLESKY == 0
26 #define CHOLESKY_BAD_COMBINATION
27 #endif
28 #endif
29 #ifdef CHOLESKY_BAD_COMBINATION
30 #warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
31 "Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
32 #endif
33 #if CLP_LONG_CHOLESKY > 1
34  typedef long double longDouble;
35 #define CHOL_SMALL_VALUE 1.0e-15
36 #elif CLP_LONG_CHOLESKY == 1
37 typedef double longDouble;
38 #define CHOL_SMALL_VALUE 1.0e-11
39 #else
40 typedef double longDouble;
41 #define CHOL_SMALL_VALUE 1.0e-11
42 #endif
43 class ClpInterior;
44 class ClpCholeskyDense;
45 class ClpMatrixBase;
46 
54 
55 public:
64  virtual int order(ClpInterior *model);
69  virtual int symbolic();
72  virtual int factorize(const CoinWorkDouble *diagonal, int *rowsDropped);
74  virtual void solve(CoinWorkDouble *region);
77  virtual void solveKKT(CoinWorkDouble *region1, CoinWorkDouble *region2, const CoinWorkDouble *diagonal,
78  CoinWorkDouble diagonalScaleFactor);
79 
80 private:
82  int orderAMD();
83 
84 public:
86 
89  inline int status() const
91  {
92  return status_;
93  }
95  inline int numberRowsDropped() const
96  {
97  return numberRowsDropped_;
98  }
100  void resetRowsDropped();
102  inline char *rowsDropped() const
103  {
104  return rowsDropped_;
105  }
107  inline double choleskyCondition() const
108  {
109  return choleskyCondition_;
110  }
112  inline double goDense() const
113  {
114  return goDense_;
115  }
117  inline void setGoDense(double value)
118  {
119  goDense_ = value;
120  }
122  inline int rank() const
123  {
125  }
127  inline int numberRows() const
128  {
129  return numberRows_;
130  }
132  inline int size() const
133  {
134  return sizeFactor_;
135  }
137  inline longDouble *sparseFactor() const
138  {
139  return sparseFactor_;
140  }
142  inline longDouble *diagonal() const
143  {
144  return diagonal_;
145  }
147  inline longDouble *workDouble() const
148  {
149  return workDouble_;
150  }
152  inline bool kkt() const
153  {
154  return doKKT_;
155  }
157  inline void setKKT(bool yesNo)
158  {
159  doKKT_ = yesNo;
160  }
162  inline void setIntegerParameter(int i, int value)
163  {
164  integerParameters_[i] = value;
165  }
167  inline int getIntegerParameter(int i)
168  {
169  return integerParameters_[i];
170  }
172  inline void setDoubleParameter(int i, double value)
173  {
174  doubleParameters_[i] = value;
175  }
177  inline double getDoubleParameter(int i)
178  {
179  return doubleParameters_[i];
180  }
182 
183 public:
189  ClpCholeskyBase(int denseThreshold = -1);
191  virtual ~ClpCholeskyBase();
197 
198  virtual ClpCholeskyBase *clone() const;
201 
203  inline int type() const
204  {
205  if (doKKT_)
206  return 100;
207  else
208  return type_;
209  }
210 
211 protected:
213  inline void setType(int type)
214  {
215  type_ = type;
216  }
218  inline void setModel(ClpInterior *model)
219  {
220  model_ = model;
221  }
223 
230  int symbolic1(const int *Astart, const int *Arow);
234  void symbolic2(const int *Astart, const int *Arow);
238  void factorizePart2(int *rowsDropped);
242  void solve(CoinWorkDouble *region, int type);
244  int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT);
246  void updateDense(longDouble *d, /*longDouble * work,*/ int *first);
248 
249 protected:
253  int type_;
256  bool doKKT_;
258  double goDense_;
268  int status_;
274  int *permute_;
290  int *link_;
291  // Integer work array
293  // Clique information
294  int *clique_;
304  double doubleParameters_[64];
308  char *whichDense_;
316 };
317 
318 #endif
319 
320 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
321 */
longDouble
double longDouble
Definition: ClpCholeskyBase.hpp:40
ClpCholeskyBase::diagonal
longDouble * diagonal() const
Return diagonal.
Definition: ClpCholeskyBase.hpp:142
ClpCholeskyBase::rowCopy_
ClpMatrixBase * rowCopy_
Row copy of matrix.
Definition: ClpCholeskyBase.hpp:306
ClpCholeskyBase::doKKT_
bool doKKT_
Doing full KKT (only used if default symbolic and factorization)
Definition: ClpCholeskyBase.hpp:256
ClpCholeskyBase::numberRowsDropped
int numberRowsDropped() const
numberRowsDropped. Number of rows gone
Definition: ClpCholeskyBase.hpp:95
ClpCholeskyBase::setIntegerParameter
void setIntegerParameter(int i, int value)
Set integer parameter.
Definition: ClpCholeskyBase.hpp:162
ClpCholeskyBase::choleskyRow_
int * choleskyRow_
choleskyRow (can be shorter than sparsefactor)
Definition: ClpCholeskyBase.hpp:282
ClpCholeskyBase::type
int type() const
Returns type.
Definition: ClpCholeskyBase.hpp:203
ClpCholeskyBase::ClpCholeskyBase
ClpCholeskyBase(int denseThreshold=-1)
Constructor which has dense columns activated.
ClpCholeskyBase::clique_
int * clique_
Definition: ClpCholeskyBase.hpp:294
ClpCholeskyBase::sizeIndex_
int sizeIndex_
Size of index array.
Definition: ClpCholeskyBase.hpp:298
ClpCholeskyBase::getDoubleParameter
double getDoubleParameter(int i)
get double parameter
Definition: ClpCholeskyBase.hpp:177
ClpCholeskyBase::setModel
void setModel(ClpInterior *model)
model.
Definition: ClpCholeskyBase.hpp:218
ClpCholeskyBase
Base class for Clp Cholesky factorization Will do better factorization.
Definition: ClpCholeskyBase.hpp:53
ClpCholeskyBase::doubleParameters_
double doubleParameters_[64]
doubleParameters;
Definition: ClpCholeskyBase.hpp:304
ClpCholeskyBase::choleskyCondition
double choleskyCondition() const
choleskyCondition.
Definition: ClpCholeskyBase.hpp:107
ClpCholeskyBase::denseColumn_
longDouble * denseColumn_
Dense columns (updated)
Definition: ClpCholeskyBase.hpp:310
ClpCholeskyBase::link_
int * link_
link array
Definition: ClpCholeskyBase.hpp:290
ClpCholeskyDense
Definition: ClpCholeskyDense.hpp:14
ClpCholeskyBase::resetRowsDropped
void resetRowsDropped()
reset numberRowsDropped and rowsDropped.
ClpCholeskyBase::setKKT
void setKKT(bool yesNo)
Set KKT.
Definition: ClpCholeskyBase.hpp:157
ClpCholeskyBase::sizeFactor_
int sizeFactor_
sizeFactor.
Definition: ClpCholeskyBase.hpp:296
ClpCholeskyBase::solve
virtual void solve(CoinWorkDouble *region)
Uses factorization to solve.
ClpCholeskyBase::factorizePart2
void factorizePart2(int *rowsDropped)
Factorize - filling in rowsDropped and returning number dropped in integerParam.
ClpCholeskyBase::choleskyCondition_
double choleskyCondition_
choleskyCondition.
Definition: ClpCholeskyBase.hpp:260
ClpCholeskyBase::rowsDropped
char * rowsDropped() const
rowsDropped - which rows are gone
Definition: ClpCholeskyBase.hpp:102
ClpCholeskyBase::kkt
bool kkt() const
If KKT on.
Definition: ClpCholeskyBase.hpp:152
ClpCholeskyBase::setGoDense
void setGoDense(double value)
goDense i.e. use dense factoriaztion if > this (default 0.7).
Definition: ClpCholeskyBase.hpp:117
ClpCholeskyBase::numberRows_
int numberRows_
numberRows. Number of Rows in factorization
Definition: ClpCholeskyBase.hpp:266
ClpCholeskyBase::denseThreshold_
int denseThreshold_
Dense threshold (for taking out of Cholesky)
Definition: ClpCholeskyBase.hpp:314
ClpCholeskyBase::dense_
ClpCholeskyDense * dense_
Dense cholesky.
Definition: ClpCholeskyBase.hpp:312
ClpCholeskyBase::setDoubleParameter
void setDoubleParameter(int i, double value)
Set double parameter.
Definition: ClpCholeskyBase.hpp:172
ClpCholeskyBase::getIntegerParameter
int getIntegerParameter(int i)
get integer parameter
Definition: ClpCholeskyBase.hpp:167
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpCholeskyBase::symbolic
virtual int symbolic()
Does Symbolic factorization given permutation.
ClpCholeskyBase::status
int status() const
status. Returns status
Definition: ClpCholeskyBase.hpp:90
ClpCholeskyBase::status_
int status_
status. Status of factorization
Definition: ClpCholeskyBase.hpp:268
ClpCholeskyBase::numberTrials_
int numberTrials_
numberTrials. Number of trials before rejection
Definition: ClpCholeskyBase.hpp:264
ClpCholeskyBase::symbolic2
void symbolic2(const int *Astart, const int *Arow)
Symbolic2 - Fills in indices Uses lower triangular so can do cliques etc.
ClpCholeskyBase::goDense
double goDense() const
goDense i.e. use dense factoriaztion if > this (default 0.7).
Definition: ClpCholeskyBase.hpp:112
ClpCholeskyBase::firstDense_
int firstDense_
First dense row.
Definition: ClpCholeskyBase.hpp:300
ClpCholeskyBase::type_
int type_
type (may be useful) if > 20 do KKT
Definition: ClpCholeskyBase.hpp:254
ClpCholeskyBase::choleskyStart_
int * choleskyStart_
choleskyStart - element starts
Definition: ClpCholeskyBase.hpp:280
ClpCholeskyBase::workInteger_
int * workInteger_
Definition: ClpCholeskyBase.hpp:292
ClpCholeskyBase::workDouble
longDouble * workDouble() const
Return workDouble.
Definition: ClpCholeskyBase.hpp:147
ClpCholeskyBase::diagonal_
longDouble * diagonal_
Diagonal.
Definition: ClpCholeskyBase.hpp:286
ClpInterior
This solves LPs using interior point methods.
Definition: ClpInterior.hpp:72
ClpCholeskyBase::workDouble_
longDouble * workDouble_
double work array
Definition: ClpCholeskyBase.hpp:288
ClpCholeskyBase::rank
int rank() const
rank. Returns rank
Definition: ClpCholeskyBase.hpp:122
ClpCholeskyBase::goDense_
double goDense_
Go dense at this fraction.
Definition: ClpCholeskyBase.hpp:258
ClpCholeskyBase::sparseFactor_
longDouble * sparseFactor_
sparseFactor.
Definition: ClpCholeskyBase.hpp:278
ClpCholeskyBase::operator=
ClpCholeskyBase & operator=(const ClpCholeskyBase &)
Assignment.
ClpCholeskyBase::preOrder
int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT)
Forms ADAT - returns nonzero if not enough memory.
ClpCholeskyBase::model_
ClpInterior * model_
model.
Definition: ClpCholeskyBase.hpp:262
ClpCholeskyBase::numberRows
int numberRows() const
Return number of rows.
Definition: ClpCholeskyBase.hpp:127
ClpCholeskyBase::size
int size() const
Return size.
Definition: ClpCholeskyBase.hpp:132
ClpCholeskyBase::numberRowsDropped_
int numberRowsDropped_
numberRowsDropped. Number of rows gone
Definition: ClpCholeskyBase.hpp:276
ClpCholeskyBase::permute_
int * permute_
main permute.
Definition: ClpCholeskyBase.hpp:274
ClpCholeskyBase::solveKKT
virtual void solveKKT(CoinWorkDouble *region1, CoinWorkDouble *region2, const CoinWorkDouble *diagonal, CoinWorkDouble diagonalScaleFactor)
Uses factorization to solve.
ClpCholeskyBase::symbolic1
int symbolic1(const int *Astart, const int *Arow)
Symbolic1 - works out size without clever stuff.
ClpCholeskyBase::indexStart_
int * indexStart_
Index starts.
Definition: ClpCholeskyBase.hpp:284
ClpCholeskyBase::clone
virtual ClpCholeskyBase * clone() const
ClpCholeskyBase::whichDense_
char * whichDense_
Dense indicators.
Definition: ClpCholeskyBase.hpp:308
ClpCholeskyBase::factorize
virtual int factorize(const CoinWorkDouble *diagonal, int *rowsDropped)
Factorize - filling in rowsDropped and returning number dropped.
ClpCholeskyBase::integerParameters_
int integerParameters_[64]
integerParameters
Definition: ClpCholeskyBase.hpp:302
ClpCholeskyBase::updateDense
void updateDense(longDouble *d, int *first)
Updates dense part (broken out for profiling)
ClpCholeskyBase::rowsDropped_
char * rowsDropped_
rowsDropped
Definition: ClpCholeskyBase.hpp:270
ClpCholeskyBase::sparseFactor
longDouble * sparseFactor() const
Return sparseFactor.
Definition: ClpCholeskyBase.hpp:137
ClpCholeskyBase::order
virtual int order(ClpInterior *model)
Orders rows and saves pointer to matrix.and model.
ClpCholeskyBase::orderAMD
int orderAMD()
AMD ordering.
ClpCholeskyBase::~ClpCholeskyBase
virtual ~ClpCholeskyBase()
Destructor (has to be public)
ClpCholeskyBase::setType
void setType(int type)
Sets type.
Definition: ClpCholeskyBase.hpp:213
ClpCholeskyBase::permuteInverse_
int * permuteInverse_
permute inverse.
Definition: ClpCholeskyBase.hpp:272