- java.lang.Object
-
- org.ojalgo.optimisation.convex.ConvexSolver.Configuration
-
- Enclosing class:
- ConvexSolver
public static final class ConvexSolver.Configuration extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private booleanmyCombinedScaleFactorprivate booleanmyExtendedPrecisionprivate NumberContextmyIterativeAccuracyprivate java.util.function.Supplier<Preconditioner>myIterativePreconditionerprivate java.util.function.Supplier<IterativeSolverTask>myIterativeSolverprivate doublemySmallDiagonalprivate java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>>mySolverGeneralprivate java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>>mySolverSPD
-
Constructor Summary
Constructors Constructor Description Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConvexSolver.ConfigurationcombinedScaleFactor(boolean combinedScaleFactor)Only relevant with extended precision.ConvexSolver.ConfigurationextendedPrecision(boolean extendedPrecision)With extended precision the usual solver is wrapped by a master algorithm, implemented inQuadrupleprecision, that iteratively refines (zoom and shift) the problem to be solved by the delegate solver.booleanisCombinedScaleFactor()booleanisExtendedPrecision()NumberContextiterative()Deprecated.Since v56 It's applied for you when callingnewIterativeSolver(int)ConvexSolver.Configurationiterative(java.util.function.Supplier<IterativeSolverTask> solver, java.util.function.Supplier<Preconditioner> preconditioner, NumberContext accuracy)ConvexSolver.Configurationiterative(java.util.function.Supplier<IterativeSolverTask> solver, NumberContext accuracy)Select which iterative linear system solver to use for the Schur-complement step in IterativeASS.ConvexSolver.Configurationiterative(NumberContext accuracy)The accuracy of the iterative Schur complement solver used inIterativeASS.IterativeSolverTasknewIterativeSolver(int maxIterations)Returns a new iterative solver instance configured with the current accuracy, maximum iterations, and preconditioner settings.MatrixDecomposition.Solver<java.lang.Double>newSolverGeneral(Structure2D structure)MatrixDecomposition.Solver<java.lang.Double>newSolverSPD(Structure2D structure)doublesmallDiagonal()ConvexSolver.ConfigurationsmallDiagonal(double factor)The [Q] matrix (of quadratic terms) is "inverted" using a matrix decomposition returned bynewSolverSPD(Structure2D).ConvexSolver.ConfigurationsolverGeneral(java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> factory)This matrix decomposition should be able to "invert" the full KKT systsem body matrix (which is symmetric) and/or its Schur complement with regards to the [Q] matrix (of quadratic terms).ConvexSolver.ConfigurationsolverSPD(java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> factory)The [Q] matrix (of quadratic terms) is supposed to be symmetric positive definite (or at least semidefinite), but in reality there are usually many deficiencies.
-
-
-
Field Detail
-
myCombinedScaleFactor
private boolean myCombinedScaleFactor
-
myExtendedPrecision
private boolean myExtendedPrecision
-
myIterativeAccuracy
private NumberContext myIterativeAccuracy
-
myIterativePreconditioner
private java.util.function.Supplier<Preconditioner> myIterativePreconditioner
-
myIterativeSolver
private java.util.function.Supplier<IterativeSolverTask> myIterativeSolver
-
mySmallDiagonal
private double mySmallDiagonal
-
mySolverGeneral
private java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> mySolverGeneral
-
mySolverSPD
private java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> mySolverSPD
-
-
Method Detail
-
combinedScaleFactor
public ConvexSolver.Configuration combinedScaleFactor(boolean combinedScaleFactor)
Only relevant with extended precision. With the extended precision solver the primal and dual variables are scaled (shift and zoom) to iteratively generate subproblems. In theory there are different scaling factors for the primal and dual variables, but forcing them to be the same enables simplifications resulting in significant performance gains.The default is to use the same scaling factor for both primal and dual variables. By setting this to false, you switch to a slower more complex, but theoretically more accurate and flexible algorithm.
- See Also:
extendedPrecision(boolean)
-
extendedPrecision
public ConvexSolver.Configuration extendedPrecision(boolean extendedPrecision)
With extended precision the usual solver is wrapped by a master algorithm, implemented inQuadrupleprecision, that iteratively refines (zoom and shift) the problem to be solved by the delegate solver. This enables to handle constraints with very high accuracy.The iterative refinement solver cannot handle general inequality constraints, only simple variable bounds (modelled as inequality constraints).
This is an experimental feature!
Setting this to true you should most likely also set the
Optimisation.Options.solutionto something matching that allows for higher precision.
-
isCombinedScaleFactor
public boolean isCombinedScaleFactor()
-
isExtendedPrecision
public boolean isExtendedPrecision()
-
iterative
@Deprecated public NumberContext iterative()
Deprecated.Since v56 It's applied for you when callingnewIterativeSolver(int)
-
iterative
public ConvexSolver.Configuration iterative(NumberContext accuracy)
The accuracy of the iterative Schur complement solver used inIterativeASS. This is the step that calculates the Lagrange multipliers (dual variables). The iterative solver used is aConjugateGradientSolver.
-
iterative
public ConvexSolver.Configuration iterative(java.util.function.Supplier<IterativeSolverTask> solver, NumberContext accuracy)
Select which iterative linear system solver to use for the Schur-complement step in IterativeASS. Default isConjugateGradientSolver. You may set e.g. newQMRSolver().
-
iterative
public ConvexSolver.Configuration iterative(java.util.function.Supplier<IterativeSolverTask> solver, java.util.function.Supplier<Preconditioner> preconditioner, NumberContext accuracy)
-
newIterativeSolver
public IterativeSolverTask newIterativeSolver(int maxIterations)
Returns a new iterative solver instance configured with the current accuracy, maximum iterations, and preconditioner settings.
-
newSolverGeneral
public MatrixDecomposition.Solver<java.lang.Double> newSolverGeneral(Structure2D structure)
-
newSolverSPD
public MatrixDecomposition.Solver<java.lang.Double> newSolverSPD(Structure2D structure)
-
smallDiagonal
public double smallDiagonal()
-
smallDiagonal
public ConvexSolver.Configuration smallDiagonal(double factor)
The [Q] matrix (of quadratic terms) is "inverted" using a matrix decomposition returned bynewSolverSPD(Structure2D). If, after decomposition,MatrixDecomposition.Solver.isSolvable()returns false a small constant is added to the diagonal.The small constant will be the largest absolute element times this small diagonal factor.
This is only meant to handle minor, unexpected, deficiencies.
-
solverGeneral
public ConvexSolver.Configuration solverGeneral(java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> factory)
This matrix decomposition should be able to "invert" the full KKT systsem body matrix (which is symmetric) and/or its Schur complement with regards to the [Q] matrix (of quadratic terms).
-
solverSPD
public ConvexSolver.Configuration solverSPD(java.util.function.Function<Structure2D,MatrixDecomposition.Solver<java.lang.Double>> factory)
The [Q] matrix (of quadratic terms) is supposed to be symmetric positive definite (or at least semidefinite), but in reality there are usually many deficiencies. This matrix decomposition should handle "inverting" the [Q] matrix.
-
-