Interface Model
-
- All Superinterfaces:
AutoCloseable,Iterable<Model.ValueAssignment>
- All Known Implementing Classes:
AbstractModel,AbstractModel.CachingAbstractModel
public interface Model extends Iterable<Model.ValueAssignment>, AutoCloseable
A model returned from the satisfiable solver environment.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classModel.ValueAssignment
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ImmutableList<Model.ValueAssignment>asList()Build a list of assignments that stays valid after closing the model.voidclose()Free resources associated with this model (existingModel.ValueAssignmentinstances 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 f)Type-safe evaluation for bitvector formulas.@Nullable Booleanevaluate(BooleanFormula f)Type-safe evaluation for boolean formulas.@Nullable Objectevaluate(Formula f)Evaluate a given formula substituting the values from the model.@Nullable BigIntegerevaluate(NumeralFormula.IntegerFormula f)Type-safe evaluation for integer formulas.@Nullable Rationalevaluate(NumeralFormula.RationalFormula f)Type-safe evaluation for rational formulas.default Iterator<Model.ValueAssignment>iterator()Iterate over all values present in the model.StringtoString()Pretty-printing of the model values.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
eval
<T extends Formula> @Nullable T eval(T formula)
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
@Nullable Object evaluate(Formula f)
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:
f- Input formula- Returns:
- Either of: - Number (Rational/Double/BigInteger/Long/Integer) - Boolean
- Throws:
IllegalArgumentException- if a formula has unexpected type, e.g. Array.
-
evaluate
@Nullable BigInteger evaluate(NumeralFormula.IntegerFormula f)
Type-safe evaluation for integer formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
@Nullable Rational evaluate(NumeralFormula.RationalFormula f)
Type-safe evaluation for rational formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
@Nullable Boolean evaluate(BooleanFormula f)
Type-safe evaluation for boolean formulas.The formula does not need to be a variable, we also allow complex expression.
-
evaluate
@Nullable BigInteger evaluate(BitvectorFormula f)
Type-safe evaluation for bitvector formulas.The formula does not need to be a variable, we also allow complex expression.
-
iterator
default Iterator<Model.ValueAssignment> iterator()
Iterate over all values present in the model. Note that iterating multiple times may be inefficient for some solvers, it is recommended to useBasicProverEnvironment.getModelAssignments()instead in this case.- Specified by:
iteratorin interfaceIterable<Model.ValueAssignment>
-
asList
ImmutableList<Model.ValueAssignment> asList()
Build a list of assignments that stays valid after closing the model.
-
close
void close()
Free resources associated with this model (existingModel.ValueAssignmentinstances stay valid, butevaluate(Formula)etc. anditerator()must not be called again).- Specified by:
closein interfaceAutoCloseable
-
-