Browse Source

implemented SMT-Lib export SmtSolver interface

tempestpy_adaptions
TimQu 7 years ago
parent
commit
b44870dc09
  1. 5
      src/storm/solver/SmtSolver.cpp
  2. 14
      src/storm/solver/SmtSolver.h
  3. 9
      src/storm/solver/Z3SmtSolver.cpp
  4. 2
      src/storm/solver/Z3SmtSolver.h

5
src/storm/solver/SmtSolver.cpp

@ -92,5 +92,10 @@ namespace storm {
return false;
}
std::string SmtSolver::getSmtLibString() const {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "This solver does not support exporting the assertions in the SMT-LIB format.");
return "ERROR";
}
} // namespace solver
} // namespace storm

14
src/storm/solver/SmtSolver.h

@ -71,14 +71,9 @@ namespace storm {
SmtSolver(SmtSolver const& other) = default;
#ifndef WINDOWS
SmtSolver(SmtSolver&& other) = default;
#endif
SmtSolver& operator=(SmtSolver const& other) = default;
#ifndef WINDOWS
SmtSolver& operator=(SmtSolver&& other) = default;
#endif
/*!
* Pushes a backtracking point on the solver's stack. A following call to pop() deletes exactly those
@ -153,9 +148,7 @@ namespace storm {
* @return Sat if the conjunction of the asserted expressions together with the provided assumptions is
* satisfiable, Unsat if it is unsatisfiable and Unknown if the solver could not determine satisfiability.
*/
#ifndef WINDOWS
virtual CheckResult checkWithAssumptions(std::initializer_list<storm::expressions::Expression> const& assumptions) = 0;
#endif
/*!
* If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that
@ -292,6 +285,13 @@ namespace storm {
*/
virtual bool unsetTimeout();
/*!
* If supported by the solver, this function returns the current assertions in the SMT-LIB format.
*
* @return the current assertions in the SMT-LIB format.
*/
virtual std::string getSmtLibString() const;
private:
// The manager responsible for the expressions that interact with this solver.
storm::expressions::ExpressionManager& manager;

9
src/storm/solver/Z3SmtSolver.cpp

@ -361,5 +361,14 @@ namespace storm {
#endif
}
std::string Z3SmtSolver::getSmtLibString() const {
#ifdef STORM_HAVE_Z3
return solver->to_smt2();
#else
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Storm is compiled without Z3 support.");
#endif
}
}
}

2
src/storm/solver/Z3SmtSolver.h

@ -71,6 +71,8 @@ namespace storm {
virtual bool unsetTimeout() override;
virtual std::string getSmtLibString() const override;
private:
#ifdef STORM_HAVE_Z3
/*!

Loading…
Cancel
Save