- 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 classSimplexStore.ColumnState
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]edgeWeightsEither the primal or dual devex edge weights, depending on the algorithm used.(package private) int[]excludedexcluded == not in the basis(package private) int[]includedincluded == in the basis(package private) intmThe number of constraints (upper, lower and equality)private double[]myLowerBoundsprivate EnumPartition<SimplexStore.ColumnState>myPartitionprivate intmyRemainingArtificialsprivate java.util.List<java.lang.String>myToStringListprivate double[]myUpperBounds(package private) intnThe number of variables totally (all kinds)(package private) LinearStructurestructure
-
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 SimplexStorebasis(int index)(package private) abstract voidcalculateDualDirection(SimplexSolver.ExitInfo exit)(package private) abstract voidcalculateIteration(SimplexSolver.IterDescr iteration, double shift)(package private) abstract voidcalculatePrimalDirection(SimplexSolver.EnterInfo enter)(package private) abstract Mutate2DconstraintsBody()The simplex' constraints body (including the parts corresponding to slack and artificial variables).(package private) abstract Mutate1DconstraintsRHS()The simplex' constraints RHS.(package private) abstract voidcopyBasicSolution(double[] solution)(package private) intcountRemainingArtificials()The number of artificial variables in the basis.(package private) double[]extractSolution()(package private) abstract doubleextractValue()(package private) java.util.Collection<Equation>generateCutCandidates(boolean[] integer, NumberContext accuracy, double fractionality, double[] shift)WhenSimplexSolveris used as node solver forIntegerSolverthis method generates cut candidates.(package private) SimplexStore.ColumnStategetColumnState(int index)(package private) abstract doublegetCost(int i)(package private) abstract doublegetCurrentElement(int i, SimplexSolver.EnterInfo enter)The current (tableau) constraint body element.(package private) abstract doublegetCurrentElement(SimplexSolver.ExitInfo exit, int je)The current (tableau) constraint body element.(package private) abstract doublegetCurrentRHS(int i)The current (tableau) constraint RHS.(package private) abstract doublegetInfeasibility(int i)(package private) doublegetLowerBound(int index)(package private) double[]getLowerBounds()(package private) doublegetLowerGap(int i)The "distance" from the current basic value to the lower bound.(package private) doublegetRange(int index)(package private) abstract doublegetReducedCost(int je)(package private) doublegetUpperBound(int index)(package private) double[]getUpperBounds()(package private) doublegetUpperGap(int i)The "distance" from the current basic value to the upper bound.(package private) booleanisArtificial(int col)(package private) booleanisExcluded(int index)(package private) booleanisIncluded(int index)(package private) booleanisNegated(int j)(package private) booleanisPrintable()The problem is small enough to be explicitly printed/logged – log the entire tableau at each iteration when debugging.(package private) booleanisRemainingArtificials()Are there any artificial variables in the basis?(package private) SimplexStorelower(int index)(package private) DualSimplexSolvernewDualSimplexSolver(Optimisation.Options options, int... basis)(package private) PhasedSimplexSolvernewPhasedSimplexSolver(Optimisation.Options options, int... basis)(package private) PrimalSimplexSolvernewPrimalSimplexSolver(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 Mutate1Dobjective()The objective function.(package private) abstract <T extends Mutate1D & Access1D<java.lang.Double>>
Tphase1()The phase-1 objective function.protected voidpivot(SimplexSolver.IterDescr iteration)(package private) abstract voidprepareToIterate()(package private) abstract voidremovePhase1()(package private) voidresetBasis(int[] newBasis)Everything that is not in the basis is set to be in at lower bound.(package private) voidresetEdgeWeights()(package private) abstract voidsetupClassicPhase1Objective()protected voidshiftColumn(int col, double shift)(package private) abstract Primitive1DsliceBodyRow(int row)(package private) abstract Primitive1DsliceDualVariables()java.lang.StringtoString()(package private) SimplexStoreunbounded(int index)(package private) voidupdate(int exit, int exclEnter)(package private) voidupdateBasis(int exit, SimplexStore.ColumnState exitToBound, int enter)(package private) abstract voidupdateDualEdgeWeights(SimplexSolver.IterDescr iteration)Update edge weights for basic (included) variables.(package private) abstract voidupdatePrimalEdgeWeights(SimplexSolver.IterDescr iteration)Update edge weights for non-basic (excluded) variables.(package private) booleanupdateRange(int index, double lower, double upper)(package private) SimplexStoreupper(int index)
-
-
-
Field Detail
-
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
-
edgeWeights
final double[] edgeWeights
Either the primal or dual devex edge weights, depending on the algorithm used. Sized so that it can hold either.
-
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:
toStringin 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(SimplexSolver.IterDescr iteration, double shift)
-
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)
-
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)
WhenSimplexSolveris used as node solver forIntegerSolverthis method generates cut candidates.
-
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.
-
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 objective function.
-
phase1
abstract <T extends Mutate1D & Access1D<java.lang.Double>> T phase1()
The phase-1 objective function.
-
prepareToIterate
abstract void prepareToIterate()
-
removePhase1
abstract void removePhase1()
-
resetBasis
void resetBasis(int[] newBasis)
Everything that is not in the basis is set to be in at lower bound.
-
resetEdgeWeights
void resetEdgeWeights()
-
setupClassicPhase1Objective
abstract void setupClassicPhase1Objective()
-
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)
-
updateDualEdgeWeights
abstract void updateDualEdgeWeights(SimplexSolver.IterDescr iteration)
Update edge weights for basic (included) variables.
-
updatePrimalEdgeWeights
abstract void updatePrimalEdgeWeights(SimplexSolver.IterDescr iteration)
Update edge weights for non-basic (excluded) variables.
-
updateRange
boolean updateRange(int index, double lower, double upper)
-
upper
final SimplexStore upper(int index)
-
-