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