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 classExit fromSimplexStore.ColumnState.BASISto eitherSimplexStore.ColumnState.LOWERorSimplexStore.ColumnState.UPPER.(package private) static final classNested classes/interfaces inherited from class LinearSolver
LinearSolver.Builder, LinearSolver.Configuration, LinearSolver.ModelIntegration, LinearSolver.NewIntegration, LinearSolver.OldIntegrationNested classes/interfaces inherited from interface Optimisation
Optimisation.Constraint, Optimisation.ConstraintType, Optimisation.Integration<M,S>, Optimisation.Model, Optimisation.Objective, Optimisation.Options, Optimisation.ProblemStructure, Optimisation.Result, Optimisation.Sense, Optimisation.Solver, Optimisation.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SimplexStoreprivate final double[]private doubleprivate static final NumberContextprivate static final NumberContextFields inherited from class LinearSolver
INTEGRATION, NEWER_DUAL_SOLVER, OLDER_PRIMAL_SOLVERFields inherited from class GenericSolver
options -
Constructor Summary
ConstructorsConstructorDescriptionSimplexSolver(Optimisation.Options solverOptions, SimplexStore simplexStore) -
Method Summary
Modifier and TypeMethodDescription(package private) final SimplexSolverbasis(int[] basis) (package private) static <S extends SimplexStore>
Sbuild(ExpressionsBasedModel model, Function<LinearStructure, S> factory) (package private) final voiddoDualIterations(SimplexSolver.IterDescr iteration) (package private) final voiddoPrimalIterations(SimplexSolver.IterDescr iteration) (package private) static Optimisation.ResultdoSolveConvexAsDual(ConvexData<Double> convex, Optimisation.Options options, boolean zeroC) (package private) static Optimisation.ResultdoSolveConvexAsPrimal(ConvexData<Double> convex, Optimisation.Options options, boolean zeroC) private Access1D<?> (package private) final Optimisation.Resultprivate double[]private doublebooleanfixVariable(int index, double value) final Collection<Equation> generateCutCandidates(double fractionality, boolean... integer) private booleangetDualExitCandidate(SimplexSolver.IterDescr iteration) private doublegetLowerBound(int index) private double[]private booleangetPrimalEnterCandidate(SimplexSolver.IterDescr iteration) private doublegetUpperBound(int index) private double[](package private) final boolean(package private) final booleanprivate void(package private) final SimplexSolver.IterDescr(package private) abstract voidsetup(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 voidshift(int index, double shift, double weight) private doubleshift(int column, SimplexStore.ColumnState state) (package private) static intsizeOfDual(ConvexData<?> convex) (package private) static intsizeOfPrimal(ConvexData<?> convex) private Optimisation.Result(package private) voidprivate booleantestDualEnterRatio(SimplexSolver.IterDescr iteration) private booleantestPrimalExitRatio(SimplexSolver.IterDescr iteration) private voidupdate(SimplexSolver.IterDescr iteration) 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.private booleanprivate booleanMethods inherited from class LinearSolver
newBuilder, newBuilder, newGeneralBuilder, newGeneralBuilder, newSolver, newStandardBuilder, newStandardBuilder, solve, toObjectiveFunctionMethods inherited from class GenericSolver
countIterations, countTime, error, getClassSimpleName, getDuration, getState, incrementIterationsCount, isIterationAllowed, isLogDebug, isLogOff, isLogProgress, log, log, log, log, logProgress, printf, resetIterationsCount, setState, setValidator, validate, validateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Optimisation.Solver
dispose, solve, solveMethods inherited from interface 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) -
doSolveConvexAsDual
static Optimisation.Result doSolveConvexAsDual(ConvexData<Double> convex, Optimisation.Options options, boolean zeroC) -
doSolveConvexAsPrimal
static Optimisation.Result doSolveConvexAsPrimal(ConvexData<Double> convex, Optimisation.Options options, boolean zeroC) -
sizeOfDual
-
sizeOfPrimal
-
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: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
-
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
-
verifyDualFeasibility
private boolean verifyDualFeasibility() -
verifyPrimalFeasibility
private boolean verifyPrimalFeasibility() -
basis
-
doDualIterations
-
doPrimalIterations
-
extractResult
-
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()
-