Interface Evaluator
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
Model
- All Known Implementing Classes:
AbstractEvaluator,AbstractModel,CachingModel,DebuggingModel
This class can be (but does not need to be!) a cheaper and more light-weight version of a
Model and it misses several features compared to a full Model:
- no listing of model assignments, i.e., the user needs to query each formula on its own,
- no guaranteed availability after applying any operation on the original prover stack, i.e., the evaluation is only available directly after querying the solver with a satisfiable environment.
If any of these features is required, please use the complete Model.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free resources associated with this evaluator (existingFormulainstances stay valid, butevaluate(Formula)etc.<T extends Formula>
@Nullable Teval(T formula) Evaluate a given formula substituting the values from the model and return it as formula.@Nullable BigIntegerevaluate(BitvectorFormula formula) Type-safe evaluation for bitvector formulas.@Nullable Booleanevaluate(BooleanFormula formula) Type-safe evaluation for boolean formulas.@Nullable Stringevaluate(EnumerationFormula formula) Type-safe evaluation for enumeration formulas.@Nullable FloatingPointNumberevaluate(FloatingPointFormula formula) Type-safe evaluation for floating-point formulas.@Nullable ObjectEvaluate a given formula substituting the values from the model.@Nullable BigIntegerevaluate(NumeralFormula.IntegerFormula formula) Type-safe evaluation for integer formulas.@Nullable Rationalevaluate(NumeralFormula.RationalFormula formula) Type-safe evaluation for rational formulas.@Nullable Stringevaluate(StringFormula formula) Type-safe evaluation for string formulas.
-
Method Details
-
eval
Evaluate a given formula substituting the values from the model and return it as formula.If a value is not relevant to the satisfiability result, the solver can choose either to insert an arbitrary value (e.g., the value
0for the matching type) or just returnnull.The formula does not need to be a variable, we also allow complex expression. The solver will replace all symbols from the formula with their model values and then simplify the formula into a simple formula, e.g., consisting only of a numeral expression.
- Parameters:
formula- Input formula to be evaluated.- Returns:
- evaluation of the given formula or
nullif the solver does not provide a better evaluation.
-
evaluate
Evaluate a given formula substituting the values from the model.If a value is not relevant to the satisfiability result, the model can choose either an arbitrary value (e.g., the value
0for the matching type) or just returnnull.The formula does not need to be a variable, we also allow complex expression.
- Parameters:
formula- Input formula- Returns:
- Either of: - Number (Rational/Double/BigInteger/Long/Integer) - Boolean
- Throws:
IllegalArgumentException- if a formula has unexpected type, e.g. Array.
-
evaluate
Type-safe evaluation for integer formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for rational formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for boolean formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for bitvector formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for string formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for enumeration formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Type-safe evaluation for floating-point formulas.The formula does not need to be a variable, we also allow complex expression.
-
close
void close()Free resources associated with this evaluator (existingFormulainstances stay valid, butevaluate(Formula)etc. must not be called again).- Specified by:
closein interfaceAutoCloseable
-