Class ExpressionsBasedModel.Integration<S extends Optimisation.Solver>
java.lang.Object
org.ojalgo.optimisation.ExpressionsBasedModel.Integration<S>
- All Implemented Interfaces:
Optimisation, Optimisation.Integration<ExpressionsBasedModel, S>
- Direct Known Subclasses:
ConfiguredIntegration, ConvexSolver.ModelIntegration, ExpressionsBasedModel.IntegrationWrapper, GomorySolver.ModelIntegration, IntegerSolver.ModelIntegration, LinearSolver.ModelIntegration, LinearSolver.NewIntegration, LinearSolver.OldIntegration, ServiceIntegration
- Enclosing class:
ExpressionsBasedModel
public abstract static class ExpressionsBasedModel.Integration<S extends Optimisation.Solver>
extends Object
implements Optimisation.Integration<ExpressionsBasedModel, S>
Optimisation.Solver:s that should be usabale from ExpressionsBasedModel needs to
implement a subclass of this.-
Nested Class Summary
Nested classes/interfaces inherited from interface Optimisation
Optimisation.Constraint, Optimisation.ConstraintType, Optimisation.Integration<M,S>, Optimisation.Model, Optimisation.Objective, Optimisation.Options, Optimisation.ProblemStructure, Optimisation.Result, Optimisation.Sense, Optimisation.Solver, Optimisation.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Optimisation.ResultexpandFreeToFull(Optimisation.Result solverState, ExpressionsBasedModel model, DenseArray.Factory<?, ?> factory) final Optimisation.ResultExtract state from the model and convert it to solver state.protected intgetIndexInSolver(ExpressionsBasedModel model, Variable variable) protected final booleanisSwitch(ExpressionsBasedModel model, ExpressionsBasedModel.IntegrationProperty property) protected final ExpressionsBasedModel.Validatorprotected static Optimisation.ResultreduceFullToFree(Optimisation.Result modelState, ExpressionsBasedModel model, DenseArray.Factory<?, ?> factory) protected final voidsetSwitch(ExpressionsBasedModel model, ExpressionsBasedModel.IntegrationProperty property, boolean value) toModelState(Optimisation.Result solverState, ExpressionsBasedModel model) The reverse oftoSolverState(Optimisation.Result, ExpressionsBasedModel).toSolverState(Optimisation.Result modelState, ExpressionsBasedModel model) This default implementation assumes the solver state and model state are identical, and simply returns the supplied model state.withCapabilityPredicate(Predicate<ExpressionsBasedModel> capabilityPredicate) Use this to limit the cases where thisOptimisation.Integrationwould be used.withOptionsModifier(Consumer<Optimisation.Options> optionsModifier) Intercept and modify theOptimisation.Optionsinstance before building the solver.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Optimisation.Integration
build, isCapable
-
Constructor Details
-
Integration
public Integration()
-
-
Method Details
-
expandFreeToFull
protected static Optimisation.Result expandFreeToFull(Optimisation.Result solverState, ExpressionsBasedModel model, DenseArray.Factory<?, ?> factory) -
reduceFullToFree
protected static Optimisation.Result reduceFullToFree(Optimisation.Result modelState, ExpressionsBasedModel model, DenseArray.Factory<?, ?> factory) -
extractSolverState
Description copied from interface:Optimisation.IntegrationExtract state from the model and convert it to solver state.- Specified by:
extractSolverStatein interfaceOptimisation.Integration<ExpressionsBasedModel, S extends Optimisation.Solver>- See Also:
-
toModelState
public Optimisation.Result toModelState(Optimisation.Result solverState, ExpressionsBasedModel model) The reverse oftoSolverState(Optimisation.Result, ExpressionsBasedModel).- Specified by:
toModelStatein interfaceOptimisation.Integration<ExpressionsBasedModel, S extends Optimisation.Solver>- See Also:
-
toSolverState
public Optimisation.Result toSolverState(Optimisation.Result modelState, ExpressionsBasedModel model) This default implementation assumes the solver state and model state are identical, and simply returns the supplied model state.In any case where the set of variables present in the solver does not match what's in the model one-to-one, this method and its reciprocal
toModelState(Optimisation.Result, ExpressionsBasedModel)needs to be overridden with custom mapping implementations.A very common case is when the solver only works with free (not eliminated by the pre-solver) variables. There are helper methods to do just that.
- Specified by:
toSolverStatein interfaceOptimisation.Integration<ExpressionsBasedModel, S extends Optimisation.Solver>- See Also:
-
withCapabilityPredicate
public final ExpressionsBasedModel.Integration<S> withCapabilityPredicate(Predicate<ExpressionsBasedModel> capabilityPredicate) Use this to limit the cases where thisOptimisation.Integrationwould be used.Returns a new Integration instance where the supplied
Predicateneeds to test true in addition to the underlyingOptimisation.Integration.isCapable(Optimisation.Model). -
withOptionsModifier
public final ExpressionsBasedModel.Integration<S> withOptionsModifier(Consumer<Optimisation.Options> optionsModifier) Intercept and modify theOptimisation.Optionsinstance before building the solver. -
getIndexInSolver
- Returns:
- The index with which one can reference parameters related to this variable in the solver.
-
isSwitch
protected final boolean isSwitch(ExpressionsBasedModel model, ExpressionsBasedModel.IntegrationProperty property) -
newValidator
-
setSwitch
protected final void setSwitch(ExpressionsBasedModel model, ExpressionsBasedModel.IntegrationProperty property, boolean value)
-