Loading...
Searching...
No Matches
ClpCholeskyBase.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2003, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpCholeskyBase_H
#define ClpCholeskyBase_H
#include "CoinPragma.hpp"
#include "CoinTypes.hpp"
//#define CLP_LONG_CHOLESKY 0
#ifndef CLP_LONG_CHOLESKY
#define CLP_LONG_CHOLESKY 0
#endif
/* valid combinations are
CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0
CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1
CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1
*/
#if COIN_LONG_WORK == 0
#if CLP_LONG_CHOLESKY > 0
#define CHOLESKY_BAD_COMBINATION
#endif
#else
#if CLP_LONG_CHOLESKY == 0
#define CHOLESKY_BAD_COMBINATION
#endif
#endif
#ifdef CHOLESKY_BAD_COMBINATION
#warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
"Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
#endif
#if CLP_LONG_CHOLESKY > 1
typedef long double longDouble;
#define CHOL_SMALL_VALUE 1.0e-15
#elif CLP_LONG_CHOLESKY == 1
typedef double longDouble;
#define CHOL_SMALL_VALUE 1.0e-11
#else
typedef double longDouble;
#define CHOL_SMALL_VALUE 1.0e-11
#endif
class ClpInterior;
class ClpCholeskyDense;
class ClpMatrixBase;
class ClpCholeskyBase {
public:
virtual int order(ClpInterior *model);
virtual int symbolic();
virtual int factorize(const CoinWorkDouble *diagonal, int *rowsDropped);
virtual void solve(CoinWorkDouble *region);
virtual void solveKKT(CoinWorkDouble *region1, CoinWorkDouble *region2, const CoinWorkDouble *diagonal,
CoinWorkDouble diagonalScaleFactor);
private:
int orderAMD();
public:
inline int status() const
{
return status_;
}
inline int numberRowsDropped() const
{
return numberRowsDropped_;
}
void resetRowsDropped();
inline char *rowsDropped() const
{
return rowsDropped_;
}
inline double choleskyCondition() const
{
return choleskyCondition_;
}
inline double goDense() const
{
return goDense_;
}
inline void setGoDense(double value)
{
goDense_ = value;
}
inline int rank() const
{
return numberRows_ - numberRowsDropped_;
}
inline int numberRows() const
{
return numberRows_;
}
inline int size() const
{
return sizeFactor_;
}
inline longDouble *sparseFactor() const
{
return sparseFactor_;
}
inline longDouble *diagonal() const
{
return diagonal_;
}
inline longDouble *workDouble() const
{
return workDouble_;
}
inline bool kkt() const
{
return doKKT_;
}
inline void setKKT(bool yesNo)
{
doKKT_ = yesNo;
}
inline void setIntegerParameter(int i, int value)
{
integerParameters_[i] = value;
}
inline int getIntegerParameter(int i)
{
return integerParameters_[i];
}
inline void setDoubleParameter(int i, double value)
{
doubleParameters_[i] = value;
}
inline double getDoubleParameter(int i)
{
return doubleParameters_[i];
}
public:
ClpCholeskyBase(int denseThreshold = -1);
virtual ~ClpCholeskyBase();
ClpCholeskyBase(const ClpCholeskyBase &);
ClpCholeskyBase &operator=(const ClpCholeskyBase &);
virtual ClpCholeskyBase *clone() const;
inline int type() const
{
if (doKKT_)
return 100;
else
return type_;
}
protected:
inline void setType(int type)
{
type_ = type;
}
inline void setModel(ClpInterior *model)
{
model_ = model;
}
int symbolic1(const int *Astart, const int *Arow);
void symbolic2(const int *Astart, const int *Arow);
void factorizePart2(int *rowsDropped);
void solve(CoinWorkDouble *region, int type);
int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT);
void updateDense(longDouble *d, /*longDouble * work,*/ int *first);
protected:
int type_;
bool doKKT_;
double goDense_;
double choleskyCondition_;
ClpInterior *model_;
int numberTrials_;
int numberRows_;
int status_;
char *rowsDropped_;
int *permuteInverse_;
int *permute_;
int numberRowsDropped_;
longDouble *sparseFactor_;
int *choleskyStart_;
int *choleskyRow_;
int *indexStart_;
longDouble *diagonal_;
longDouble *workDouble_;
int *link_;
// Integer work array
int *workInteger_;
// Clique information
int *clique_;
int sizeFactor_;
int sizeIndex_;
int firstDense_;
int integerParameters_[64];
double doubleParameters_[64];
ClpMatrixBase *rowCopy_;
char *whichDense_;
longDouble *denseColumn_;
ClpCholeskyDense *dense_;
int denseThreshold_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
longDouble
double longDouble
Definition ClpCholeskyBase.hpp:40
ClpCholeskyBase::rowsDropped_
char * rowsDropped_
rowsDropped
Definition ClpCholeskyBase.hpp:270
ClpCholeskyBase::sizeIndex_
int sizeIndex_
Size of index array.
Definition ClpCholeskyBase.hpp:298
ClpCholeskyBase::doubleParameters_
double doubleParameters_[64]
doubleParameters;
Definition ClpCholeskyBase.hpp:304
ClpCholeskyBase::solveKKT
virtual void solveKKT(CoinWorkDouble *region1, CoinWorkDouble *region2, const CoinWorkDouble *diagonal, CoinWorkDouble diagonalScaleFactor)
Uses factorization to solve.
ClpCholeskyBase::permuteInverse_
int * permuteInverse_
permute inverse.
Definition ClpCholeskyBase.hpp:272
ClpCholeskyBase::permute_
int * permute_
main permute.
Definition ClpCholeskyBase.hpp:274
ClpCholeskyBase::dense_
ClpCholeskyDense * dense_
Dense cholesky.
Definition ClpCholeskyBase.hpp:312
ClpCholeskyBase::choleskyRow_
int * choleskyRow_
choleskyRow (can be shorter than sparsefactor)
Definition ClpCholeskyBase.hpp:282
ClpCholeskyBase::symbolic1
int symbolic1(const int *Astart, const int *Arow)
Symbolic1 - works out size without clever stuff.
ClpCholeskyBase::model_
ClpInterior * model_
model.
Definition ClpCholeskyBase.hpp:262
ClpCholeskyBase::workDouble
longDouble * workDouble() const
Return workDouble.
Definition ClpCholeskyBase.hpp:147
ClpCholeskyBase::goDense_
double goDense_
Go dense at this fraction.
Definition ClpCholeskyBase.hpp:258
ClpCholeskyBase::clone
virtual ClpCholeskyBase * clone() const
ClpCholeskyBase::rowCopy_
ClpMatrixBase * rowCopy_
Row copy of matrix.
Definition ClpCholeskyBase.hpp:306
ClpCholeskyBase::numberTrials_
int numberTrials_
numberTrials. Number of trials before rejection
Definition ClpCholeskyBase.hpp:264
ClpCholeskyBase::choleskyStart_
int * choleskyStart_
choleskyStart - element starts
Definition ClpCholeskyBase.hpp:280
ClpCholeskyBase::workDouble_
longDouble * workDouble_
double work array
Definition ClpCholeskyBase.hpp:288
ClpCholeskyBase::type
int type() const
Returns type.
Definition ClpCholeskyBase.hpp:203
ClpCholeskyBase::indexStart_
int * indexStart_
Index starts.
Definition ClpCholeskyBase.hpp:284
ClpCholeskyBase::preOrder
int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT)
Forms ADAT - returns nonzero if not enough memory.
ClpCholeskyBase::diagonal
longDouble * diagonal() const
Return diagonal.
Definition ClpCholeskyBase.hpp:142
ClpCholeskyBase::denseColumn_
longDouble * denseColumn_
Dense columns (updated).
Definition ClpCholeskyBase.hpp:310
ClpCholeskyBase::kkt
bool kkt() const
If KKT on.
Definition ClpCholeskyBase.hpp:152
ClpCholeskyBase::diagonal_
longDouble * diagonal_
Diagonal.
Definition ClpCholeskyBase.hpp:286
ClpCholeskyBase::numberRowsDropped_
int numberRowsDropped_
numberRowsDropped. Number of rows gone
Definition ClpCholeskyBase.hpp:276
ClpCholeskyBase::doKKT_
bool doKKT_
Doing full KKT (only used if default symbolic and factorization).
Definition ClpCholeskyBase.hpp:256
ClpCholeskyBase::order
virtual int order(ClpInterior *model)
Orders rows and saves pointer to matrix.and model.
ClpCholeskyBase::setDoubleParameter
void setDoubleParameter(int i, double value)
Set double parameter.
Definition ClpCholeskyBase.hpp:172
ClpCholeskyBase::setType
void setType(int type)
Sets type.
Definition ClpCholeskyBase.hpp:213
ClpCholeskyBase::whichDense_
char * whichDense_
Dense indicators.
Definition ClpCholeskyBase.hpp:308
ClpCholeskyBase::type_
int type_
type (may be useful) if > 20 do KKT
Definition ClpCholeskyBase.hpp:254
ClpCholeskyBase::sparseFactor
longDouble * sparseFactor() const
Return sparseFactor.
Definition ClpCholeskyBase.hpp:137
ClpCholeskyBase::status
int status() const
status. Returns status
Definition ClpCholeskyBase.hpp:90
ClpCholeskyBase::setIntegerParameter
void setIntegerParameter(int i, int value)
Set integer parameter.
Definition ClpCholeskyBase.hpp:162
ClpCholeskyBase::symbolic2
void symbolic2(const int *Astart, const int *Arow)
Symbolic2 - Fills in indices Uses lower triangular so can do cliques etc.
ClpCholeskyBase::resetRowsDropped
void resetRowsDropped()
reset numberRowsDropped and rowsDropped.
ClpCholeskyBase::orderAMD
int orderAMD()
AMD ordering.
ClpCholeskyBase::operator=
ClpCholeskyBase & operator=(const ClpCholeskyBase &)
Assignment.
ClpCholeskyBase::~ClpCholeskyBase
virtual ~ClpCholeskyBase()
Destructor (has to be public).
ClpCholeskyBase::choleskyCondition_
double choleskyCondition_
choleskyCondition.
Definition ClpCholeskyBase.hpp:260
ClpCholeskyBase::solve
virtual void solve(CoinWorkDouble *region)
Uses factorization to solve.
ClpCholeskyBase::setModel
void setModel(ClpInterior *model)
model.
Definition ClpCholeskyBase.hpp:218
ClpCholeskyBase::setGoDense
void setGoDense(double value)
goDense i.e. use dense factoriaztion if > this (default 0.7).
Definition ClpCholeskyBase.hpp:117
ClpCholeskyBase::solve
void solve(CoinWorkDouble *region, int type)
solve - 1 just first half, 2 just second half - 3 both.
ClpCholeskyBase::integerParameters_
int integerParameters_[64]
integerParameters
Definition ClpCholeskyBase.hpp:302
ClpCholeskyBase::factorizePart2
void factorizePart2(int *rowsDropped)
Factorize - filling in rowsDropped and returning number dropped in integerParam.
ClpCholeskyBase::size
int size() const
Return size.
Definition ClpCholeskyBase.hpp:132
ClpCholeskyBase::ClpCholeskyBase
ClpCholeskyBase(const ClpCholeskyBase &)
Copy.
ClpCholeskyBase::symbolic
virtual int symbolic()
Does Symbolic factorization given permutation.
ClpCholeskyBase::sparseFactor_
longDouble * sparseFactor_
sparseFactor.
Definition ClpCholeskyBase.hpp:278
ClpCholeskyBase::updateDense
void updateDense(longDouble *d, int *first)
Updates dense part (broken out for profiling).
ClpCholeskyBase::numberRows_
int numberRows_
numberRows. Number of Rows in factorization
Definition ClpCholeskyBase.hpp:266
ClpCholeskyBase::sizeFactor_
int sizeFactor_
sizeFactor.
Definition ClpCholeskyBase.hpp:296
ClpCholeskyBase::numberRows
int numberRows() const
Return number of rows.
Definition ClpCholeskyBase.hpp:127
ClpCholeskyBase::rowsDropped
char * rowsDropped() const
rowsDropped - which rows are gone
Definition ClpCholeskyBase.hpp:102
ClpCholeskyBase::getIntegerParameter
int getIntegerParameter(int i)
get integer parameter
Definition ClpCholeskyBase.hpp:167
ClpCholeskyBase::status_
int status_
status. Status of factorization
Definition ClpCholeskyBase.hpp:268
ClpCholeskyBase::factorize
virtual int factorize(const CoinWorkDouble *diagonal, int *rowsDropped)
Factorize - filling in rowsDropped and returning number dropped.
ClpCholeskyBase::denseThreshold_
int denseThreshold_
Dense threshold (for taking out of Cholesky).
Definition ClpCholeskyBase.hpp:314
ClpCholeskyBase::firstDense_
int firstDense_
First dense row.
Definition ClpCholeskyBase.hpp:300
ClpCholeskyBase::setKKT
void setKKT(bool yesNo)
Set KKT.
Definition ClpCholeskyBase.hpp:157
ClpCholeskyBase::choleskyCondition
double choleskyCondition() const
choleskyCondition.
Definition ClpCholeskyBase.hpp:107
ClpCholeskyBase::link_
int * link_
link array
Definition ClpCholeskyBase.hpp:290
ClpCholeskyBase::workInteger_
int * workInteger_
Definition ClpCholeskyBase.hpp:292
ClpCholeskyBase::numberRowsDropped
int numberRowsDropped() const
numberRowsDropped. Number of rows gone
Definition ClpCholeskyBase.hpp:95
ClpCholeskyBase::goDense
double goDense() const
goDense i.e. use dense factoriaztion if > this (default 0.7).
Definition ClpCholeskyBase.hpp:112
ClpCholeskyBase::rank
int rank() const
rank. Returns rank
Definition ClpCholeskyBase.hpp:122
ClpCholeskyBase::ClpCholeskyBase
ClpCholeskyBase(int denseThreshold=-1)
Constructor which has dense columns activated.
ClpCholeskyBase::getDoubleParameter
double getDoubleParameter(int i)
get double parameter
Definition ClpCholeskyBase.hpp:177
ClpCholeskyBase::clique_
int * clique_
Definition ClpCholeskyBase.hpp:294
ClpCholeskyDense
Definition ClpCholeskyDense.hpp:14
ClpInterior
This solves LPs using interior point methods.
Definition ClpInterior.hpp:72
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition ClpMatrixBase.hpp:38