Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SmtSolver.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
8
9#include <functional>
10#include <initializer_list>
11#include <set>
12#include <unordered_set>
13#include <vector>
14
15namespace storm {
16namespace solver {
17
21class SmtSolver {
22 public:
24 enum class CheckResult { Sat, Unsat, Unknown };
25
31 public:
38 virtual ~ModelReference() = default;
39
40 virtual bool getBooleanValue(storm::expressions::Variable const& variable) const = 0;
41 virtual int_fast64_t getIntegerValue(storm::expressions::Variable const& variable) const = 0;
42 virtual double getRationalValue(storm::expressions::Variable const& variable) const = 0;
43
50
51 virtual std::string toString() const = 0;
52
53 private:
54 // The expression manager responsible for the variables whose value can be requested via this model
55 // reference.
57 };
58
59 public:
68
72 virtual ~SmtSolver();
73
74 SmtSolver(SmtSolver const& other) = default;
75
76 SmtSolver(SmtSolver&& other) = default;
77 SmtSolver& operator=(SmtSolver const& other) = delete;
78 SmtSolver& operator=(SmtSolver&& other) = delete;
79
84 virtual void push() = 0;
85
90 virtual void pop() = 0;
91
97 virtual void pop(uint_fast64_t n);
98
102 virtual void reset() = 0;
103
109 virtual void add(storm::expressions::Expression const& assertion) = 0;
110
116 void add(std::set<storm::expressions::Expression> const& assertions);
117
123 void add(std::initializer_list<storm::expressions::Expression> const& assertions);
124
128 virtual void addNotCurrentModel(bool performSolverReset = true);
129
136 virtual CheckResult check() = 0;
137
147 virtual CheckResult checkWithAssumptions(std::set<storm::expressions::Expression> const& assumptions) = 0;
148
158 virtual CheckResult checkWithAssumptions(std::initializer_list<storm::expressions::Expression> const& assumptions) = 0;
159
170
180 virtual std::shared_ptr<ModelReference> getModel();
181
192 virtual std::vector<storm::expressions::SimpleValuation> allSat(std::vector<storm::expressions::Variable> const& important);
193
205 virtual uint_fast64_t allSat(std::vector<storm::expressions::Variable> const& important,
206 std::function<bool(storm::expressions::SimpleValuation&)> const& callback);
207
219 virtual uint_fast64_t allSat(std::vector<storm::expressions::Variable> const& important, std::function<bool(ModelReference&)> const& callback);
220
228 virtual std::vector<storm::expressions::Expression> getUnsatCore();
229
239 virtual std::vector<storm::expressions::Expression> getUnsatAssumptions();
240
250 virtual void setInterpolationGroup(uint_fast64_t group);
251
264 virtual storm::expressions::Expression getInterpolant(std::vector<uint_fast64_t> const& groupsA);
265
272
279
287 virtual bool setTimeout(uint_fast64_t milliseconds);
288
294 virtual bool unsetTimeout();
295
301 virtual std::string getSmtLibString() const;
302
303 private:
304 // The manager responsible for the expressions that interact with this solver.
306};
307} // namespace solver
308} // namespace storm
This class is responsible for managing a set of typed variables and all expressions using these varia...
A simple implementation of the valuation interface.
The base class for all model references.
Definition SmtSolver.h:30
ModelReference(storm::expressions::ExpressionManager const &manager)
Creates a model reference that uses the given expression manager.
Definition SmtSolver.cpp:9
virtual int_fast64_t getIntegerValue(storm::expressions::Variable const &variable) const =0
virtual std::string toString() const =0
virtual bool getBooleanValue(storm::expressions::Variable const &variable) const =0
storm::expressions::ExpressionManager const & getManager() const
Retrieves the expression manager associated with this model reference.
Definition SmtSolver.cpp:13
virtual double getRationalValue(storm::expressions::Variable const &variable) const =0
virtual storm::expressions::Expression getInterpolant(std::vector< uint_fast64_t > const &groupsA)
If the last call to check() returned Unsat, the solver has been instantiated with support for interpo...
Definition SmtSolver.cpp:75
virtual void pop()=0
Pops a backtracking point from the solver's stack.
virtual void reset()=0
Removes all assertions from the solver's stack.
virtual bool setTimeout(uint_fast64_t milliseconds)
If supported by the solver, this will limit all subsequent satisfiability queries to the given number...
Definition SmtSolver.cpp:87
SmtSolver & operator=(SmtSolver const &other)=delete
virtual std::vector< storm::expressions::Expression > getUnsatAssumptions()
If the last call to checkWithAssumptions() returned Unsat, this function can be used to retrieve a su...
Definition SmtSolver.cpp:67
virtual CheckResult checkWithAssumptions(std::initializer_list< storm::expressions::Expression > const &assumptions)=0
Checks whether the conjunction of assertions that are currently on the solver's stack together with t...
virtual void add(storm::expressions::Expression const &assertion)=0
Adds an assertion to the solver's stack.
virtual bool unsetTimeout()
If supported by the solver, this unsets a previous timeout.
Definition SmtSolver.cpp:91
SmtSolver & operator=(SmtSolver &&other)=delete
virtual storm::expressions::SimpleValuation getModelAsValuation()
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model tha...
Definition SmtSolver.cpp:43
storm::expressions::ExpressionManager const & getManager() const
Retrieves the expression manager associated with the solver.
Definition SmtSolver.cpp:79
virtual std::vector< storm::expressions::SimpleValuation > allSat(std::vector< storm::expressions::Variable > const &important)
Performs AllSat over the (provided) important atoms.
Definition SmtSolver.cpp:51
SmtSolver(storm::expressions::ExpressionManager &manager)
Constructs a new Smt solver with the given options.
Definition SmtSolver.cpp:17
virtual CheckResult check()=0
Checks whether the conjunction of assertions that are currently on the solver's stack is satisfiable.
virtual CheckResult checkWithAssumptions(std::set< storm::expressions::Expression > const &assumptions)=0
Checks whether the conjunction of assertions that are currently on the solver's stack together with t...
virtual ~SmtSolver()
Destructs the solver instance.
Definition SmtSolver.cpp:21
SmtSolver(SmtSolver const &other)=default
virtual void setInterpolationGroup(uint_fast64_t group)
Sets the current interpolation group.
Definition SmtSolver.cpp:71
virtual void push()=0
Pushes a backtracking point on the solver's stack.
SmtSolver(SmtSolver &&other)=default
virtual std::string getSmtLibString() const
If supported by the solver, this function returns the current assertions in the SMT-LIB format.
Definition SmtSolver.cpp:95
virtual std::vector< storm::expressions::Expression > getUnsatCore()
If the last call to check() returned Unsat, this function can be used to retrieve the unsatisfiable c...
Definition SmtSolver.cpp:63
virtual void addNotCurrentModel(bool performSolverReset=true)
If supported by the solver, this function tells the SMT solver to produce a model different from the ...
virtual std::shared_ptr< ModelReference > getModel()
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model tha...
Definition SmtSolver.cpp:47
CheckResult
possible check results
Definition SmtSolver.h:24