Go to the documentation of this file.
9 #ifndef CoinSimpFactorization_H
10 #define CoinSimpFactorization_H
32 FactorPointers(
int numRows,
int numCols,
int *UrowLengths_,
int *UcolLengths_);
73 virtual void postProcess(
const int *sequence,
int *pivotVariable);
102 bool checkBeforeModifying =
false,
103 double acceptablePivot = 1.0e-8);
118 bool noPermute =
false);
124 bool noPermute =
false)
const;
129 bool noPermute =
false);
133 bool noPermute =
false,
bool save =
false)
const;
176 const int colStarts[],
177 const int indicesRow[],
194 int findShortRow(
const int column,
const int length,
int &minRow,
213 void increaseColSize(
const int column,
const int newSize,
const bool b);
217 void enlargeUcol(
const int numNewElements,
const bool b);
219 int findInRow(
const int row,
const int column);
233 void Lxeqb(
double *b)
const;
235 void Lxeqb2(
double *b1,
double *b2)
const;
237 void Uxeqb(
double *b,
double *sol)
const;
239 void Uxeqb2(
double *b1,
double *sol1,
double *sol2,
double *b2)
const;
241 void xLeqb(
double *b)
const;
243 void xUeqb(
double *b,
double *sol)
const;
247 void newEta(
int row,
int numNewElements);
251 void Hxeqb(
double *b)
const;
253 void Hxeqb2(
double *b1,
double *b2)
const;
255 void xHeqb(
double *b)
const;
257 void ftran(
double *b,
double *sol,
bool save)
const;
259 void ftran2(
double *b1,
double *sol1,
double *b2,
double *sol2)
const;
261 void btran(
double *b,
double *sol)
const;
268 int checkPivot(
double saveFromU,
double oldPivot)
const;
326 #ifdef COIN_SIMP_CAPACITY
327 int *UrowCapacities_;
351 #ifdef COIN_SIMP_CAPACITY
352 int *UcolCapacities_;
void GaussEliminate(FactorPointers &pointers, int &r, int &s)
does Gauss elimination
int * pivotRow_
Pivot row.
double * vecKeep_
vector to keep for LUupdate
void increaseRowSize(const int row, const int newSize)
allocates more space for a row of U
virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1, CoinIndexedVector *regionSparse2, CoinIndexedVector *regionSparse3, bool noPermute=false)
does FTRAN on two columns
int * rowPosition_
position of row after permutation
virtual int factor()
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use number...
int * rowOfU_
permutations of rows
int LrowSize_
Size of Lrows_;.
double * Lcolumns_
L by columns.
double * Lrows_
L by rows.
int * LcolLengths_
Lengths of the columns of L.
int upColumnTranspose(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) const
does updateColumnTranspose, the other is a wrapper
int lastEtaRow_
last eta row
int * UcolInd_
Indices in the columns of U.
int mainLoopFactor(FactorPointers &pointers)
main loop of factorization
int * vecLabels_
array of labels (should be initialized to zero)
double * Urows_
U by rows.
int maxEtaRows_
maximum number of eta vectors
void ftran2(double *b1, double *sol1, double *b2, double *sol2) const
same as above but with two columns
int * LrowInd_
indices in the rows of L
int UrowMaxCap_
maximum capacity of Urows
int lastRowInU_
last row in U
int findShortRow(const int column, const int length, int &minRow, int &minRowLength, FactorPointers &pointers)
finds short row that intersects a given column
void initialSomeNumbers()
initializes some numbers
int * EtaInd_
columns of eta vectors
int numberRows() const
Number of Rows after factorization.
int firstColInU_
first column in U
void Lxeqb2(double *b1, double *b2) const
same as above but with two rhs
virtual int * pivotRow() const
Returns pivot row.
virtual int updateColumnFT(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false)
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no...
void btran(double *b, double *sol) const
does BTRAN
double * invOfPivots_
inverse values of the elements of diagonal of U
double maxGrowth_
bound on the growth rate
int minIncrease_
minimum storage increase
int LcolSize_
numbers of elements in L
double * Ucolumns_
U by columns.
void Lxeqb(double *b) const
solves L x = b
virtual 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 * indVector_
array of indices
void gutsOfCopy(const CoinSimpFactorization &other)
The real work of copy.
int UrowEnd_
number of used places in Urows
void Uxeqb2(double *b1, double *sol1, double *sol2, double *b2) const
same as above but with two rhs
virtual CoinOtherFactorization * clone() const
Clone.
void allocateSomeArrays()
allocates several working arrays
double maximumCoefficient() const
Returns maximum absolute value in factorization.
int * LcolStarts_
Starts of the columns of L.
void removeRowFromActSet(const int row, FactorPointers &pointers)
declares a row inactive
int * indices() const
Returns array to put basis indices in.
void xHeqb(double *b) const
solves x H = b
bool doSuhlHeuristic_
do Shul heuristic
double * workArea3_
work array
int * nextRowInU_
next row in U
virtual void getAreas(int numberRows, int numberColumns, int maximumL, int maximumU)
Gets space for a factorization.
int * UcolStarts_
Starts of the columns of U.
int LcolCap_
maximum capacity of L
void increaseColSize(const int column, const int newSize, const bool b)
allocates more space for a column of U
int lastColInU_
last column in U
void gutsOfInitialize()
The real work of constructor.
double updateTol_
maximum size for the diagonal of U after update
void xUeqb(double *b, double *sol) const
solves x U = b
double * Eta_
elements of eta vectors
void copyUbyColumns()
copies U by columns
int * indKeep_
indices of this vector
int numberRows_
Number of Rows in factorization.
int EtaMaxCap_
Capacity of Eta_.
int * colOfU_
permutation of columns
void gutsOfDestructor()
The real work of destructor.
int * EtaStarts_
Starts of eta vectors.
int * LcolInd_
indices in the columns of L
int * secRowOfU_
permutations of rows during LUupdate
virtual int * permute() const
Returns permute in.
int UcolMaxCap_
maximum capacity of Ucolumns_
void newEta(int row, int numNewElements)
creates a new eta vector
int * EtaLengths_
Lengths of eta vectors.
int * colPosition_
position of column after permutation
void allocateSpaceForU()
allocates space for U
int findPivot(FactorPointers &pointers, int &r, int &s, bool &ifSlack)
finds a pivot element using Markowitz count
int checkPivot(double saveFromU, double oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular.
int * prevRowInU_
previous row in U
CoinSimpFactorization & operator=(const CoinSimpFactorization &other)
= copy
double * workArea2_
work array
int numberColumns() const
Total number of columns in factorization.
CoinFactorizationDouble * elements_
Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can ...
int findPivotShCol(FactorPointers &pointers, int &r, int &s)
finds a pivot in a shortest column
int * nextColInU_
next column in U
int LrowCap_
Capacity of Lrows_.
int firstNumberSlacks_
number of slacks in irst basis
int * UrowInd_
Indices in the rows of U.
virtual int replaceColumn(CoinIndexedVector *regionSparse, int pivotRow, double pivotCheck, bool checkBeforeModifying=false, double acceptablePivot=1.0e-8)
Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModify...
void Hxeqb(double *b) const
solves H x = b, where H is a product of eta matrices
int pivotCandLimit_
maximum number of candidates for pivot
void copyRowPermutations()
makes a copy of row permutations
int upColumn(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false, bool save=false) const
does updatecolumn if save==true keeps column for replace column
void enlargeUrow(const int numNewElements)
allocates more space for rows of U
int LUupdate(int newBasicCol)
updates factorization after a Simplex iteration
Abstract base class which also has some scalars so can be used from Dense or Simp.
void increaseLsize()
allocates more space for L
int UcolEnd_
last used position in Ucolumns_
Sparse Matrix Base Class.
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
FactorPointers(int numRows, int numCols, int *UrowLengths_, int *UcolLengths_)
int * UrowStarts_
Starts of the rows of U.
void pivoting(const int pivotRow, const int pivotColumn, const double invPivot, FactorPointers &pointers)
does pivoting
virtual ~CoinSimpFactorization()
Destructor.
int findInRow(const int row, const int column)
finds a given row in a column
void Uxeqb(double *b, double *sol) const
solves U x = b
void Hxeqb2(double *b1, double *b2) const
same as above but with two rhs
int * LrowStarts_
Starts of the rows of L.
int * secRowPosition_
position of row after permutation during LUupdate
void removeColumnFromActSet(const int column, FactorPointers &pointers)
declares a column inactive
int * UcolLengths_
Lengths of the columns of U.
int * auxInd_
auxiliary vector
int * LrowLengths_
Lengths of the rows of L.
virtual int numberElements() const
Total number of elements in factorization.
int numberSlacks_
number of slacks in basis
virtual void preProcess()
PreProcesses column ordered copy of basis.
int keepSize_
number of nonzeros
void factorize(int numberOfRows, int numberOfColumns, const int colStarts[], const int indicesRow[], const double elements[])
calls factorization
int firstRowInU_
first row in U
friend void CoinSimpFactorizationUnitTest(const std::string &mpsDir)
void xLeqb(double *b) const
solves x L = b
pointers used during factorization
virtual void makeNonSingular(int *sequence, int numberColumns)
Makes a non-singular basis by replacing variables.
void ftran(double *b, double *sol, bool save) const
does FTRAN
void copyLbyRows()
copies L by rows
void enlargeUcol(const int numNewElements, const bool b)
allocates more space for columns of U
int findPivotSimp(FactorPointers &pointers, int &r, int &s)
finds a pivot in the first column available
int * UrowLengths_
Lengths of the rows of U.
virtual void postProcess(const int *sequence, int *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
double * denseVector_
work array (should be initialized to zero)
virtual int updateColumnTranspose(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) const
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - i...
int findShortColumn(const int row, const int length, int &minCol, int &minColLength, FactorPointers &pointers)
finds short column that intersects a given row
int findInColumn(const int column, const int row)
finds a given column in a row
CoinSimpFactorization()
Default constructor.
int * EtaPosition_
position of Eta vector
double * auxVector_
auxiliary vector
void updateCurrentRow(const int pivotRow, const int row, const double multiplier, FactorPointers &pointers, int &newNonZeros)
part of pivoting
int * colSlack_
indicator of slack variables
int numberColumns_
Number of Columns in factorization.
double findMaxInRrow(const int row, FactorPointers &pointers)
finds maximum absolute value in a row
int numberPivots_
Number pivots since last factorization.
void clearArrays()
Get rid of all memory.
int EtaSize_
number of elements in Eta_
int * prevColInU_
previous column in U