This deals with Factorization and Updates This is a simple dense version so other people can write a better one. More...
#include <CoinDenseFactorization.hpp>
Public Member Functions | |
void | gutsOfDestructor () |
The real work of desstructor. | |
void | gutsOfInitialize () |
The real work of constructor. | |
void | gutsOfCopy (const CoinDenseFactorization &other) |
The real work of copy. | |
Constructors and destructor and copy | |
CoinDenseFactorization () | |
Default constructor. | |
CoinDenseFactorization (const CoinDenseFactorization &other) | |
Copy constructor. | |
~CoinDenseFactorization () | |
Destructor. | |
CoinDenseFactorization & | operator= (const CoinDenseFactorization &other) |
= copy | |
Do factorization - public | |
void | getAreas (int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU) |
Gets space for a factorization. | |
void | preProcess () |
PreProcesses column ordered copy of basis. | |
int | factor () |
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo. | |
void | postProcess (const int *sequence, int *pivotVariable) |
Does post processing on valid factorization - putting variables on correct rows. | |
void | makeNonSingular (int *sequence, int numberColumns) |
Makes a non-singular basis by replacing variables. | |
general stuff such as status | |
int | status () const |
Returns status. | |
void | setStatus (int value) |
Sets status. | |
int | pivots () const |
Returns number of pivots since factorization. | |
int | numberRows () const |
Number of Rows. | |
int | numberColumns () const |
Total number of columns in factorization. | |
int | numberElements () const |
Total number of elements in factorization. | |
int | numberGoodColumns () const |
Number of good columns in factorization. | |
void | relaxAccuracyCheck (double value) |
Allows change of pivot accuracy check 1.0 == none >1.0 relaxed. | |
double | getAccuracyCheck () const |
Returns status. | |
int | maximumPivots () const |
Maximum number of pivots between factorizations. | |
void | maximumPivots (int value) |
Returns status. | |
double | pivotTolerance () const |
Pivot tolerance. | |
void | pivotTolerance (double value) |
Returns status. | |
double | zeroTolerance () const |
Zero tolerance. | |
void | zeroTolerance (double value) |
Returns status. | |
double | slackValue () const |
Whether slack value is +1 or -1. | |
void | slackValue (double value) |
Returns status. | |
double | maximumCoefficient () const |
Returns maximum absolute value in factorization. | |
rank one updates which do exist | |
int | replaceColumn (CoinIndexedVector *regionSparse, int pivotRow, double pivotCheck, bool checkBeforeModifying=false) |
Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. | |
various uses of factorization (return code number elements) | |
int | updateColumnFT (CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) |
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. | |
int | updateColumn (CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false) const |
This version has same effect as above with FTUpdate==false so number returned is always >=0. | |
int | updateColumnTranspose (CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) const |
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output. | |
various uses of factorization | |
void | clearArrays () |
Get rid of all memory. | |
double * | elements () const |
Returns array to put basis elements in. | |
int * | indices () const |
Returns array to put basis indices in. | |
CoinBigIndex * | starts () const |
Returns array to put basis starts in. | |
int * | pivotRow () const |
Returns pivot row. | |
int * | permute () const |
Returns permute in. | |
int * | permuteBack () const |
Returns permute back. | |
double * | workArea () const |
Returns work area. | |
int * | intWorkArea () const |
Returns int work area. | |
Protected Member Functions | |
int | checkPivot (double saveFromU, double oldPivot) const |
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. | |
Protected Attributes | |
data | |
double | pivotTolerance_ |
Pivot tolerance. | |
double | zeroTolerance_ |
Zero tolerance. | |
double | slackValue_ |
Whether slack value is +1 or -1. | |
double | relaxCheck_ |
Relax check on accuracy in replaceColumn. | |
int | numberRows_ |
Number of Rows in factorization. | |
int | numberColumns_ |
Number of Columns in factorization. | |
int | maximumRows_ |
Maximum rows ever (i.e. use to copy arrays etc). | |
CoinBigIndex | maximumSpace_ |
Maximum length of iterating area. | |
int | numberGoodU_ |
Number factorized in U (not row singletons). | |
int | maximumPivots_ |
Maximum number of pivots before factorization. | |
int | numberPivots_ |
Number pivots since last factorization. | |
CoinBigIndex | factorElements_ |
Number of elements after factorization. | |
int * | pivotRow_ |
Pivot row. | |
int | status_ |
Status of factorization. | |
double * | elements_ |
Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can have nR*nR ints in maxSpace. | |
double * | workArea_ |
Work area of numberRows_. | |
Friends | |
void | CoinDenseFactorizationUnitTest (const std::string &mpsDir) |
This deals with Factorization and Updates This is a simple dense version so other people can write a better one.
I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits.
Definition at line 28 of file CoinDenseFactorization.hpp.
CoinDenseFactorization::CoinDenseFactorization | ( | ) |
Default constructor.
CoinDenseFactorization::CoinDenseFactorization | ( | const CoinDenseFactorization & | other | ) |
Copy constructor.
CoinDenseFactorization::~CoinDenseFactorization | ( | ) |
Destructor.
CoinDenseFactorization& CoinDenseFactorization::operator= | ( | const CoinDenseFactorization & | other | ) |
= copy
void CoinDenseFactorization::getAreas | ( | int | numberRows, | |
int | numberColumns, | |||
CoinBigIndex | maximumL, | |||
CoinBigIndex | maximumU | |||
) |
Gets space for a factorization.
void CoinDenseFactorization::preProcess | ( | ) |
PreProcesses column ordered copy of basis.
int CoinDenseFactorization::factor | ( | ) |
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo.
void CoinDenseFactorization::postProcess | ( | const int * | sequence, | |
int * | pivotVariable | |||
) |
Does post processing on valid factorization - putting variables on correct rows.
void CoinDenseFactorization::makeNonSingular | ( | int * | sequence, | |
int | numberColumns | |||
) |
Makes a non-singular basis by replacing variables.
int CoinDenseFactorization::status | ( | ) | const [inline] |
Returns status.
Definition at line 71 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::setStatus | ( | int | value | ) | [inline] |
Sets status.
Definition at line 75 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::pivots | ( | ) | const [inline] |
Returns number of pivots since factorization.
Definition at line 78 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberRows | ( | ) | const [inline] |
Number of Rows.
Definition at line 82 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberColumns | ( | ) | const [inline] |
Total number of columns in factorization.
Definition at line 86 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberElements | ( | ) | const [inline] |
Total number of elements in factorization.
Definition at line 90 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberGoodColumns | ( | ) | const [inline] |
Number of good columns in factorization.
Definition at line 94 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::relaxAccuracyCheck | ( | double | value | ) | [inline] |
Allows change of pivot accuracy check 1.0 == none >1.0 relaxed.
Definition at line 98 of file CoinDenseFactorization.hpp.
double CoinDenseFactorization::getAccuracyCheck | ( | ) | const [inline] |
Returns status.
Definition at line 100 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::maximumPivots | ( | ) | const [inline] |
Maximum number of pivots between factorizations.
Definition at line 103 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::maximumPivots | ( | int | value | ) |
Returns status.
double CoinDenseFactorization::pivotTolerance | ( | ) | const [inline] |
Pivot tolerance.
Definition at line 109 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::pivotTolerance | ( | double | value | ) |
Returns status.
double CoinDenseFactorization::zeroTolerance | ( | ) | const [inline] |
Zero tolerance.
Definition at line 114 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::zeroTolerance | ( | double | value | ) | [inline] |
Returns status.
Definition at line 117 of file CoinDenseFactorization.hpp.
double CoinDenseFactorization::slackValue | ( | ) | const [inline] |
Whether slack value is +1 or -1.
Definition at line 120 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::slackValue | ( | double | value | ) |
Returns status.
double CoinDenseFactorization::maximumCoefficient | ( | ) | const |
Returns maximum absolute value in factorization.
int CoinDenseFactorization::replaceColumn | ( | CoinIndexedVector * | regionSparse, | |
int | pivotRow, | |||
double | pivotCheck, | |||
bool | checkBeforeModifying = false | |||
) |
Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization.
Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U
int CoinDenseFactorization::updateColumnFT | ( | CoinIndexedVector * | regionSparse, | |
CoinIndexedVector * | regionSparse2 | |||
) | [inline] |
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end.
Note - if regionSparse2 packed on input - will be packed on output
Definition at line 153 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::updateColumn | ( | CoinIndexedVector * | regionSparse, | |
CoinIndexedVector * | regionSparse2, | |||
bool | noPermute = false | |||
) | const |
This version has same effect as above with FTUpdate==false so number returned is always >=0.
int CoinDenseFactorization::updateColumnTranspose | ( | CoinIndexedVector * | regionSparse, | |
CoinIndexedVector * | regionSparse2 | |||
) | const |
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output.
void CoinDenseFactorization::clearArrays | ( | ) | [inline] |
Get rid of all memory.
Definition at line 174 of file CoinDenseFactorization.hpp.
double* CoinDenseFactorization::elements | ( | ) | const [inline] |
Returns array to put basis elements in.
Definition at line 177 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::indices | ( | ) | const [inline] |
Returns array to put basis indices in.
Definition at line 180 of file CoinDenseFactorization.hpp.
CoinBigIndex* CoinDenseFactorization::starts | ( | ) | const [inline] |
Returns array to put basis starts in.
Definition at line 183 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::pivotRow | ( | ) | const [inline] |
Returns pivot row.
Definition at line 186 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::permute | ( | ) | const [inline] |
Returns permute in.
Definition at line 189 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::permuteBack | ( | ) | const [inline] |
Returns permute back.
Definition at line 192 of file CoinDenseFactorization.hpp.
double* CoinDenseFactorization::workArea | ( | ) | const [inline] |
Returns work area.
Definition at line 195 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::intWorkArea | ( | ) | const [inline] |
Returns int work area.
Definition at line 198 of file CoinDenseFactorization.hpp.
void CoinDenseFactorization::gutsOfDestructor | ( | ) |
The real work of desstructor.
void CoinDenseFactorization::gutsOfInitialize | ( | ) |
The real work of constructor.
void CoinDenseFactorization::gutsOfCopy | ( | const CoinDenseFactorization & | other | ) |
The real work of copy.
int CoinDenseFactorization::checkPivot | ( | double | saveFromU, | |
double | oldPivot | |||
) | const [protected] |
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular.
void CoinDenseFactorizationUnitTest | ( | const std::string & | mpsDir | ) | [friend] |
double CoinDenseFactorization::pivotTolerance_ [protected] |
Pivot tolerance.
Definition at line 220 of file CoinDenseFactorization.hpp.
double CoinDenseFactorization::zeroTolerance_ [protected] |
Zero tolerance.
Definition at line 222 of file CoinDenseFactorization.hpp.
double CoinDenseFactorization::slackValue_ [protected] |
Whether slack value is +1 or -1.
Definition at line 224 of file CoinDenseFactorization.hpp.
double CoinDenseFactorization::relaxCheck_ [protected] |
Relax check on accuracy in replaceColumn.
Definition at line 226 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberRows_ [protected] |
Number of Rows in factorization.
Definition at line 228 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberColumns_ [protected] |
Number of Columns in factorization.
Definition at line 230 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::maximumRows_ [protected] |
Maximum rows ever (i.e. use to copy arrays etc).
Definition at line 232 of file CoinDenseFactorization.hpp.
CoinBigIndex CoinDenseFactorization::maximumSpace_ [protected] |
Maximum length of iterating area.
Definition at line 234 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberGoodU_ [protected] |
Number factorized in U (not row singletons).
Definition at line 236 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::maximumPivots_ [protected] |
Maximum number of pivots before factorization.
Definition at line 238 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::numberPivots_ [protected] |
Number pivots since last factorization.
Definition at line 240 of file CoinDenseFactorization.hpp.
CoinBigIndex CoinDenseFactorization::factorElements_ [protected] |
Number of elements after factorization.
Definition at line 242 of file CoinDenseFactorization.hpp.
int* CoinDenseFactorization::pivotRow_ [protected] |
Pivot row.
Definition at line 244 of file CoinDenseFactorization.hpp.
int CoinDenseFactorization::status_ [protected] |
Status of factorization.
Definition at line 246 of file CoinDenseFactorization.hpp.
double* CoinDenseFactorization::elements_ [protected] |
Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can have nR*nR ints in maxSpace.
Definition at line 251 of file CoinDenseFactorization.hpp.
double* CoinDenseFactorization::workArea_ [protected] |
Work area of numberRows_.
Definition at line 253 of file CoinDenseFactorization.hpp.