- java.lang.Object
-
- org.ojalgo.optimisation.GenericSolver
-
- org.ojalgo.optimisation.linear.LinearSolver
-
- org.ojalgo.optimisation.linear.SimplexTableauSolver
-
- All Implemented Interfaces:
Optimisation,Optimisation.Solver,UpdatableSolver
final class SimplexTableauSolver extends LinearSolver
Classic simplex tableau solver:- Primal algorithm
- 2-phase
- All variables assumed >=0, and RHS required to be >=0
- Variable bounds other than >=0 handled like constraints
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSimplexTableauSolver.IterationPoint-
Nested classes/interfaces inherited from class org.ojalgo.optimisation.linear.LinearSolver
LinearSolver.Builder, LinearSolver.Configuration, LinearSolver.ModelIntegration, LinearSolver.NewIntegration, LinearSolver.OldIntegration
-
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.Optimisation
Optimisation.Constraint, Optimisation.ConstraintType, Optimisation.Integration<M extends Optimisation.Model,S extends Optimisation.Solver>, Optimisation.Model, Optimisation.Objective, Optimisation.Options, Optimisation.ProblemStructure, Optimisation.Result, Optimisation.Sense, Optimisation.Solver, Optimisation.State
-
-
Field Summary
Fields Modifier and Type Field Description private static NumberContextACCprivate static NumberContextDEGENERATEprivate LongToNumberMap<java.lang.Double>myFixedVariablesprivate SimplexTableauSolver.IterationPointmyPointprivate SimplexTableaumyTableauprivate static NumberContextPHASE1private static NumberContextPIVOTprivate static NumberContextRATIOprivate static NumberContextWEIGHT-
Fields inherited from class org.ojalgo.optimisation.linear.LinearSolver
INTEGRATION, NEWER_DUAL_SOLVER, OLDER_PRIMAL_SOLVER
-
Fields inherited from class org.ojalgo.optimisation.GenericSolver
options
-
-
Constructor Summary
Constructors Constructor Description SimplexTableauSolver(SimplexTableau tableau, Optimisation.Options solverOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static <T extends SimplexTableau>
Tbuild(ExpressionsBasedModel model, java.util.function.Function<LinearStructure,T> factory)protected Optimisation.ResultbuildResult()private voidcleanUpPhase1Artificials()https://math.stackexchange.com/questions/3254444/artificial-variables-in-two-phase-simplex-method(package private) static Optimisation.ResultdoSolveConvexAsDual(ConvexData<java.lang.Double> convex, Optimisation.Options options, boolean zeroC)(package private) static Optimisation.ResultdoSolveConvexAsPrimal(ConvexData<java.lang.Double> convex, Optimisation.Options options, boolean zeroC)protected doubleevaluateFunction(Access1D<?> solution)protected Access1D<?>extractMultipliers()protected Access1D<?>extractSolution()Extract solution MatrixStore from the tableau.(package private) intfindNextPivotCol()(package private) intfindNextPivotRow()booleanfixVariable(int index, double value)java.util.Collection<Equation>generateCutCandidates(double fractionality, boolean... integer)LinearStructuregetEntityMap()private intgetRowObjective()private doubleinfeasibility()protected booleaninitialise(Optimisation.Result kickStarter)private booleanisTableauPrintable()private voidlogDebugTableau(java.lang.String message)protected booleanneedsAnotherIteration()(package private) voidperformIteration(SimplexTableauSolver.IterationPoint pivot)private intphase()(package private) static voidset(ExpressionsBasedModel model, Primitive2D constraintsBdy, int indCnstr, int basePosVars, int baseNegVars, Variable variable, double factor)(package private) static voidset(ExpressionsBasedModel model, Primitive2D constraintsBdy, int indCnstr, int basePosVars, int baseNegVars, Structure1D.IntIndex key, double factor)(package private) static intsizeOfDual(ConvexData<?> convex)(package private) static intsizeOfPrimal(ConvexData<?> convex)Optimisation.Resultsolve(Optimisation.Result kickStarter)booleanupdateRange(int index, double lower, double upper)A generalisation ofUpdatableSolver.fixVariable(int, double)where the new/updated lower and upper bounds do not need to be equal.protected booleanvalidate()private doublevalue()-
Methods inherited from class org.ojalgo.optimisation.linear.LinearSolver
newBuilder, newBuilder, newGeneralBuilder, newGeneralBuilder, newSolver, newStandardBuilder, newStandardBuilder, solve, toObjectiveFunction
-
Methods inherited from class org.ojalgo.optimisation.GenericSolver
countIterations, countTime, error, getClassSimpleName, getDuration, getState, incrementIterationsCount, isIterationAllowed, isLogDebug, isLogOff, isLogProgress, log, log, log, log, logProgress, printf, resetIterationsCount, setState, setValidator, validate, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ojalgo.optimisation.Optimisation.Solver
dispose, solve
-
Methods inherited from interface org.ojalgo.optimisation.UpdatableSolver
integers, isMapped
-
-
-
-
Field Detail
-
ACC
private static final NumberContext ACC
-
DEGENERATE
private static final NumberContext DEGENERATE
-
PHASE1
private static final NumberContext PHASE1
-
PIVOT
private static final NumberContext PIVOT
-
RATIO
private static final NumberContext RATIO
-
WEIGHT
private static final NumberContext WEIGHT
-
myFixedVariables
private LongToNumberMap<java.lang.Double> myFixedVariables
-
myPoint
private final SimplexTableauSolver.IterationPoint myPoint
-
myTableau
private final SimplexTableau myTableau
-
-
Constructor Detail
-
SimplexTableauSolver
SimplexTableauSolver(SimplexTableau tableau, Optimisation.Options solverOptions)
-
-
Method Detail
-
build
static <T extends SimplexTableau> T build(ExpressionsBasedModel model, java.util.function.Function<LinearStructure,T> factory)
-
doSolveConvexAsDual
static Optimisation.Result doSolveConvexAsDual(ConvexData<java.lang.Double> convex, Optimisation.Options options, boolean zeroC)
-
doSolveConvexAsPrimal
static Optimisation.Result doSolveConvexAsPrimal(ConvexData<java.lang.Double> convex, Optimisation.Options options, boolean zeroC)
-
set
static void set(ExpressionsBasedModel model, Primitive2D constraintsBdy, int indCnstr, int basePosVars, int baseNegVars, Structure1D.IntIndex key, double factor)
-
set
static void set(ExpressionsBasedModel model, Primitive2D constraintsBdy, int indCnstr, int basePosVars, int baseNegVars, Variable variable, double factor)
-
sizeOfDual
static int sizeOfDual(ConvexData<?> convex)
-
sizeOfPrimal
static int sizeOfPrimal(ConvexData<?> convex)
-
fixVariable
public boolean fixVariable(int index, double value)- Parameters:
index- The, solver specific, variable indexvalue- The value to fix that variable to- Returns:
- true if fixing is supported and was successful, otherwise false
-
generateCutCandidates
public final java.util.Collection<Equation> generateCutCandidates(double fractionality, boolean... integer)
-
getEntityMap
public LinearStructure getEntityMap()
-
solve
public Optimisation.Result solve(Optimisation.Result kickStarter)
-
updateRange
public boolean updateRange(int index, double lower, double upper)Description copied from interface:UpdatableSolverA generalisation ofUpdatableSolver.fixVariable(int, double)where the new/updated lower and upper bounds do not need to be equal.- Parameters:
index- The, solver specific, variable indexlower- New lower boundupper- New upper bound- Returns:
- true if updating the range is supported and was successful, otherwise false
-
cleanUpPhase1Artificials
private void cleanUpPhase1Artificials()
https://math.stackexchange.com/questions/3254444/artificial-variables-in-two-phase-simplex-method
-
getRowObjective
private int getRowObjective()
-
infeasibility
private double infeasibility()
-
isTableauPrintable
private boolean isTableauPrintable()
-
logDebugTableau
private void logDebugTableau(java.lang.String message)
-
phase
private int phase()
-
value
private double value()
-
buildResult
protected Optimisation.Result buildResult()
-
evaluateFunction
protected double evaluateFunction(Access1D<?> solution)
-
extractMultipliers
protected Access1D<?> extractMultipliers()
-
extractSolution
protected Access1D<?> extractSolution()
Extract solution MatrixStore from the tableau. Should be able to feed this toevaluateFunction(Access1D).
-
initialise
protected boolean initialise(Optimisation.Result kickStarter)
-
needsAnotherIteration
protected boolean needsAnotherIteration()
-
validate
protected boolean validate()
-
findNextPivotCol
int findNextPivotCol()
-
findNextPivotRow
int findNextPivotRow()
-
performIteration
void performIteration(SimplexTableauSolver.IterationPoint pivot)
-
-