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