Class DecomposedInverse

java.lang.Object
org.ojalgo.optimisation.linear.DecomposedInverse
All Implemented Interfaces:
InvertibleFactor<Double>, BasisRepresentation, Structure1D, Structure2D

final class DecomposedInverse extends Object implements BasisRepresentation
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.
  • Field Details

    • UPDATES_LIMIT

      private static final int UPDATES_LIMIT
      Maximum number of updates before forcing a complete refactorization to prevent numerical instability from accumulated roundoff errors.
      See Also:
    • myDecomposition

      private final LU<Double> 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:
      btran in interface InvertibleFactor<Double>
      See Also:
    • btran

      public void btran(PhysicalStore<Double> arg)
      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:
      btran in interface InvertibleFactor<Double>
      Parameters:
      arg - [b] transformed into [x]
    • ftran

      public void ftran(double[] arg)
      Specified by:
      ftran in interface InvertibleFactor<Double>
      See Also:
    • ftran

      public void ftran(PhysicalStore<Double> arg)
      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:
      ftran in interface InvertibleFactor<Double>
      Parameters:
      arg - [b] transformed into [x]
    • getColDim

      public int getColDim()
      Specified by:
      getColDim in interface Structure2D
      Returns:
      The number of columns
    • getRowDim

      public int getRowDim()
      Specified by:
      getRowDim in interface Structure2D
      Returns:
      The number of rows
    • reset

      public void reset(MatrixStore<Double> basis)
      Completely rebuilds the decomposition from the given basis matrix. Resets the update counter.
      Specified by:
      reset in interface BasisRepresentation
    • update

      public void update(MatrixStore<Double> basis, int col, SparseArray<Double> values)
      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:
      update in interface BasisRepresentation
      Parameters:
      basis - The current basis matrix (used only if refactorization is needed)
      col - The column index in the basis being replaced
      values - The new column values