Package org.ojalgo.optimisation.integer
Class IntegerSolver
- java.lang.Object
-
- org.ojalgo.optimisation.GenericSolver
-
- org.ojalgo.optimisation.integer.IntegerSolver
-
- All Implemented Interfaces:
Optimisation
,Optimisation.Solver
public final class IntegerSolver extends GenericSolver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IntegerSolver.ModelIntegration
(package private) static class
IntegerSolver.NodeStatistics
When a node is determined to be a leaf - no further branching - what was the reason?-
Nested classes/interfaces inherited from class org.ojalgo.optimisation.GenericSolver
GenericSolver.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 static IntegerSolver.ModelIntegration
INTEGRATION
private Optimisation.Result
myBestResultSoFar
private MultiviewSet<NodeKey>
myDeferredNodes
private MultiaryFunction.TwiceDifferentiable<java.lang.Double>
myFunction
private ExpressionsBasedModel
myIntegerModel
private boolean
myMinimisation
private IntegerSolver.NodeStatistics
myNodeStatistics
-
Fields inherited from class org.ojalgo.optimisation.GenericSolver
options
-
-
Constructor Summary
Constructors Constructor Description IntegerSolver(ExpressionsBasedModel model)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optimisation.Result
buildResult()
(package private) boolean
compute(NodeKey nodeKey, NodeSolver nodeSolver, CharacterRing.RingLogger nodePrinter, ModelStrategy strategy)
protected double
evaluateFunction(Access1D<?> solution)
protected MatrixStore<java.lang.Double>
extractSolution()
(package private) static void
flush(CharacterRing.RingLogger buffer, BasicLogger receiver)
protected Optimisation.Result
getBestEstimate()
protected Optimisation.Result
getBestResultSoFar()
(package private) int
identifyNonIntegerVariable(Optimisation.Result nodeResult, NodeKey nodeKey, ModelStrategy strategy)
Should return the index of the (best) integer variable to branch on.protected boolean
isIterationNecessary()
protected void
logProgress(int iterationsDone, java.lang.String classSimpleName, CalendarDateDuration duration)
static IntegerSolver
make(ExpressionsBasedModel model)
protected void
markInteger(NodeKey key, Optimisation.Result result, ModelStrategy strategy)
private CharacterRing.RingLogger
newPrinter()
static IntegerSolver
newSolver(ExpressionsBasedModel model)
Optimisation.Result
solve(Optimisation.Result kickStarter)
java.lang.String
toString()
protected boolean
validate()
Should validate the solver data/input/structue.-
Methods inherited from class org.ojalgo.optimisation.GenericSolver
countIterations, countTime, error, getClassSimpleName, getDuration, getState, incrementIterationsCount, isIterationAllowed, isLogDebug, isLogOff, isLogProgress, log, log, log, log, 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
dispose, solve
-
-
-
-
Field Detail
-
INTEGRATION
public static final IntegerSolver.ModelIntegration INTEGRATION
-
myBestResultSoFar
private volatile Optimisation.Result myBestResultSoFar
-
myDeferredNodes
private final MultiviewSet<NodeKey> myDeferredNodes
-
myFunction
private final MultiaryFunction.TwiceDifferentiable<java.lang.Double> myFunction
-
myIntegerModel
private final ExpressionsBasedModel myIntegerModel
-
myMinimisation
private final boolean myMinimisation
-
myNodeStatistics
private final IntegerSolver.NodeStatistics myNodeStatistics
-
-
Constructor Detail
-
IntegerSolver
IntegerSolver(ExpressionsBasedModel model)
-
-
Method Detail
-
make
public static IntegerSolver make(ExpressionsBasedModel model)
-
newSolver
public static IntegerSolver newSolver(ExpressionsBasedModel model)
-
flush
static void flush(CharacterRing.RingLogger buffer, BasicLogger receiver)
-
solve
public Optimisation.Result solve(Optimisation.Result kickStarter)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
newPrinter
private CharacterRing.RingLogger newPrinter()
-
buildResult
protected Optimisation.Result buildResult()
-
evaluateFunction
protected double evaluateFunction(Access1D<?> solution)
-
extractSolution
protected MatrixStore<java.lang.Double> extractSolution()
-
getBestEstimate
protected Optimisation.Result getBestEstimate()
-
getBestResultSoFar
protected Optimisation.Result getBestResultSoFar()
-
isIterationNecessary
protected boolean isIterationNecessary()
-
logProgress
protected void logProgress(int iterationsDone, java.lang.String classSimpleName, CalendarDateDuration duration)
- Overrides:
logProgress
in classGenericSolver
-
markInteger
protected void markInteger(NodeKey key, Optimisation.Result result, ModelStrategy strategy)
-
validate
protected boolean validate()
Should validate the solver data/input/structue. Even "expensive" validation can be performed as the method should only be called if Optimisation.Options.validate is set to true. In addition to returning true or false the implementation should set the state to either Optimisation.State.VALID or Optimisation.State.INVALID (or possibly Optimisation.State.FAILED). Typically the method should be called at the very beginning of the solve-method.- Returns:
- Is the solver instance valid?
-
compute
boolean compute(NodeKey nodeKey, NodeSolver nodeSolver, CharacterRing.RingLogger nodePrinter, ModelStrategy strategy)
-
identifyNonIntegerVariable
int identifyNonIntegerVariable(Optimisation.Result nodeResult, NodeKey nodeKey, ModelStrategy strategy)
Should return the index of the (best) integer variable to branch on. Returning a negative index means an integer solution has been found (no further branching). Does NOT return a global variable index - it's the index among the ineteger variable.
-
-