Class DecomposedInverse
java.lang.Object
org.ojalgo.optimisation.linear.DecomposedInverse
- All Implemented Interfaces:
InvertibleFactor<Double>, BasisRepresentation, Structure1D, Structure2D
Maintains an LU decomposition of the basis matrix for efficient solving of linear systems in the revised
simplex method. Supports incremental updates using the Forrest-Tomlin algorithm when columns change, with
periodic refactorization to maintain numerical stability.
-
Nested Class Summary
Nested classes/interfaces inherited from interface InvertibleFactor
InvertibleFactor.IdentityFactor<N>Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallbackNested classes/interfaces inherited from interface Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S,B>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R>, Structure2D.Reshapable, Structure2D.RowColumnKey<R, C>, Structure2D.RowColumnMapper<R, C> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static final intMaximum number of updates before forcing a complete refactorization to prevent numerical instability from accumulated roundoff errors. -
Constructor Summary
ConstructorsConstructorDescriptionDecomposedInverse(boolean sparse, int dim) Creates a new decomposition-based basis representation. -
Method Summary
Modifier and TypeMethodDescriptionvoidbtran(double[] arg) voidbtran(PhysicalStore<Double> arg) Solves the transposed system B^T x = b, overwriting the right-hand side with the solution.voidftran(double[] arg) voidftran(PhysicalStore<Double> arg) Solves the system B x = b, overwriting the right-hand side with the solution.intintvoidreset(MatrixStore<Double> basis) Completely rebuilds the decomposition from the given basis matrix.voidupdate(MatrixStore<Double> basis, int col, SparseArray<Double> values) Updates the decomposition to reflect a change in the basis matrix.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Structure2D
count, countColumns, countRows, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Field Details
-
UPDATES_LIMIT
private static final int UPDATES_LIMITMaximum number of updates before forcing a complete refactorization to prevent numerical instability from accumulated roundoff errors.- See Also:
-
myDecomposition
-
myUpdateCounter
private int myUpdateCounter
-
-
Constructor Details
-
DecomposedInverse
DecomposedInverse(boolean sparse, int dim) Creates a new decomposition-based basis representation.- Parameters:
sparse- Whether to use sparse LU decomposition (recommended for larger sparse problems)dim- Dimension of the basis matrix
-
-
Method Details
-
btran
public void btran(double[] arg) - Specified by:
btranin interfaceInvertibleFactor<Double>- See Also:
-
btran
Solves the transposed system B^T x = b, overwriting the right-hand side with the solution. Used to compute dual variables (shadow prices) in the simplex method.- Specified by:
btranin interfaceInvertibleFactor<Double>- Parameters:
arg- [b] transformed into [x]
-
ftran
public void ftran(double[] arg) - Specified by:
ftranin interfaceInvertibleFactor<Double>- See Also:
-
ftran
Solves the system B x = b, overwriting the right-hand side with the solution. Used to compute the basic solution and direction vectors in the simplex method.- Specified by:
ftranin interfaceInvertibleFactor<Double>- Parameters:
arg- [b] transformed into [x]
-
getColDim
public int getColDim()- Specified by:
getColDimin interfaceStructure2D- Returns:
- The number of columns
-
getRowDim
public int getRowDim()- Specified by:
getRowDimin interfaceStructure2D- Returns:
- The number of rows
-
reset
Completely rebuilds the decomposition from the given basis matrix. Resets the update counter.- Specified by:
resetin interfaceBasisRepresentation
-
update
Updates the decomposition to reflect a change in the basis matrix. Uses the Forrest-Tomlin update algorithm to efficiently modify the LU factors. Falls back to a complete refactorization if: 1. The update counter exceeds the limit 2. The decomposition is not in a computed state 3. The update operation fails due to numerical issues- Specified by:
updatein interfaceBasisRepresentation- Parameters:
basis- The current basis matrix (used only if refactorization is needed)col- The column index in the basis being replacedvalues- The new column values
-