Interface OptimizationProverEnvironment
-
- All Superinterfaces:
AutoCloseable,BasicProverEnvironment<Void>
public interface OptimizationProverEnvironment extends BasicProverEnvironment<Void>, AutoCloseable
Interface for optimization modulo SMT.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classOptimizationProverEnvironment.OptStatusStatus of the optimization problem.-
Nested classes/interfaces inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
BasicProverEnvironment.AllSatCallback<R>
-
-
Field Summary
-
Fields inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
NO_MODEL_HELP
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OptimizationProverEnvironment.OptStatuscheck()Optimize the objective function subject to the previously imposed constraints.ModelgetModel()Get a satisfying assignment.Optional<Rational>lower(int handle, Rational epsilon)intmaximize(Formula objective)Add the maximizationobjective.intminimize(Formula objective)Add minimizationobjective.Optional<Rational>upper(int handle, Rational epsilon)-
Methods inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
addConstraint, allSat, close, getModelAssignments, getUnsatCore, isUnsat, isUnsatWithAssumptions, pop, push, push, unsatCoreOverAssumptions
-
-
-
-
Method Detail
-
maximize
int maximize(Formula objective)
Add the maximizationobjective.Note:
push/popmay be used for switching objectives- Returns:
- Objective handle, to be used for retrieving the value.
-
minimize
int minimize(Formula objective)
Add minimizationobjective.Note:
push/popmay be used for switching objectives- Returns:
- Objective handle, to be used for retrieving the value.
-
check
OptimizationProverEnvironment.OptStatus check() throws InterruptedException, SolverException
Optimize the objective function subject to the previously imposed constraints.- Returns:
- Status of the optimization problem.
- Throws:
InterruptedExceptionSolverException
-
upper
Optional<Rational> upper(int handle, Rational epsilon)
- Parameters:
epsilon- Value to substitute for theepsilon.- Returns:
- Upper approximation of the optimized value, or absent optional if the objective is unbounded.
-
lower
Optional<Rational> lower(int handle, Rational epsilon)
- Parameters:
epsilon- Value to substitute for theepsilon.- Returns:
- Lower approximation of the optimized value, or absent optional if the objective is unbounded.
-
getModel
Model getModel() throws SolverException
Get a satisfying assignment. This should be called only immediately after anBasicProverEnvironment.isUnsat()call that returnedfalse. A model might contain additional symbols with their evaluation, if a solver uses its own temporary symbols. There should be at least a value-assignment for each free symbol.Please note that the prover is allowed to use standard numbers for any real variable in the model after a sat-query returned
OptimizationProverEnvironment.OptStatus.OPT. For integer formulas, we expect the optimal assignment.Example 1: For the constraint 'x<10' with a real x, the upper bound of x is '10-epsilon' (epsilon can even be set to zero). The model can return the assignment x=9. To get an optimal assignment, query the solver with an additional constraint 'x == 10-epsilon'.
Example 2: For the constraint 'x<10' with an integer x, the upper bound of x is '9' (epsilon is irrelevant here and can be zero). The model returns the optimal assignment x=9.
- Specified by:
getModelin interfaceBasicProverEnvironment<Void>- Throws:
SolverException
-
-