- java.lang.Object
-
- org.ojalgo.optimisation.GenericSolver
-
- All Implemented Interfaces:
Optimisation,Optimisation.Solver
- Direct Known Subclasses:
ConvexSolver,GomorySolver,IntegerSolver,LinearSolver
public abstract class GenericSolver extends java.lang.Object implements Optimisation.Solver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGenericSolver.Builder<B extends GenericSolver.Builder<B,S>,S extends GenericSolver>-
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 private java.lang.StringmyClassSimpleNameprivate java.util.concurrent.atomic.AtomicIntegermyIterationsCountprivate Optimisation.StatemyStateprivate StopwatchmyStopwatchprivate ExpressionsBasedModel.ValidatormyValidatorOptimisation.Optionsoptions
-
Constructor Summary
Constructors Modifier Constructor Description privateGenericSolver()protectedGenericSolver(Optimisation.Options optimisationOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcountIterations()protected longcountTime()The number of ms since solver instantiated or iterations count reset.protected voiderror(java.lang.String messagePattern, java.lang.Object... arguments)protected java.lang.StringgetClassSimpleName()protected CalendarDateDurationgetDuration()The number of s since solver instantiated or iterations count reset.protected Optimisation.StategetState()protected intincrementIterationsCount()Should be called after a completed iteration.protected booleanisIterationAllowed()Should be called at the start of an iteration (before it actually starts) to check if you should abort instead.protected booleanisLogDebug()Detailed debug loggingprotected booleanisLogOff()No loggingprotected booleanisLogProgress()Cursory progress logging (at least)protected voidlog()protected voidlog(int tabs, java.lang.String messagePattern, java.lang.Object... arguments)protected voidlog(java.lang.String messagePattern, java.lang.Object... arguments)protected voidlog(java.lang.String descripttion, Access2D<?> matrix)protected voidlogProgress(int iterationsDone, java.lang.String classSimpleName, CalendarDateDuration duration)protected voidresetIterationsCount()protected voidsetState(Optimisation.State state)As the solver algorithm reaches various states it should be recorded here.protected voidsetValidator(ExpressionsBasedModel.Validator validator)Optionally set a validator.protected booleanvalidate(ExpressionsBasedModel modifiedModel)protected booleanvalidate(Access1D<?> solverSolution)-
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
-
-
-
-
Field Detail
-
options
public final Optimisation.Options options
-
myClassSimpleName
private transient java.lang.String myClassSimpleName
-
myIterationsCount
private final java.util.concurrent.atomic.AtomicInteger myIterationsCount
-
myState
private Optimisation.State myState
-
myStopwatch
private final Stopwatch myStopwatch
-
myValidator
private ExpressionsBasedModel.Validator myValidator
-
-
Constructor Detail
-
GenericSolver
private GenericSolver()
-
GenericSolver
protected GenericSolver(Optimisation.Options optimisationOptions)
-
-
Method Detail
-
countIterations
protected final int countIterations()
-
countTime
protected final long countTime()
The number of ms since solver instantiated or iterations count reset.
-
error
protected final void error(java.lang.String messagePattern, java.lang.Object... arguments)
-
getClassSimpleName
protected final java.lang.String getClassSimpleName()
-
getDuration
protected final CalendarDateDuration getDuration()
The number of s since solver instantiated or iterations count reset.
-
getState
protected Optimisation.State getState()
-
incrementIterationsCount
protected final int incrementIterationsCount()
Should be called after a completed iteration. The iterations count is not "1" untill the first iteration is completed.
-
isIterationAllowed
protected final boolean isIterationAllowed()
Should be called at the start of an iteration (before it actually starts) to check if you should abort instead. Will return false if either the iterations count or the execution time has reached their respective limits.
-
isLogDebug
protected final boolean isLogDebug()
Detailed debug logging
-
isLogOff
protected final boolean isLogOff()
No logging
-
isLogProgress
protected final boolean isLogProgress()
Cursory progress logging (at least)
-
log
protected final void log()
-
log
protected final void log(int tabs, java.lang.String messagePattern, java.lang.Object... arguments)
-
log
protected final void log(java.lang.String descripttion, Access2D<?> matrix)
-
log
protected final void log(java.lang.String messagePattern, java.lang.Object... arguments)
-
logProgress
protected void logProgress(int iterationsDone, java.lang.String classSimpleName, CalendarDateDuration duration)
-
resetIterationsCount
protected final void resetIterationsCount()
-
setState
protected final void setState(Optimisation.State state)
As the solver algorithm reaches various states it should be recorded here. It's particularly important to record when a feasible solution has been reached.
-
setValidator
protected final void setValidator(ExpressionsBasedModel.Validator validator)
Optionally set a validator. If set, solvers may callvalidate(Access1D)orvalidate(ExpressionsBasedModel)at suitable points in the code to validate its actions. This is a solver debugging tool - not to be used in production code.
-
validate
protected final boolean validate(Access1D<?> solverSolution)
-
validate
protected final boolean validate(ExpressionsBasedModel modifiedModel)
-
-