Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BisimulationAbstractionRefinementModelChecker.cpp
Go to the documentation of this file.
2
7
9
11
14
17
18namespace storm::gbar {
19namespace modelchecker {
20
21template<typename ModelType>
22const std::string BisimulationAbstractionRefinementModelChecker<ModelType>::name = "bisimulation-based astraction refinement";
23
24template<typename ModelType>
27 : AbstractAbstractionRefinementModelChecker<ModelType>(options), model(model) {
28 // Intentionally left empty.
29}
30
31template<typename ModelType>
35
36template<typename ModelType>
40
41template<typename ModelType>
43 return name;
44}
45
46template<typename ModelType>
48 // Create the appropriate preservation information.
49 auto const& checkTask = this->getCheckTask();
50 storm::dd::bisimulation::PreservationInformation<DdType, ValueType> preservationInformation(model, {checkTask.getFormula().asSharedPointer()});
51 if (checkTask.getFormula().isEventuallyFormula() && checkTask.getFormula().asEventuallyFormula().getContext() == storm::logic::FormulaContext::Reward) {
52 if (!checkTask.isRewardModelSet() || model.hasUniqueRewardModel()) {
53 preservationInformation.addRewardModel(model.getUniqueRewardModelName());
54 } else if (checkTask.isRewardModelSet()) {
55 preservationInformation.addRewardModel(checkTask.getRewardModel());
56 }
57 }
58
59 // Create the bisimulation object.
60 this->bisimulation = std::make_unique<storm::dd::BisimulationDecomposition<DdType, ValueType>>(this->model, storm::bisimulation::BisimulationType::Strong,
61 preservationInformation);
62}
63
64template<typename ModelType>
65std::shared_ptr<storm::models::Model<typename BisimulationAbstractionRefinementModelChecker<ModelType>::ValueType>>
67 lastAbstractModel = this->bisimulation->getQuotient(storm::dd::bisimulation::QuotientFormat::Dd);
68 return lastAbstractModel;
69}
70
71template<typename ModelType>
72std::pair<std::unique_ptr<storm::gbar::abstraction::StateSet>, std::unique_ptr<storm::gbar::abstraction::StateSet>>
74 STORM_LOG_ASSERT(lastAbstractModel, "Expected abstract model.");
75 std::pair<storm::dd::Bdd<DdType>, storm::dd::Bdd<DdType>> ddResult;
76 if (lastAbstractModel->isOfType(storm::models::ModelType::Dtmc)) {
77 ddResult = this->getConstraintAndTargetStates(*lastAbstractModel->template as<storm::models::symbolic::Dtmc<DdType, ValueType>>());
78 } else if (lastAbstractModel->isOfType(storm::models::ModelType::Mdp)) {
79 ddResult = this->getConstraintAndTargetStates(*lastAbstractModel->template as<storm::models::symbolic::Mdp<DdType, ValueType>>());
80 } else {
82 }
83
84 std::pair<std::unique_ptr<storm::gbar::abstraction::StateSet>, std::unique_ptr<storm::gbar::abstraction::StateSet>> result;
85 result.first = std::make_unique<storm::gbar::abstraction::SymbolicStateSet<DdType>>(ddResult.first);
86 result.second = std::make_unique<storm::gbar::abstraction::SymbolicStateSet<DdType>>(ddResult.second);
87 return result;
88}
89
90template<typename ModelType>
91template<typename QuotientModelType>
92std::pair<storm::dd::Bdd<BisimulationAbstractionRefinementModelChecker<ModelType>::DdType>,
95 std::pair<storm::dd::Bdd<DdType>, storm::dd::Bdd<DdType>> result;
96
97 auto const& checkTask = this->getCheckTask();
98
100 if (checkTask.getFormula().isUntilFormula()) {
101 std::unique_ptr<storm::modelchecker::CheckResult> subresult = checker.check(checkTask.getFormula().asUntilFormula().getLeftSubformula());
102 result.first = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
103 subresult = checker.check(checkTask.getFormula().asUntilFormula().getRightSubformula());
104 result.second = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
105 } else if (checkTask.getFormula().isEventuallyFormula()) {
106 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula().asEventuallyFormula();
107 result.first = quotient.getReachableStates();
108 std::unique_ptr<storm::modelchecker::CheckResult> subresult = checker.check(eventuallyFormula.getSubformula());
109 result.second = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
110 } else {
111 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "The given formula is not supported by this model checker.");
112 }
113
114 return result;
115}
116
117template<typename ModelType>
119 // Usually, the abstraction player is the first player. However, when we have arrived at the actual bisimulation
120 // quotient, the abstraction player vanishes.
121 return model.getType() == lastAbstractModel->getType() ? 0 : 1;
122}
123
124template<typename ModelType>
128
129template<typename ModelType>
131 STORM_LOG_ASSERT(bisimulation, "Bisimulation object required.");
132 this->bisimulation->compute(10);
133}
134
139
140} // namespace modelchecker
141} // namespace storm::gbar
storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const & getCheckTask() const
AbstractAbstractionRefinementModelChecker(abstraction::AbstractionOptions const &options=abstraction::AbstractionOptions())
Constructs a model checker for the given model.
virtual bool requiresSchedulerSynthesis() const override
Retrieves whether schedulers need to be computed.
virtual std::pair< std::unique_ptr< storm::gbar::abstraction::StateSet >, std::unique_ptr< storm::gbar::abstraction::StateSet > > getConstraintAndTargetStates(storm::models::Model< ValueType > const &abstractModel) override
Retrieves the state sets corresponding to the constraint and target states.
virtual uint64_t getAbstractionPlayer() const override
Retrieves the index of the abstraction player.
virtual bool supportsReachabilityRewards() const override
-----— Methods that need to be overwritten/defined by implementations in subclasses.
virtual std::shared_ptr< storm::models::Model< ValueType > > getAbstractModel() override
Retrieves the abstract model.
virtual void refineAbstractModel() override
Refines the abstract model so that the next iteration obtains bounds that are at least as precise as ...
BisimulationAbstractionRefinementModelChecker(ModelType const &model, abstraction::AbstractionOptions const &options=abstraction::AbstractionOptions())
Constructs a model checker for the given model.
virtual void initializeAbstractionRefinement() override
Called before the abstraction refinement loop to give the implementation a time to set up auxiliary d...
virtual std::string const & getName() const override
Retrieves the name of the underlying method.
EventuallyFormula & asEventuallyFormula()
Definition Formula.cpp:371
Formula const & getSubformula() const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
This class represents a discrete-time Markov decision process.
Definition Mdp.h:13
This class represents a discrete-time stochastic two-player game.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:39
Options that configure the game-based abstraction-refinement procedure.