Package org.ojalgo.optimisation.linear
Class SimplexStore
- java.lang.Object
-
- org.ojalgo.optimisation.linear.SimplexStore
-
- Direct Known Subclasses:
RevisedStore
,SimplexTableau
abstract class SimplexStore extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SimplexStore.ColumnState
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
excluded
excluded == not in the basis(package private) int[]
included
included == in the basis(package private) int
m
The number of constraints (upper, lower and equality)private int[]
myExcludedLower
private int[]
myExcludedUnbounded
private int[]
myExcludedUpper
private double[]
myLowerBounds
private EnumPartition<SimplexStore.ColumnState>
myPartition
private int
myRemainingArtificials
private java.util.List<java.lang.String>
myToStringList
private double[]
myUpperBounds
(package private) int
n
The number of variables totally (all kinds)(package private) LinearStructure
structure
-
Constructor Summary
Constructors Constructor Description SimplexStore(LinearStructure linearStructure)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private SimplexStore
basis(int index)
(package private) abstract void
calculateDualDirection(SimplexSolver.ExitInfo exit)
(package private) abstract void
calculateIteration()
(package private) abstract void
calculatePrimalDirection(SimplexSolver.EnterInfo enter)
(package private) abstract Mutate2D
constraintsBody()
The simplex' constraints body (including the parts corresponding to slack and artificial variables).(package private) abstract Mutate1D
constraintsRHS()
The simplex' constraints RHS.(package private) abstract void
copyBasicSolution(double[] solution)
(package private) abstract void
copyObjective()
(package private) int
countRemainingArtificials()
The number of artificial variables in the basis.(package private) double[]
extractSolution()
(package private) abstract double
extractValue()
(package private) java.util.Collection<Equation>
generateCutCandidates(boolean[] integer, NumberContext accuracy, double fractionality, double[] shift)
(package private) SimplexStore.ColumnState
getColumnState(int index)
(package private) abstract double
getCost(int i)
(package private) abstract double
getCurrentElement(int i, SimplexSolver.EnterInfo enter)
The current (tableau) constraint body element.(package private) abstract double
getCurrentElement(SimplexSolver.ExitInfo exit, int je)
The current (tableau) constraint body element.(package private) abstract double
getCurrentRHS(int i)
The current (tableau) constraint RHS.(package private) int[]
getExcludedLower()
Indices of columns/variables at their lower bounds.(package private) int[]
getExcludedUnbounded()
Indices of unbounded columns/variables.(package private) int[]
getExcludedUpper()
Indices of columns/variables at their upper bounds.(package private) abstract double
getInfeasibility(int i)
(package private) double
getLowerBound(int index)
(package private) double[]
getLowerBounds()
(package private) double
getLowerGap(int i)
The "distance" from the current basic value to the lower bound.(package private) double
getRange(int index)
(package private) abstract double
getReducedCost(int je)
(package private) double
getUpperBound(int index)
(package private) double[]
getUpperBounds()
(package private) double
getUpperGap(int i)
The "distance" from the current basic value to the upper bound.(package private) boolean
isArtificial(int col)
(package private) boolean
isExcluded(int index)
(package private) boolean
isIncluded(int index)
(package private) boolean
isNegated(int j)
(package private) boolean
isPrintable()
The problem is small enough to be explicitly printed/logged – log the entire tableau at each iteration when debugging.(package private) boolean
isRemainingArtificials()
Are there any artificial variables in the basis?(package private) SimplexStore
lower(int index)
(package private) DualSimplexSolver
newDualSimplexSolver(Optimisation.Options options, int... basis)
(package private) PhasedSimplexSolver
newPhasedSimplexSolver(Optimisation.Options options, int... basis)
(package private) PrimalSimplexSolver
newPrimalSimplexSolver(Optimisation.Options options, int... basis)
private <S extends SimplexSolver>
SnewSolver(java.util.function.BiFunction<Optimisation.Options,SimplexStore,S> constructor, Optimisation.Options options, int... basis)
(package private) static java.util.function.Function<LinearStructure,SimplexStore>
newStoreFactory(Optimisation.Options options)
(package private) abstract Mutate1D
objective()
The simplex' objective function.protected void
pivot(SimplexSolver.IterDescr iteration)
(package private) void
resetBasis(int[] newBasis)
Everything that is not in the basis is set to be in at lower bound.(package private) abstract void
restoreObjective()
(package private) abstract void
setupClassicPhase1Objective()
protected void
shiftColumn(int col, double shift)
(package private) abstract Primitive1D
sliceBodyRow(int row)
(package private) abstract Primitive1D
sliceDualVariables()
(package private) abstract void
switchObjective()
java.lang.String
toString()
(package private) SimplexStore
unbounded(int index)
(package private) void
update(int exit, int exclEnter)
(package private) void
updateBasis(int exit, SimplexStore.ColumnState exitToBound, int enter)
(package private) boolean
updateRange(int index, double lower, double upper)
(package private) SimplexStore
upper(int index)
-
-
-
Field Detail
-
myExcludedLower
private transient int[] myExcludedLower
-
myExcludedUnbounded
private transient int[] myExcludedUnbounded
-
myExcludedUpper
private transient int[] myExcludedUpper
-
myLowerBounds
private final double[] myLowerBounds
-
myPartition
private final EnumPartition<SimplexStore.ColumnState> myPartition
-
myRemainingArtificials
private int myRemainingArtificials
-
myToStringList
private final java.util.List<java.lang.String> myToStringList
-
myUpperBounds
private final double[] myUpperBounds
-
excluded
final int[] excluded
excluded == not in the basis
-
included
final int[] included
included == in the basis
-
m
final int m
The number of constraints (upper, lower and equality)
-
n
final int n
The number of variables totally (all kinds)
-
structure
final LinearStructure structure
-
-
Constructor Detail
-
SimplexStore
SimplexStore(LinearStructure linearStructure)
-
-
Method Detail
-
newStoreFactory
static java.util.function.Function<LinearStructure,SimplexStore> newStoreFactory(Optimisation.Options options)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
basis
private final SimplexStore basis(int index)
-
newSolver
private <S extends SimplexSolver> S newSolver(java.util.function.BiFunction<Optimisation.Options,SimplexStore,S> constructor, Optimisation.Options options, int... basis)
-
pivot
protected void pivot(SimplexSolver.IterDescr iteration)
-
shiftColumn
protected void shiftColumn(int col, double shift)
-
calculateDualDirection
abstract void calculateDualDirection(SimplexSolver.ExitInfo exit)
-
calculateIteration
abstract void calculateIteration()
-
calculatePrimalDirection
abstract void calculatePrimalDirection(SimplexSolver.EnterInfo enter)
-
constraintsBody
abstract Mutate2D constraintsBody()
The simplex' constraints body (including the parts corresponding to slack and artificial variables).
-
constraintsRHS
abstract Mutate1D constraintsRHS()
The simplex' constraints RHS.
-
copyBasicSolution
abstract void copyBasicSolution(double[] solution)
-
copyObjective
abstract void copyObjective()
-
switchObjective
abstract void switchObjective()
-
countRemainingArtificials
final int countRemainingArtificials()
The number of artificial variables in the basis.
-
extractSolution
final double[] extractSolution()
-
extractValue
abstract double extractValue()
-
generateCutCandidates
final java.util.Collection<Equation> generateCutCandidates(boolean[] integer, NumberContext accuracy, double fractionality, double[] shift)
-
getColumnState
final SimplexStore.ColumnState getColumnState(int index)
-
getCost
abstract double getCost(int i)
-
getCurrentElement
abstract double getCurrentElement(SimplexSolver.ExitInfo exit, int je)
The current (tableau) constraint body element.
-
getCurrentElement
abstract double getCurrentElement(int i, SimplexSolver.EnterInfo enter)
The current (tableau) constraint body element.
-
getCurrentRHS
abstract double getCurrentRHS(int i)
The current (tableau) constraint RHS.
-
getExcludedLower
final int[] getExcludedLower()
Indices of columns/variables at their lower bounds.
-
getExcludedUnbounded
final int[] getExcludedUnbounded()
Indices of unbounded columns/variables.
-
getExcludedUpper
final int[] getExcludedUpper()
Indices of columns/variables at their upper bounds.
-
getInfeasibility
abstract double getInfeasibility(int i)
-
getLowerBound
final double getLowerBound(int index)
-
getLowerBounds
final double[] getLowerBounds()
-
getLowerGap
final double getLowerGap(int i)
The "distance" from the current basic value to the lower bound.
-
getRange
final double getRange(int index)
-
getReducedCost
abstract double getReducedCost(int je)
-
getUpperBound
final double getUpperBound(int index)
-
getUpperBounds
final double[] getUpperBounds()
-
getUpperGap
final double getUpperGap(int i)
The "distance" from the current basic value to the upper bound.
-
isArtificial
final boolean isArtificial(int col)
-
isExcluded
final boolean isExcluded(int index)
-
isIncluded
final boolean isIncluded(int index)
-
isNegated
final boolean isNegated(int j)
-
isPrintable
final boolean isPrintable()
The problem is small enough to be explicitly printed/logged – log the entire tableau at each iteration when debugging.
-
isRemainingArtificials
final boolean isRemainingArtificials()
Are there any artificial variables in the basis?
-
lower
final SimplexStore lower(int index)
-
newDualSimplexSolver
final DualSimplexSolver newDualSimplexSolver(Optimisation.Options options, int... basis)
-
newPhasedSimplexSolver
final PhasedSimplexSolver newPhasedSimplexSolver(Optimisation.Options options, int... basis)
-
newPrimalSimplexSolver
final PrimalSimplexSolver newPrimalSimplexSolver(Optimisation.Options options, int... basis)
-
objective
abstract Mutate1D objective()
The simplex' objective function.
-
resetBasis
void resetBasis(int[] newBasis)
Everything that is not in the basis is set to be in at lower bound.
-
restoreObjective
abstract void restoreObjective()
-
sliceBodyRow
abstract Primitive1D sliceBodyRow(int row)
-
sliceDualVariables
abstract Primitive1D sliceDualVariables()
-
unbounded
final SimplexStore unbounded(int index)
-
update
final void update(int exit, int exclEnter)
-
updateBasis
final void updateBasis(int exit, SimplexStore.ColumnState exitToBound, int enter)
-
updateRange
boolean updateRange(int index, double lower, double upper)
-
upper
final SimplexStore upper(int index)
-
setupClassicPhase1Objective
abstract void setupClassicPhase1Objective()
-
-