Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
MathsatSmtSolver.cpp
Go to the documentation of this file.
2
7
8namespace storm {
9namespace solver {
10
11#ifdef STORM_HAVE_MATHSAT
12MathsatSmtSolver::MathsatAllsatModelReference::MathsatAllsatModelReference(
13 storm::expressions::ExpressionManager const& manager, msat_env const& env, msat_term* model,
14 std::unordered_map<storm::expressions::Variable, uint_fast64_t> const& variableToSlotMapping)
15 : ModelReference(manager), env(env), model(model), variableToSlotMapping(variableToSlotMapping) {
16 // Intentionally left empty.
17}
18
19bool MathsatSmtSolver::MathsatAllsatModelReference::getBooleanValue(storm::expressions::Variable const& variable) const {
20 std::unordered_map<storm::expressions::Variable, uint_fast64_t>::const_iterator variableSlotPair = variableToSlotMapping.find(variable);
21 STORM_LOG_THROW(variableSlotPair != variableToSlotMapping.end(), storm::exceptions::InvalidArgumentException,
22 "Cannot retrieve value of unknown variable '" << variable.getName() << "' from model.");
23 msat_term selectedTerm = model[variableSlotPair->second];
24
25 if (msat_term_is_not(env, selectedTerm)) {
26 return false;
27 } else {
28 return true;
29 }
30}
31
32int_fast64_t MathsatSmtSolver::MathsatAllsatModelReference::getIntegerValue(storm::expressions::Variable const&) const {
33 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Unable to retrieve integer value from model that only contains boolean values.");
34}
35
36double MathsatSmtSolver::MathsatAllsatModelReference::getRationalValue(storm::expressions::Variable const&) const {
37 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Unable to retrieve double value from model that only contains boolean values.");
38}
39
40std::string MathsatSmtSolver::MathsatAllsatModelReference::toString() const {
41 std::stringstream str;
42 bool first = true;
43 str << "[";
44 for (auto const& varSlot : variableToSlotMapping) {
45 if (first) {
46 first = false;
47 } else {
48 str << ", ";
49 }
50 str << varSlot.first.getName() << "=" << std::boolalpha << getBooleanValue(varSlot.first);
51 }
52 str << "]";
53 return str.str();
54}
55
56MathsatSmtSolver::MathsatModelReference::MathsatModelReference(storm::expressions::ExpressionManager const& manager, msat_env const& env,
57 storm::adapters::MathsatExpressionAdapter& expressionAdapter)
58 : ModelReference(manager), env(env), expressionAdapter(expressionAdapter) {
59 // Intentionally left empty.
60}
61
62bool MathsatSmtSolver::MathsatModelReference::getBooleanValue(storm::expressions::Variable const& variable) const {
63 STORM_LOG_ASSERT(variable.hasBooleanType(), "Variable is non-boolean type.");
64 msat_term msatVariable = expressionAdapter.translateExpression(variable);
65 msat_term msatValue = msat_get_model_value(env, msatVariable);
67 !MSAT_ERROR_TERM(msatValue),
68 "Unable to retrieve value of variable in model. This could be caused by calls to the solver between checking for satisfiability and model retrieval.");
69 storm::expressions::Expression value = expressionAdapter.translateExpression(msatValue);
70 return value.evaluateAsBool();
71}
72
73int_fast64_t MathsatSmtSolver::MathsatModelReference::getIntegerValue(storm::expressions::Variable const& variable) const {
74 STORM_LOG_ASSERT(variable.hasIntegerType(), "Variable is non-boolean type.");
75 msat_term msatVariable = expressionAdapter.translateExpression(variable);
76 msat_term msatValue = msat_get_model_value(env, msatVariable);
78 !MSAT_ERROR_TERM(msatValue),
79 "Unable to retrieve value of variable in model. This could be caused by calls to the solver between checking for satisfiability and model retrieval.");
80 storm::expressions::Expression value = expressionAdapter.translateExpression(msatValue);
81 return value.evaluateAsInt();
82}
83
84double MathsatSmtSolver::MathsatModelReference::getRationalValue(storm::expressions::Variable const& variable) const {
85 STORM_LOG_ASSERT(variable.hasRationalType(), "Variable is non-boolean type.");
86 msat_term msatVariable = expressionAdapter.translateExpression(variable);
87 msat_term msatValue = msat_get_model_value(env, msatVariable);
89 !MSAT_ERROR_TERM(msatValue),
90 "Unable to retrieve value of variable in model. This could be caused by calls to the solver between checking for satisfiability and model retrieval.");
91 storm::expressions::Expression value = expressionAdapter.translateExpression(msatValue);
92 return value.evaluateAsDouble();
93}
94
95std::string MathsatSmtSolver::MathsatModelReference::toString() const {
96 std::stringstream str;
97 bool first = true;
98 str << "[";
99 for (auto const& varDecl : expressionAdapter.getAllDeclaredVariables()) {
100 if (first) {
101 first = false;
102 } else {
103 str << ", ";
104 }
105 msat_term msatValue = msat_get_model_value(env, expressionAdapter.translateExpression(varDecl.first));
106 STORM_LOG_ASSERT(!MSAT_ERROR_TERM(msatValue),
107 "Unable to retrieve value of variable in model. This could be caused by calls to the solver between checking for satisfiability and "
108 "model retrieval.");
109 str << varDecl.first.getName() << "=" << expressionAdapter.translateExpression(msatValue);
110 }
111 str << "]";
112 return str.str();
113}
114
115#endif
116
118 : SmtSolver(manager)
119#ifdef STORM_HAVE_MATHSAT
120 ,
121 expressionAdapter(nullptr),
122 lastCheckAssumptions(false),
123 lastResult(CheckResult::Unknown)
124#endif
125{
126#ifdef STORM_HAVE_MATHSAT
127 msat_config config = msat_create_config();
128 if (options.enableInterpolantGeneration) {
129 msat_set_option(config, "interpolation", "true");
130 }
131 if (options.enableModelGeneration) {
132 msat_set_option(config, "model_generation", "true");
133 }
134 if (options.enableUnsatCoreGeneration) {
135 msat_set_option(config, "unsat_core_generation", "true");
136 }
137 STORM_LOG_THROW(!MSAT_ERROR_CONFIG(config), storm::exceptions::UnexpectedException, "Unable to create Mathsat configuration.");
138
139 // Based on the configuration, build the environment, check for errors and destroy the configuration.
140 env = msat_create_env(config);
141 STORM_LOG_THROW(!MSAT_ERROR_ENV(env), storm::exceptions::UnexpectedException, "Unable to create Mathsat environment.");
142 msat_destroy_config(config);
143
144 expressionAdapter = std::make_unique<storm::adapters::MathsatExpressionAdapter>(manager, env);
145#else
146 (void)options;
147#endif
148}
149
151#ifdef STORM_HAVE_MATHSAT
152 if (!MSAT_ERROR_ENV(env)) {
153 msat_destroy_env(env);
154 } else {
155 STORM_LOG_ERROR("Trying to destroy illegal MathSAT environment.");
156 }
157#else
158 // Empty.
159#endif
160}
161
163#ifdef STORM_HAVE_MATHSAT
164 msat_push_backtrack_point(env);
165#else
166 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
167#endif
168}
169
171#ifdef STORM_HAVE_MATHSAT
172 msat_pop_backtrack_point(env);
173#else
174 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
175#endif
176}
177
178void MathsatSmtSolver::pop(uint_fast64_t n) {
179#ifdef STORM_HAVE_MATHSAT
181#else
182 (void)n;
183 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
184#endif
185}
186
188#ifdef STORM_HAVE_MATHSAT
189 msat_reset_env(env);
190#else
191 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
192#endif
193}
194
196#ifdef STORM_HAVE_MATHSAT
197 msat_term expression = expressionAdapter->translateExpression(e);
198 msat_assert_formula(env, expression);
199 if (expressionAdapter->hasAdditionalConstraints()) {
200 for (auto const& constraint : expressionAdapter->getAdditionalConstraints()) {
201 msat_assert_formula(env, constraint);
202 }
203 }
204#else
205 (void)e;
206 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
207#endif
208}
209
211#ifdef STORM_HAVE_MATHSAT
212 lastCheckAssumptions = false;
213 switch (msat_solve(env)) {
214 case MSAT_SAT:
215 this->lastResult = SmtSolver::CheckResult::Sat;
216 break;
217 case MSAT_UNSAT:
218 this->lastResult = SmtSolver::CheckResult::Unsat;
219 break;
220 default:
221 this->lastResult = SmtSolver::CheckResult::Unknown;
222 break;
223 }
224 return this->lastResult;
225#else
226 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
227#endif
228}
229
230SmtSolver::CheckResult MathsatSmtSolver::checkWithAssumptions(std::set<storm::expressions::Expression> const& assumptions) {
231#ifdef STORM_HAVE_MATHSAT
232 lastCheckAssumptions = true;
233 std::vector<msat_term> mathSatAssumptions;
234 mathSatAssumptions.reserve(assumptions.size());
235
236 for (storm::expressions::Expression assumption : assumptions) {
237 mathSatAssumptions.push_back(this->expressionAdapter->translateExpression(assumption));
238 }
239
240 switch (msat_solve_with_assumptions(env, mathSatAssumptions.data(), mathSatAssumptions.size())) {
241 case MSAT_SAT:
242 this->lastResult = SmtSolver::CheckResult::Sat;
243 break;
244 case MSAT_UNSAT:
245 this->lastResult = SmtSolver::CheckResult::Unsat;
246 break;
247 default:
248 this->lastResult = SmtSolver::CheckResult::Unknown;
249 break;
250 }
251 return this->lastResult;
252#else
253 (void)assumptions;
254 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
255#endif
256}
257
258SmtSolver::CheckResult MathsatSmtSolver::checkWithAssumptions(std::initializer_list<storm::expressions::Expression> const& assumptions) {
259#ifdef STORM_HAVE_MATHSAT
260 lastCheckAssumptions = true;
261 std::vector<msat_term> mathSatAssumptions;
262 mathSatAssumptions.reserve(assumptions.size());
263
264 for (storm::expressions::Expression assumption : assumptions) {
265 mathSatAssumptions.push_back(this->expressionAdapter->translateExpression(assumption));
266 }
267
268 switch (msat_solve_with_assumptions(env, mathSatAssumptions.data(), mathSatAssumptions.size())) {
269 case MSAT_SAT:
270 this->lastResult = SmtSolver::CheckResult::Sat;
271 break;
272 case MSAT_UNSAT:
273 this->lastResult = SmtSolver::CheckResult::Unsat;
274 break;
275 default:
276 this->lastResult = SmtSolver::CheckResult::Unknown;
277 break;
278 }
279 return this->lastResult;
280#else
281 (void)assumptions;
282 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
283#endif
284}
285
287#ifdef STORM_HAVE_MATHSAT
288 STORM_LOG_THROW(this->lastResult == SmtSolver::CheckResult::Sat, storm::exceptions::InvalidStateException,
289 "Unable to create model for formula that was not determined to be satisfiable.");
290 return this->convertMathsatModelToValuation();
291#else
292 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
293#endif
294}
295
296std::shared_ptr<SmtSolver::ModelReference> MathsatSmtSolver::getModel() {
297#ifdef STORM_HAVE_MATHSAT
298 STORM_LOG_THROW(this->lastResult == SmtSolver::CheckResult::Sat, storm::exceptions::InvalidStateException,
299 "Unable to create model for formula that was not determined to be satisfiable.");
300 return std::shared_ptr<SmtSolver::ModelReference>(new MathsatModelReference(this->getManager(), env, *expressionAdapter));
301#else
302 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
303#endif
304}
305
306#ifdef STORM_HAVE_MATHSAT
307storm::expressions::SimpleValuation MathsatSmtSolver::convertMathsatModelToValuation() {
308 storm::expressions::SimpleValuation stormModel(this->getManager().getSharedPointer());
309
310 msat_model_iterator modelIterator = msat_create_model_iterator(env);
311 STORM_LOG_THROW(!MSAT_ERROR_MODEL_ITERATOR(modelIterator), storm::exceptions::UnexpectedException, "MathSat returned an illegal model iterator.");
312
313 while (msat_model_iterator_has_next(modelIterator)) {
314 msat_term t, v;
315 msat_model_iterator_next(modelIterator, &t, &v);
316
317 storm::expressions::Expression variableInterpretation = this->expressionAdapter->translateExpression(v);
318 storm::expressions::Variable stormVariable = this->expressionAdapter->getVariable(msat_term_get_decl(t));
319
320 if (stormVariable.hasBooleanType()) {
321 stormModel.setBooleanValue(stormVariable, variableInterpretation.isTrue());
322 } else if (stormVariable.hasIntegerType()) {
323 stormModel.setIntegerValue(stormVariable, variableInterpretation.evaluateAsInt());
324 } else if (stormVariable.hasRationalType()) {
325 stormModel.setRationalValue(stormVariable, variableInterpretation.evaluateAsDouble());
326 } else {
327 STORM_LOG_THROW(false, storm::exceptions::ExpressionEvaluationException, "Variable interpretation in model is not of type bool, int or rational.");
328 }
329 }
330
331 return stormModel;
332}
333#endif
334
335std::vector<storm::expressions::SimpleValuation> MathsatSmtSolver::allSat(std::vector<storm::expressions::Variable> const& important) {
336#ifdef STORM_HAVE_MATHSAT
337 std::vector<storm::expressions::SimpleValuation> valuations;
338 this->allSat(important, [&valuations](storm::expressions::SimpleValuation const& valuation) -> bool {
339 valuations.push_back(valuation);
340 return true;
341 });
342 return valuations;
343#else
344 (void)important;
345 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
346#endif
347}
348
349#ifdef STORM_HAVE_MATHSAT
350class AllsatValuationCallbackUserData {
351 public:
352 AllsatValuationCallbackUserData(storm::expressions::ExpressionManager const& manager, storm::adapters::MathsatExpressionAdapter& adapter, msat_env& env,
353 std::function<bool(storm::expressions::SimpleValuation&)> const& callback)
354 : manager(manager), adapter(adapter), env(env), callback(callback) {
355 // Intentionally left empty.
356 }
357
358 static int allsatValuationsCallback(msat_term* model, int size, void* user_data) {
359 AllsatValuationCallbackUserData* user = reinterpret_cast<AllsatValuationCallbackUserData*>(user_data);
360
361 storm::expressions::SimpleValuation valuation(user->manager.getSharedPointer());
362 for (int i = 0; i < size; ++i) {
363 bool currentTermValue = true;
364 msat_term currentTerm = model[i];
365 if (msat_term_is_not(user->env, currentTerm)) {
366 currentTerm = msat_term_get_arg(currentTerm, 0);
367 currentTermValue = false;
368 }
369 storm::expressions::Variable stormVariable = user->adapter.getVariable(msat_term_get_decl(currentTerm));
370 valuation.setBooleanValue(stormVariable, currentTermValue);
371 }
372
373 if (user->callback(valuation)) {
374 return 1;
375 } else {
376 return 0;
377 }
378 }
379
380 protected:
381 // The manager responsible for the expression.s
382 storm::expressions::ExpressionManager const& manager;
383
384 // The adapter to use for expression translation.
385 storm::adapters::MathsatExpressionAdapter& adapter;
386
387 // The MathSAT environment. It is used to retrieve the values of the atoms in a model.
388 msat_env& env;
389
390 // The function that is to be called when the MathSAT model has been translated to a valuation.
391 std::function<bool(storm::expressions::SimpleValuation&)> const& callback;
392};
393
394class AllsatModelReferenceCallbackUserData {
395 public:
396 AllsatModelReferenceCallbackUserData(storm::expressions::ExpressionManager const& manager, msat_env& env,
397 std::unordered_map<storm::expressions::Variable, uint_fast64_t> const& atomToSlotMapping,
398 std::function<bool(storm::solver::SmtSolver::ModelReference&)> const& callback)
399 : manager(manager), env(env), atomToSlotMapping(atomToSlotMapping), callback(callback) {
400 // Intentionally left empty.
401 }
402
403 static int allsatModelReferenceCallback(msat_term* model, int, void* user_data) {
404 AllsatModelReferenceCallbackUserData* user = reinterpret_cast<AllsatModelReferenceCallbackUserData*>(user_data);
405 MathsatSmtSolver::MathsatAllsatModelReference modelReference(user->manager, user->env, model, user->atomToSlotMapping);
406 if (user->callback(modelReference)) {
407 return 1;
408 } else {
409 return 0;
410 }
411 }
412
413 protected:
414 // The manager responsible for the expression.s
415 storm::expressions::ExpressionManager const& manager;
416
417 // The MathSAT environment. It is used to retrieve the values of the atoms in a model.
418 msat_env& env;
419
420 // Store a mapping from atoms to their slots in the model.
421 std::unordered_map<storm::expressions::Variable, uint_fast64_t> const& atomToSlotMapping;
422
423 // The function that is to be called when the MathSAT model has been translated to a valuation.
424 std::function<bool(storm::solver::SmtSolver::ModelReference&)> const& callback;
425};
426#endif
427
428uint_fast64_t MathsatSmtSolver::allSat(std::vector<storm::expressions::Variable> const& important,
429 std::function<bool(storm::expressions::SimpleValuation&)> const& callback) {
430#ifdef STORM_HAVE_MATHSAT
431 // Create a backtracking point, because MathSAT will modify the assertions stack during its AllSat procedure.
432 this->push();
433
434 std::vector<msat_term> msatImportant;
435 msatImportant.reserve(important.size());
436
437 for (storm::expressions::Variable const& variable : important) {
438 STORM_LOG_THROW(variable.hasBooleanType(), storm::exceptions::InvalidArgumentException, "The important atoms for AllSat must be boolean variables.");
439 msatImportant.push_back(expressionAdapter->translateExpression(variable));
440 }
441
442 AllsatValuationCallbackUserData allSatUserData(this->getManager(), *expressionAdapter, env, callback);
443 int numberOfModels =
444 msat_all_sat(env, msatImportant.data(), msatImportant.size(), &AllsatValuationCallbackUserData::allsatValuationsCallback, &allSatUserData);
445
446 // Restore original assertion stack and return.
447 this->pop();
448 return static_cast<uint_fast64_t>(numberOfModels);
449#else
450 (void)important;
451 (void)callback;
452 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
453#endif
454}
455
456uint_fast64_t MathsatSmtSolver::allSat(std::vector<storm::expressions::Variable> const& important,
457 std::function<bool(SmtSolver::ModelReference&)> const& callback) {
458#ifdef STORM_HAVE_MATHSAT
459 // Create a backtracking point, because MathSAT will modify the assertions stack during its AllSat procedure.
460 this->push();
461
462 std::vector<msat_term> msatImportant;
463 msatImportant.reserve(important.size());
464 std::unordered_map<storm::expressions::Variable, uint_fast64_t> atomToSlotMapping;
465
466 for (storm::expressions::Variable const& variable : important) {
467 STORM_LOG_THROW(variable.hasBooleanType(), storm::exceptions::InvalidArgumentException, "The important atoms for AllSat must be boolean variables.");
468 msatImportant.push_back(expressionAdapter->translateExpression(variable));
469 atomToSlotMapping[variable] = msatImportant.size() - 1;
470 }
471
472 AllsatModelReferenceCallbackUserData allSatUserData(this->getManager(), env, atomToSlotMapping, callback);
473 int numberOfModels =
474 msat_all_sat(env, msatImportant.data(), msatImportant.size(), &AllsatModelReferenceCallbackUserData::allsatModelReferenceCallback, &allSatUserData);
475
476 // Restore original assertion stack and return.
477 this->pop();
478 return static_cast<uint_fast64_t>(numberOfModels);
479#else
480 (void)important;
481 (void)callback;
482 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
483#endif
484}
485
486std::vector<storm::expressions::Expression> MathsatSmtSolver::getUnsatAssumptions() {
487#ifdef STORM_HAVE_MATHSAT
488 STORM_LOG_THROW(lastResult == SmtSolver::CheckResult::Unsat, storm::exceptions::InvalidStateException,
489 "Unable to generate unsatisfiable core of assumptions, because the last check did not determine the formulas to be unsatisfiable.");
490 STORM_LOG_THROW(lastCheckAssumptions, storm::exceptions::InvalidStateException,
491 "Unable to generate unsatisfiable core of assumptions, because the last check did not involve assumptions.");
492
493 size_t numUnsatAssumpations;
494 msat_term* msatUnsatAssumptions = msat_get_unsat_assumptions(env, &numUnsatAssumpations);
495
496 std::vector<storm::expressions::Expression> unsatAssumptions;
497 unsatAssumptions.reserve(numUnsatAssumpations);
498
499 for (unsigned int i = 0; i < numUnsatAssumpations; ++i) {
500 unsatAssumptions.push_back(this->expressionAdapter->translateExpression(msatUnsatAssumptions[i]));
501 }
502
503 return unsatAssumptions;
504#else
505 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
506#endif
507}
508
510#ifdef STORM_HAVE_MATHSAT
511 auto groupIter = this->interpolationGroups.find(group);
512 if (groupIter == this->interpolationGroups.end()) {
513 int newGroup = msat_create_itp_group(env);
514 auto insertResult = this->interpolationGroups.insert(std::make_pair(group, newGroup));
515 groupIter = insertResult.first;
516 }
517 msat_set_itp_group(env, groupIter->second);
518#else
519 (void)group;
520 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
521#endif
522}
523
525#ifdef STORM_HAVE_MATHSAT
526 STORM_LOG_THROW(lastResult == SmtSolver::CheckResult::Unsat, storm::exceptions::InvalidStateException,
527 "Unable to generate interpolant, because the last check did not determine the formulas to be unsatisfiable.");
528 STORM_LOG_THROW(!lastCheckAssumptions, storm::exceptions::InvalidStateException,
529 "Unable to generate interpolant, because the last check for satisfiability involved assumptions.");
530
531 std::vector<int> msatInterpolationGroupsA;
532 msatInterpolationGroupsA.reserve(groupsA.size());
533 for (auto groupOfA : groupsA) {
534 auto groupIter = this->interpolationGroups.find(groupOfA);
535 STORM_LOG_THROW(groupIter != this->interpolationGroups.end(), storm::exceptions::InvalidArgumentException,
536 "Unable to generate interpolant, because an unknown interpolation group was referenced.");
537 msatInterpolationGroupsA.push_back(groupIter->second);
538 }
539 msat_term interpolant = msat_get_interpolant(env, msatInterpolationGroupsA.data(), msatInterpolationGroupsA.size());
540
541 STORM_LOG_THROW(!MSAT_ERROR_TERM(interpolant), storm::exceptions::UnexpectedException, "Unable to retrieve an interpolant.");
542
543 return this->expressionAdapter->translateExpression(interpolant);
544#else
545 (void)groupsA;
546 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException, "Storm is compiled without MathSAT support.");
547#endif
548}
549} // namespace solver
550} // namespace storm
int_fast64_t evaluateAsInt(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
bool evaluateAsBool(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
double evaluateAsDouble(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
bool isTrue() const
Checks if the expression is equal to the boolean literal true.
This class is responsible for managing a set of typed variables and all expressions using these varia...
A simple implementation of the valuation interface.
bool hasBooleanType() const
Checks whether the variable is of boolean type.
Definition Variable.cpp:59
bool hasIntegerType() const
Checks whether the variable is of integral type.
Definition Variable.cpp:63
bool hasRationalType() const
Checks whether the variable is of rational type.
Definition Variable.cpp:71
std::string const & getName() const
Retrieves the name of the variable.
Definition Variable.cpp:46
A class that captures options that may be passed to the Mathsat solver.
virtual std::vector< storm::expressions::Expression > getUnsatAssumptions() override
If the last call to checkWithAssumptions() returned Unsat, this function can be used to retrieve a su...
virtual storm::expressions::Expression getInterpolant(std::vector< uint_fast64_t > const &groupsA) override
If the last call to check() returned Unsat, the solver has been instantiated with support for interpo...
virtual std::shared_ptr< SmtSolver::ModelReference > getModel() override
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model tha...
virtual void add(storm::expressions::Expression const &assertion) override
Adds an assertion to the solver's stack.
MathsatSmtSolver(storm::expressions::ExpressionManager &manager, Options const &options=Options())
virtual void pop() override
Pops a backtracking point from the solver's stack.
virtual CheckResult check() override
Checks whether the conjunction of assertions that are currently on the solver's stack is satisfiable.
virtual void reset() override
Removes all assertions from the solver's stack.
virtual std::vector< storm::expressions::SimpleValuation > allSat(std::vector< storm::expressions::Variable > const &important) override
Performs AllSat over the (provided) important atoms.
virtual void push() override
Pushes a backtracking point on the solver's stack.
virtual CheckResult checkWithAssumptions(std::set< storm::expressions::Expression > const &assumptions) override
Checks whether the conjunction of assertions that are currently on the solver's stack together with t...
virtual storm::expressions::SimpleValuation getModelAsValuation() override
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model tha...
virtual void setInterpolationGroup(uint_fast64_t group) override
Sets the current interpolation group.
The base class for all model references.
Definition SmtSolver.h:30
virtual void pop()=0
Pops a backtracking point from the solver's stack.
storm::expressions::ExpressionManager const & getManager() const
Retrieves the expression manager associated with the solver.
Definition SmtSolver.cpp:79
SmtSolver(storm::expressions::ExpressionManager &manager)
Constructs a new Smt solver with the given options.
Definition SmtSolver.cpp:17
CheckResult
possible check results
Definition SmtSolver.h:24
#define STORM_LOG_ERROR(message)
Definition logging.h:29
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
SettingsManager const & manager()
Retrieves the settings manager.