Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
OverlappingGuardAnalyser.cpp
Go to the documentation of this file.
4
5namespace storm {
6namespace prism {
7OverlappingGuardAnalyser::OverlappingGuardAnalyser(Program const& program, std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory)
8 : program(program), smtSolver(smtSolverFactory->create(program.getManager())), initializedWithStateConstraints(false) {
9 // Intentionally left empty.
10}
11
13 if (!initializedWithStateConstraints) {
14 std::vector<storm::expressions::Expression> expressions = program.getAllRangeExpressions();
15 if (!expressions.empty()) {
16 smtSolver->add(storm::expressions::conjunction(expressions));
17 }
18 }
19
20 for (auto const& module : program.getModules()) {
21 for (auto const& actionIndex : module.getSynchronizingActionIndices()) {
22 auto const& commandIndices = module.getCommandIndicesByActionIndex(actionIndex);
23 if (commandIndices.size() == 1) {
24 continue;
25 } else {
26 for (uint64_t commandIndexA : commandIndices) {
27 for (uint64_t commandIndexB : commandIndices) {
28 if (commandIndexA <= commandIndexB) {
29 continue;
30 }
31 smtSolver->push();
32 smtSolver->add(module.getCommand(commandIndexA).getGuardExpression());
33 smtSolver->add(module.getCommand(commandIndexB).getGuardExpression());
34 auto smtCheckResult = smtSolver->check();
35 smtSolver->pop();
36 if (smtCheckResult == storm::solver::SmtSolver::CheckResult::Sat) {
37 return true;
38 }
39 }
40 }
41 }
42 }
43 }
44 return false;
45}
46
47} // namespace prism
48} // namespace storm
OverlappingGuardAnalyser(Program const &program, std::shared_ptr< storm::utility::solver::SmtSolverFactory > &smtSolverFactory)
bool hasModuleWithInnerActionOverlap()
returns true iff there are two commands that
std::vector< storm::expressions::Expression > getAllRangeExpressions() const
Retrieves a list of expressions that characterize the legal ranges of all variables.
Definition Program.cpp:512
std::vector< Module > const & getModules() const
Retrieves all modules of the program.
Definition Program.cpp:629
Expression conjunction(std::vector< storm::expressions::Expression > const &expressions)
LabParser.cpp.
Definition cli.cpp:18