diff --git a/src/storm/solver/SmtSolver.cpp b/src/storm/solver/SmtSolver.cpp index 16c16a104..6e66f70f4 100644 --- a/src/storm/solver/SmtSolver.cpp +++ b/src/storm/solver/SmtSolver.cpp @@ -91,6 +91,11 @@ namespace storm { bool SmtSolver::unsetTimeout() { 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 diff --git a/src/storm/solver/SmtSolver.h b/src/storm/solver/SmtSolver.h index f9184bbd2..3e3a4eeb5 100644 --- a/src/storm/solver/SmtSolver.h +++ b/src/storm/solver/SmtSolver.h @@ -71,15 +71,10 @@ 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 * assertions from the solver's stack that were added after this call. @@ -153,10 +148,8 @@ 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 const& assumptions) = 0; -#endif - + /*! * If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that * satisfies all assertions on the solver's stack (as well as provided assumptions), provided that the @@ -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; diff --git a/src/storm/solver/Z3SmtSolver.cpp b/src/storm/solver/Z3SmtSolver.cpp index cff81e5e7..13579a172 100644 --- a/src/storm/solver/Z3SmtSolver.cpp +++ b/src/storm/solver/Z3SmtSolver.cpp @@ -360,6 +360,15 @@ namespace storm { STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Storm is compiled without Z3 support."); #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 + } + } } diff --git a/src/storm/solver/Z3SmtSolver.h b/src/storm/solver/Z3SmtSolver.h index ae0981682..6616e0292 100644 --- a/src/storm/solver/Z3SmtSolver.h +++ b/src/storm/solver/Z3SmtSolver.h @@ -70,6 +70,8 @@ namespace storm { virtual bool setTimeout(uint_fast64_t milliseconds) override; virtual bool unsetTimeout() override; + + virtual std::string getSmtLibString() const override; private: #ifdef STORM_HAVE_Z3