Class CachingModel
- All Implemented Interfaces:
AutoCloseable,Iterable<Model.ValueAssignment>,Evaluator,Model
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sosy_lab.java_smt.api.Model
Model.ValueAssignment -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList()Returns a list of model assignments that remains valid after the model is closed (viaModel.close()).voidclose()Free resources associated with this model (existingModel.ValueAssignmentinstances stay valid, butEvaluator.evaluate(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.toString()Pretty-printing of the model values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CachingModel
-
-
Method Details
-
asList
Description copied from interface:ModelReturns a list of model assignments that remains valid after the model is closed (viaModel.close()).The returned
ImmutableListcontains the sameModel.ValueAssignmentelements thatModel.iterator()would provide, but it is a materialized copy such that the list and its elements can still be accessed safely after the model has been closed. Methods that rely on live solver state such asModel.iterator()orEvaluator.evaluate(Formula)should not be used afterModel.close(), whereas the returned list can always be used, until the underlying solver context is closed (SolverContext.close()).This representation is primarily intended for model inspection and debugging. For precise evaluation of individual formulas prefer targeted calls to
Evaluator.evaluate(Formula). -
close
public void close()Description copied from interface:ModelFree resources associated with this model (existingModel.ValueAssignmentinstances stay valid, butEvaluator.evaluate(Formula)etc. andModel.iterator()must not be called again).For several solvers (such as MATHSAT5, SMTInterpol, Z3) the model remains valid even after changes to the prover environment from which it was obtained. For other solvers (CVC4, CVC5, Princess, Boolector, Bitwuzla) the model becomes invalid after any change to the prover environment.
-
eval
Description copied from interface:EvaluatorEvaluate 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.
-
evaluate
Description copied from interface:EvaluatorEvaluate 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.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for integer formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for rational formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for boolean formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for bitvector formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for string formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for enumeration formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
Description copied from interface:EvaluatorType-safe evaluation for floating-point formulas.The formula does not need to be a variable, we also allow complex expression.
-
toString
Description copied from interface:ModelPretty-printing of the model values.Please use this method only for debugging and not for retrieving relevant information about the model. The returned model representation is not intended for further usage like parsing, because we do not guarantee any specific format, e.g., for arrays and uninterpreted functions, and we allow the SMT solver to include arbitrary additional information about the current solver state, e.g., any available symbol in the solver, even from other provers, and temporary internal symbols.
-