13 changed files with 222 additions and 13 deletions
-
32src/storm/generator/CompressedState.cpp
-
12src/storm/generator/CompressedState.h
-
17src/storm/generator/NextStateGenerator.cpp
-
4src/storm/generator/NextStateGenerator.h
-
15src/storm/generator/PrismNextStateGenerator.cpp
-
4src/storm/generator/PrismNextStateGenerator.h
-
3src/storm/modelchecker/multiobjective/pcaa/RewardBoundedMdpPcaaWeightVectorChecker.h
-
35src/storm/simulator/PrismProgramSimulator.cpp
-
12src/storm/simulator/PrismProgramSimulator.h
-
9src/storm/storage/expressions/ExpressionStringFormat.h
-
58src/storm/storage/prism/OverlappingGuardAnalyser.cpp
-
32src/storm/storage/prism/OverlappingGuardAnalyser.h
-
2src/storm/utility/random.h
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
namespace storm { |
|||
namespace expressions { |
|||
struct ExpressionStringFormat { |
|||
bool alternativeIff = false; |
|||
}; |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
#include "storm/storage/prism/OverlappingGuardAnalyser.h"
|
|||
#include "storm/storage/prism/Program.h"
|
|||
#include "storm/solver/SmtSolver.h"
|
|||
|
|||
|
|||
namespace storm { |
|||
namespace prism { |
|||
OverlappingGuardAnalyser::OverlappingGuardAnalyser(Program const& program, std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory) : |
|||
program(program), smtSolver(smtSolverFactory->create(program.getManager())), initializedWithStateConstraints(false) { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
|
|||
bool OverlappingGuardAnalyser::hasModuleWithInnerActionOverlap() { |
|||
if(!initializedWithStateConstraints) { |
|||
for(auto const& integerVariable : program.getGlobalIntegerVariables()) { |
|||
smtSolver->add(integerVariable.getExpressionVariable().getExpression() >= integerVariable.getLowerBoundExpression()); |
|||
smtSolver->add(integerVariable.getExpressionVariable().getExpression() <= integerVariable.getUpperBoundExpression()); |
|||
} |
|||
for (auto const& module : program.getModules()) { |
|||
for(auto const& integerVariable : module.getIntegerVariables()) { |
|||
smtSolver->add(integerVariable.getExpressionVariable().getExpression() >= integerVariable.getLowerBoundExpression()); |
|||
smtSolver->add(integerVariable.getExpressionVariable().getExpression() <= integerVariable.getUpperBoundExpression()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
for(auto const& module : program.getModules()) { |
|||
for (auto const& actionIndex : module.getSynchronizingActionIndices()) { |
|||
auto const& commandIndices = module.getCommandIndicesByActionIndex(actionIndex); |
|||
if (commandIndices.size() == 1) { |
|||
continue; |
|||
} else { |
|||
for (uint64_t commandIndexA : commandIndices) { |
|||
for (uint64_t commandIndexB : commandIndices) { |
|||
if (commandIndexA == commandIndexB) { |
|||
continue; |
|||
} |
|||
smtSolver->push(); |
|||
smtSolver->add(module.getCommand(commandIndexA).getGuardExpression()); |
|||
smtSolver->add(module.getCommand(commandIndexB).getGuardExpression()); |
|||
auto smtCheckResult = smtSolver->check(); |
|||
smtSolver->pop(); |
|||
if (smtCheckResult == storm::solver::SmtSolver::CheckResult::Sat) { |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
#pragma once |
|||
#include <cstdint> |
|||
#include <memory> |
|||
|
|||
namespace storm { |
|||
namespace utility { |
|||
namespace solver { |
|||
class SmtSolverFactory; |
|||
} |
|||
} |
|||
|
|||
namespace solver { |
|||
class SmtSolver; |
|||
} |
|||
|
|||
namespace prism { |
|||
class Program; |
|||
class Module; |
|||
|
|||
class OverlappingGuardAnalyser { |
|||
public: |
|||
OverlappingGuardAnalyser(Program const& program, std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory); |
|||
bool hasModuleWithInnerActionOverlap(); |
|||
|
|||
private: |
|||
Program const& program; |
|||
std::unique_ptr<storm::solver::SmtSolver> smtSolver; |
|||
bool initializedWithStateConstraints; |
|||
}; |
|||
} |
|||
} |
|||
|
Reference in new issue
xxxxxxxxxx