Class SimplexSolver

All Implemented Interfaces:
Optimisation, Optimisation.Solver, UpdatableSolver
Direct Known Subclasses:
DualSimplexSolver, PhasedSimplexSolver, PrimalSimplexSolver

abstract class SimplexSolver extends LinearSolver
Meant to replace SimplexTableauSolver. It is already better in many aspects, but still can't do everything required to fully replace the old solver.
  • Field Details

    • PIVOT

      private static final NumberContext PIVOT
    • RATIO

      private static final NumberContext RATIO
    • mySimplex

      private final SimplexStore mySimplex
    • mySolutionShift

      private final double[] mySolutionShift
    • myValueShift

      private double myValueShift
  • Constructor Details

  • Method Details

    • build

      static <S extends SimplexStore> S build(ExpressionsBasedModel model, Function<LinearStructure,S> factory)
    • fixVariable

      public boolean fixVariable(int index, double value)
      Parameters:
      index - The, solver specific, variable index
      value - The value to fix that variable to
      Returns:
      true if fixing is supported and was successful, otherwise false
    • generateCutCandidates

      public final Collection<Equation> generateCutCandidates(double fractionality, boolean... integer)
    • getEntityMap

      public LinearStructure getEntityMap()
    • updateRange

      public boolean updateRange(int index, double lower, double upper)
      Description copied from interface: UpdatableSolver
      A generalisation of UpdatableSolver.fixVariable(int, double) where the new/updated lower and upper bounds do not need to be equal.
      Parameters:
      index - The, solver specific, variable index
      lower - New lower bound
      upper - New upper bound
      Returns:
      true if updating the range is supported and was successful, otherwise false
    • extractMultipliers

      private Access1D<?> extractMultipliers()
    • extractSolution

      private double[] extractSolution()
    • extractValue

      private double extractValue()
    • getDualExitCandidate

      private boolean getDualExitCandidate(SimplexSolver.IterDescr iteration)
    • getLowerBound

      private double getLowerBound(int index)
    • getLowerBounds

      private double[] getLowerBounds()
    • getPrimalEnterCandidate

      private boolean getPrimalEnterCandidate(SimplexSolver.IterDescr iteration)
    • getUpperBound

      private double getUpperBound(int index)
    • getUpperBounds

      private double[] getUpperBounds()
    • logCurrentState

      private void logCurrentState()
    • shift

      private void shift(int column, SimplexStore.ColumnState state)
    • solveUnconstrained

      private Optimisation.Result solveUnconstrained()
    • testDualEnterRatio

      private boolean testDualEnterRatio(SimplexSolver.IterDescr iteration)
    • testPrimalExitRatio

      private boolean testPrimalExitRatio(SimplexSolver.IterDescr iteration)
    • update

      private void update(SimplexSolver.IterDescr iteration)
    • basis

      final SimplexSolver basis(int[] basis)
    • doDualIterations

      final void doDualIterations(SimplexSolver.IterDescr iteration)
    • doPrimalIterations

      final void doPrimalIterations(SimplexSolver.IterDescr iteration)
    • extractResult

      final Optimisation.Result extractResult()
    • initiatePhase1

      final void initiatePhase1()
    • isDualFeasible

      final boolean isDualFeasible()
    • isPrimalFeasible

      final boolean isPrimalFeasible()
    • prepareToIterate

      final SimplexSolver.IterDescr prepareToIterate()
    • setup

      abstract void setup(SimplexStore simplex)
      • Determine if non-basic variables are at their lower or upper bound (or if they are unbounded)
      • Shift ranges/bounds so that (one of) the bound(s) is at zero
      • Assumes that the ranges/bounds of basic variables are already defined this way.
    • shift

      final void shift(int index, double shift, double weight)
    • switchToPhase2

      void switchToPhase2()