Package org.ojalgo.optimisation.linear
Class SimplexSolver
java.lang.Object
org.ojalgo.optimisation.GenericSolver
org.ojalgo.optimisation.linear.LinearSolver
org.ojalgo.optimisation.linear.SimplexSolver
- All Implemented Interfaces:
Optimisation
,Optimisation.Solver
,UpdatableSolver
- Direct Known Subclasses:
DualSimplexSolver
,PhasedSimplexSolver
,PrimalSimplexSolver
Meant to replace
SimplexTableauSolver
. It is already better in many aspects, but still can't do
everything required to fully replace the old solver.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
(package private) static final class
(package private) static final class
Exit fromSimplexStore.ColumnState.BASIS
to eitherSimplexStore.ColumnState.LOWER
orSimplexStore.ColumnState.UPPER
.(package private) static final class
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
FieldsModifier and TypeFieldDescriptionprivate final SimplexStore
private final double[]
private double
private static final NumberContext
private static final NumberContext
Fields inherited from class org.ojalgo.optimisation.linear.LinearSolver
INTEGRATION, NEW_INTEGRATION, OLD_INTEGRATION
Fields inherited from class org.ojalgo.optimisation.GenericSolver
options
-
Constructor Summary
ConstructorsConstructorDescriptionSimplexSolver
(Optimisation.Options solverOptions, SimplexStore simplexStore) -
Method Summary
Modifier and TypeMethodDescription(package private) final SimplexSolver
basis
(int[] basis) (package private) static <S extends SimplexStore>
Sbuild
(ExpressionsBasedModel model, Function<LinearStructure, S> factory) (package private) final void
doDualIterations
(SimplexSolver.IterDescr iteration) (package private) final void
doPrimalIterations
(SimplexSolver.IterDescr iteration) private Access1D
<?> (package private) final Optimisation.Result
private double[]
private double
boolean
fixVariable
(int index, double value) final Collection
<Equation> generateCutCandidates
(double fractionality, boolean... integer) private boolean
getDualExitCandidate
(SimplexSolver.IterDescr iteration) private double
getLowerBound
(int index) private double[]
private boolean
getPrimalEnterCandidate
(SimplexSolver.IterDescr iteration) private double
getUpperBound
(int index) private double[]
(package private) final void
(package private) final boolean
(package private) final boolean
private void
(package private) final SimplexSolver.IterDescr
(package private) 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.(package private) final void
shift
(int index, double shift, double weight) private void
shift
(int column, SimplexStore.ColumnState state) private Optimisation.Result
(package private) void
private boolean
testDualEnterRatio
(SimplexSolver.IterDescr iteration) private boolean
testPrimalExitRatio
(SimplexSolver.IterDescr iteration) private void
update
(SimplexSolver.IterDescr iteration) boolean
updateRange
(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.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, 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, solve
Methods inherited from interface org.ojalgo.optimisation.UpdatableSolver
integers, isMapped
-
Field Details
-
PIVOT
-
RATIO
-
mySimplex
-
mySolutionShift
private final double[] mySolutionShift -
myValueShift
private double myValueShift
-
-
Constructor Details
-
SimplexSolver
SimplexSolver(Optimisation.Options solverOptions, SimplexStore simplexStore)
-
-
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 indexvalue
- The value to fix that variable to- Returns:
- true if fixing is supported and was successful, otherwise false
-
generateCutCandidates
-
getEntityMap
-
updateRange
public boolean updateRange(int index, double lower, double upper) Description copied from interface:UpdatableSolver
A 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
-
extractMultipliers
-
extractSolution
private double[] extractSolution() -
extractValue
private double extractValue() -
getDualExitCandidate
-
getLowerBound
private double getLowerBound(int index) -
getLowerBounds
private double[] getLowerBounds() -
getPrimalEnterCandidate
-
getUpperBound
private double getUpperBound(int index) -
getUpperBounds
private double[] getUpperBounds() -
logCurrentState
private void logCurrentState() -
shift
-
solveUnconstrained
-
testDualEnterRatio
-
testPrimalExitRatio
-
update
-
basis
-
doDualIterations
-
doPrimalIterations
-
extractResult
-
initiatePhase1
final void initiatePhase1() -
isDualFeasible
final boolean isDualFeasible() -
isPrimalFeasible
final boolean isPrimalFeasible() -
prepareToIterate
-
setup
- 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()
-