Package org.ojalgo.optimisation.convex
Class BasePrimitiveSolver
- java.lang.Object
-
- org.ojalgo.optimisation.GenericSolver
-
- org.ojalgo.optimisation.convex.ConvexSolver
-
- org.ojalgo.optimisation.convex.BasePrimitiveSolver
-
- All Implemented Interfaces:
Optimisation
,Optimisation.Solver
,UpdatableSolver
- Direct Known Subclasses:
ConstrainedSolver
,UnconstrainedSolver
abstract class BasePrimitiveSolver extends ConvexSolver implements UpdatableSolver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ojalgo.optimisation.convex.ConvexSolver
ConvexSolver.Builder, ConvexSolver.Configuration, ConvexSolver.ModelIntegration
-
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
Fields Modifier and Type Field Description (package private) static PhysicalStore.Factory<java.lang.Double,R064Store>
MATRIX_FACTORY
private ConvexData<java.lang.Double>
myMatrices
private boolean
myPatchedQ
private R064Store
mySolutionX
private MatrixDecomposition.Solver<java.lang.Double>
mySolverGeneral
private MatrixDecomposition.Solver<java.lang.Double>
mySolverQ
private boolean
myZeroQ
private static java.lang.String
Q_NOT_POSITIVE_SEMIDEFINITE
private static java.lang.String
Q_NOT_SYMMETRIC
-
Fields inherited from class org.ojalgo.optimisation.convex.ConvexSolver
INTEGRATION
-
Fields inherited from class org.ojalgo.optimisation.GenericSolver
options
-
-
Constructor Summary
Constructors Constructor Description BasePrimitiveSolver(ConvexData<java.lang.Double> convexData, Optimisation.Options optimisationOptions)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static ConvexSolver.Builder
builder(MatrixStore<java.lang.Double>[] matrices)
protected Optimisation.Result
buildResult()
protected boolean
computeGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> matrix)
protected int
countEqualityConstraints()
protected int
countInequalityConstraints()
protected int
countVariables()
void
dispose()
Cleanup when a solver instance is no longer needed.protected double
evaluateFunction(Access1D<?> solution)
protected MatrixStore<java.lang.Double>
extractSolution()
ConvexData<java.lang.Double>
getEntityMap()
protected abstract Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>>
getIterationKKT()
protected abstract Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>>
getIterationRHS()
protected MatrixStore<java.lang.Double>
getMatrixAE()
protected SparseArray<java.lang.Double>
getMatrixAE(int row)
protected RowsSupplier<java.lang.Double>
getMatrixAE(int[] rows)
protected MatrixStore<java.lang.Double>
getMatrixAI()
protected SparseArray<java.lang.Double>
getMatrixAI(int row)
protected RowsSupplier<java.lang.Double>
getMatrixAI(int[] rows)
protected MatrixStore<java.lang.Double>
getMatrixBE()
protected MatrixStore<java.lang.Double>
getMatrixBI()
protected double
getMatrixBI(int row)
protected MatrixStore<java.lang.Double>
getMatrixBI(int[] selector)
protected MatrixStore<java.lang.Double>
getMatrixC()
protected PhysicalStore<java.lang.Double>
getMatrixQ()
protected int
getRankGeneral()
protected MatrixStore<java.lang.Double>
getSolutionGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs)
protected MatrixStore<java.lang.Double>
getSolutionGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs, PhysicalStore<java.lang.Double> preallocated)
protected MatrixStore<java.lang.Double>
getSolutionQ(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs)
protected MatrixStore<java.lang.Double>
getSolutionQ(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs, PhysicalStore<java.lang.Double> preallocated)
protected PhysicalStore<java.lang.Double>
getSolutionX()
Solution / Variables: [X]protected boolean
hasEqualityConstraints()
protected boolean
hasInequalityConstraints()
protected boolean
initialise(Optimisation.Result kickStarter)
protected boolean
isIteratingPossible()
(package private) boolean
isPatchedQ()
protected boolean
isSolvableGeneral()
protected boolean
isSolvableQ()
(package private) boolean
isZeroQ()
protected abstract boolean
needsAnotherIteration()
(package private) static BasePrimitiveSolver
newSolver(ConvexData<java.lang.Double> data, Optimisation.Options options)
(package private) static ConvexSolver
of(MatrixStore<java.lang.Double>[] matrices)
protected abstract void
performIteration()
Optimisation.Result
solve(Optimisation.Result kickStarter)
protected boolean
solveFullKKT(PhysicalStore<java.lang.Double> preallocated)
protected Optimisation.Result
solveLP()
The LP result with aOptimisation.State
suitable for this solver – most likelyOptimisation.State.FEASIBLE
.(package private) static ConvexObjectiveFunction<java.lang.Double>
toObjectiveFunction(MatrixStore<?> mtrxQ, MatrixStore<?> mtrxC)
java.lang.String
toString()
-
Methods inherited from class org.ojalgo.optimisation.convex.ConvexSolver
copy, newBuilder, newBuilder, newBuilder, newSolver
-
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, wait, wait, wait
-
Methods inherited from interface org.ojalgo.optimisation.Optimisation.Solver
solve
-
Methods inherited from interface org.ojalgo.optimisation.UpdatableSolver
fixVariable, generateCutCandidates, integers, isMapped, updateRange
-
-
-
-
Field Detail
-
Q_NOT_POSITIVE_SEMIDEFINITE
private static final java.lang.String Q_NOT_POSITIVE_SEMIDEFINITE
- See Also:
- Constant Field Values
-
Q_NOT_SYMMETRIC
private static final java.lang.String Q_NOT_SYMMETRIC
- See Also:
- Constant Field Values
-
MATRIX_FACTORY
static final PhysicalStore.Factory<java.lang.Double,R064Store> MATRIX_FACTORY
-
myMatrices
private final ConvexData<java.lang.Double> myMatrices
-
myPatchedQ
private boolean myPatchedQ
-
mySolutionX
private final R064Store mySolutionX
-
mySolverGeneral
private final MatrixDecomposition.Solver<java.lang.Double> mySolverGeneral
-
mySolverQ
private final MatrixDecomposition.Solver<java.lang.Double> mySolverQ
-
myZeroQ
private boolean myZeroQ
-
-
Constructor Detail
-
BasePrimitiveSolver
BasePrimitiveSolver(ConvexData<java.lang.Double> convexData, Optimisation.Options optimisationOptions)
-
-
Method Detail
-
builder
static ConvexSolver.Builder builder(MatrixStore<java.lang.Double>[] matrices)
-
newSolver
static BasePrimitiveSolver newSolver(ConvexData<java.lang.Double> data, Optimisation.Options options)
-
of
static ConvexSolver of(MatrixStore<java.lang.Double>[] matrices)
-
toObjectiveFunction
static ConvexObjectiveFunction<java.lang.Double> toObjectiveFunction(MatrixStore<?> mtrxQ, MatrixStore<?> mtrxC)
-
dispose
public void dispose()
Description copied from interface:Optimisation.Solver
Cleanup when a solver instance is no longer needed.- Specified by:
dispose
in interfaceOptimisation.Solver
-
getEntityMap
public ConvexData<java.lang.Double> getEntityMap()
- Specified by:
getEntityMap
in interfaceUpdatableSolver
-
solve
public Optimisation.Result solve(Optimisation.Result kickStarter)
- Specified by:
solve
in interfaceOptimisation.Solver
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
buildResult
protected Optimisation.Result buildResult()
-
computeGeneral
protected boolean computeGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> matrix)
-
countEqualityConstraints
protected int countEqualityConstraints()
-
countInequalityConstraints
protected int countInequalityConstraints()
-
countVariables
protected int countVariables()
-
evaluateFunction
protected double evaluateFunction(Access1D<?> solution)
-
extractSolution
protected MatrixStore<java.lang.Double> extractSolution()
-
getIterationKKT
protected abstract Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> getIterationKKT()
-
getIterationRHS
protected abstract Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> getIterationRHS()
-
getMatrixAE
protected MatrixStore<java.lang.Double> getMatrixAE()
-
getMatrixAE
protected SparseArray<java.lang.Double> getMatrixAE(int row)
-
getMatrixAE
protected RowsSupplier<java.lang.Double> getMatrixAE(int[] rows)
-
getMatrixAI
protected MatrixStore<java.lang.Double> getMatrixAI()
-
getMatrixAI
protected SparseArray<java.lang.Double> getMatrixAI(int row)
-
getMatrixAI
protected RowsSupplier<java.lang.Double> getMatrixAI(int[] rows)
-
getMatrixBE
protected MatrixStore<java.lang.Double> getMatrixBE()
-
getMatrixBI
protected MatrixStore<java.lang.Double> getMatrixBI()
-
getMatrixBI
protected double getMatrixBI(int row)
-
getMatrixBI
protected MatrixStore<java.lang.Double> getMatrixBI(int[] selector)
-
getMatrixC
protected MatrixStore<java.lang.Double> getMatrixC()
-
getMatrixQ
protected PhysicalStore<java.lang.Double> getMatrixQ()
-
getRankGeneral
protected int getRankGeneral()
-
getSolutionGeneral
protected MatrixStore<java.lang.Double> getSolutionGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs)
-
getSolutionGeneral
protected MatrixStore<java.lang.Double> getSolutionGeneral(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs, PhysicalStore<java.lang.Double> preallocated)
-
getSolutionQ
protected MatrixStore<java.lang.Double> getSolutionQ(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs)
-
getSolutionQ
protected MatrixStore<java.lang.Double> getSolutionQ(Access2D.Collectable<java.lang.Double,? super PhysicalStore<java.lang.Double>> rhs, PhysicalStore<java.lang.Double> preallocated)
-
getSolutionX
protected PhysicalStore<java.lang.Double> getSolutionX()
Solution / Variables: [X]
-
hasEqualityConstraints
protected boolean hasEqualityConstraints()
-
hasInequalityConstraints
protected boolean hasInequalityConstraints()
-
initialise
protected boolean initialise(Optimisation.Result kickStarter)
- Returns:
- true/false if the main algorithm may start or not
-
isIteratingPossible
protected boolean isIteratingPossible()
-
isSolvableGeneral
protected boolean isSolvableGeneral()
-
isSolvableQ
protected boolean isSolvableQ()
-
needsAnotherIteration
protected abstract boolean needsAnotherIteration()
-
performIteration
protected abstract void performIteration()
-
solveFullKKT
protected boolean solveFullKKT(PhysicalStore<java.lang.Double> preallocated)
-
solveLP
protected Optimisation.Result solveLP()
The LP result with aOptimisation.State
suitable for this solver – most likelyOptimisation.State.FEASIBLE
. IF the LP was solved to optimality but the Q matrix (or the entire objective function) was disregarded then the returned state will just beOptimisation.State.FEASIBLE
.
-
isPatchedQ
boolean isPatchedQ()
-
isZeroQ
boolean isZeroQ()
-
-