- 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_FACTORYprivate ConvexData<java.lang.Double>myMatricesprivate booleanmyPatchedQprivate R064StoremySolutionXprivate MatrixDecomposition.Solver<java.lang.Double>mySolverGeneralprivate MatrixDecomposition.Solver<java.lang.Double>mySolverQprivate booleanmyZeroQprivate static java.lang.StringQ_NOT_POSITIVE_SEMIDEFINITEprivate static java.lang.StringQ_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.Builderbuilder(MatrixStore<java.lang.Double>[] matrices)protected Optimisation.ResultbuildResult()protected booleancomputeGeneral(Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>> matrix)protected intcountEqualityConstraints()protected intcountInequalityConstraints()protected intcountVariables()voiddispose()Cleanup when a solver instance is no longer needed.protected doubleevaluateFunction(Access1D<?> solution)protected MatrixStore<java.lang.Double>extractSolution()ConvexData<java.lang.Double>getEntityMap()protected abstract Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>>getIterationKKT()protected abstract Access2D.Collectable<java.lang.Double,? super TransformableRegion<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 doublegetMatrixBI(int row)protected MatrixStore<java.lang.Double>getMatrixBI(int[] selector)protected MatrixStore<java.lang.Double>getMatrixC()protected PhysicalStore<java.lang.Double>getMatrixQ()protected intgetRankGeneral()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 booleanhasEqualityConstraints()protected booleanhasInequalityConstraints()protected booleaninitialise(Optimisation.Result kickStarter)protected booleanisIteratingPossible()(package private) booleanisPatchedQ()protected booleanisSolvableGeneral()protected booleanisSolvableQ()(package private) booleanisZeroQ()protected abstract booleanneedsAnotherIteration()(package private) static BasePrimitiveSolvernewSolver(ConvexData<java.lang.Double> data, Optimisation.Options options)(package private) static ConvexSolverof(MatrixStore<java.lang.Double>[] matrices)protected abstract voidperformIteration()Optimisation.Resultsolve(Optimisation.Result kickStarter)protected booleansolveFullKKT(PhysicalStore<java.lang.Double> preallocated)protected Optimisation.ResultsolveLP()The LP result with aOptimisation.Statesuitable for this solver – most likelyOptimisation.State.FEASIBLE.(package private) static ConvexObjectiveFunction<java.lang.Double>toObjectiveFunction(MatrixStore<?> mtrxQ, MatrixStore<?> mtrxC)java.lang.StringtoString()(package private) voidupdate(Access1D<?> mtrxC, Access1D<?> mtrxBE, Access1D<?> mtrxBI)Specifically for use byIterativeRefinementSolver2-
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.SolverCleanup when a solver instance is no longer needed.- Specified by:
disposein interfaceOptimisation.Solver
-
getEntityMap
public ConvexData<java.lang.Double> getEntityMap()
- Specified by:
getEntityMapin interfaceUpdatableSolver
-
solve
public Optimisation.Result solve(Optimisation.Result kickStarter)
- Specified by:
solvein interfaceOptimisation.Solver
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
buildResult
protected Optimisation.Result buildResult()
-
computeGeneral
protected boolean computeGeneral(Access2D.Collectable<java.lang.Double,? super TransformableRegion<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 TransformableRegion<java.lang.Double>> getIterationKKT()
-
getIterationRHS
protected abstract Access2D.Collectable<java.lang.Double,? super TransformableRegion<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.Statesuitable 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()
-
update
void update(Access1D<?> mtrxC, Access1D<?> mtrxBE, Access1D<?> mtrxBI)
Specifically for use byIterativeRefinementSolver2
-
-