Storm
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>
26 // Intentionally left empty.
27}
28
29template<typename ModelType>
33
34template<typename ModelType>
38
39template<typename ModelType>
41 return name;
42}
43
44template<typename ModelType>
46 // Create the appropriate preservation information.
47 auto const& checkTask = this->getCheckTask();
48 storm::dd::bisimulation::PreservationInformation<DdType, ValueType> preservationInformation(model, {checkTask.getFormula().asSharedPointer()});
49 if (checkTask.getFormula().isEventuallyFormula() && checkTask.getFormula().asEventuallyFormula().getContext() == storm::logic::FormulaContext::Reward) {
50 if (!checkTask.isRewardModelSet() || model.hasUniqueRewardModel()) {
51 preservationInformation.addRewardModel(model.getUniqueRewardModelName());
52 } else if (checkTask.isRewardModelSet()) {
53 preservationInformation.addRewardModel(checkTask.getRewardModel());
54 }
55 }
56
57 // Create the bisimulation object.
58 this->bisimulation = std::make_unique<storm::dd::BisimulationDecomposition<DdType, ValueType>>(this->model, storm::storage::BisimulationType::Strong,
59 preservationInformation);
60}
61
62template<typename ModelType>
63std::shared_ptr<storm::models::Model<typename BisimulationAbstractionRefinementModelChecker<ModelType>::ValueType>>
65 lastAbstractModel = this->bisimulation->getQuotient(storm::dd::bisimulation::QuotientFormat::Dd);
66 return lastAbstractModel;
67}
68
69template<typename ModelType>
70std::pair<std::unique_ptr<storm::gbar::abstraction::StateSet>, std::unique_ptr<storm::gbar::abstraction::StateSet>>
72 STORM_LOG_ASSERT(lastAbstractModel, "Expected abstract model.");
73 std::pair<storm::dd::Bdd<DdType>, storm::dd::Bdd<DdType>> ddResult;
74 if (lastAbstractModel->isOfType(storm::models::ModelType::Dtmc)) {
75 ddResult = this->getConstraintAndTargetStates(*lastAbstractModel->template as<storm::models::symbolic::Dtmc<DdType, ValueType>>());
76 } else if (lastAbstractModel->isOfType(storm::models::ModelType::Mdp)) {
77 ddResult = this->getConstraintAndTargetStates(*lastAbstractModel->template as<storm::models::symbolic::Mdp<DdType, ValueType>>());
78 } else {
79 ddResult = this->getConstraintAndTargetStates(*lastAbstractModel->template as<storm::models::symbolic::StochasticTwoPlayerGame<DdType, ValueType>>());
80 }
81
82 std::pair<std::unique_ptr<storm::gbar::abstraction::StateSet>, std::unique_ptr<storm::gbar::abstraction::StateSet>> result;
83 result.first = std::make_unique<storm::gbar::abstraction::SymbolicStateSet<DdType>>(ddResult.first);
84 result.second = std::make_unique<storm::gbar::abstraction::SymbolicStateSet<DdType>>(ddResult.second);
85 return result;
86}
87
88template<typename ModelType>
89template<typename QuotientModelType>
90std::pair<storm::dd::Bdd<BisimulationAbstractionRefinementModelChecker<ModelType>::DdType>,
93 std::pair<storm::dd::Bdd<DdType>, storm::dd::Bdd<DdType>> result;
94
95 auto const& checkTask = this->getCheckTask();
96
98 if (checkTask.getFormula().isUntilFormula()) {
99 std::unique_ptr<storm::modelchecker::CheckResult> subresult = checker.check(checkTask.getFormula().asUntilFormula().getLeftSubformula());
100 result.first = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
101 subresult = checker.check(checkTask.getFormula().asUntilFormula().getRightSubformula());
102 result.second = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
103 } else if (checkTask.getFormula().isEventuallyFormula()) {
104 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula().asEventuallyFormula();
105 result.first = quotient.getReachableStates();
106 std::unique_ptr<storm::modelchecker::CheckResult> subresult = checker.check(eventuallyFormula.getSubformula());
107 result.second = subresult->asSymbolicQualitativeCheckResult<DdType>().getTruthValuesVector();
108 } else {
109 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "The given formula is not supported by this model checker.");
110 }
111
112 return result;
113}
114
115template<typename ModelType>
117 // Usually, the abstraction player is the first player. However, when we have arrived at the actual bisimulation
118 // quotient, the abstraction player vanishes.
119 return model.getType() == lastAbstractModel->getType() ? 0 : 1;
120}
121
122template<typename ModelType>
126
127template<typename ModelType>
129 STORM_LOG_ASSERT(bisimulation, "Bisimulation object required.");
130 this->bisimulation->compute(10);
131}
132
137
138} // namespace modelchecker
139} // namespace storm::gbar
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.
BisimulationAbstractionRefinementModelChecker(ModelType const &model)
Constructs a model checker for the given model.
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 ...
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:333
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:15
This class represents a discrete-time Markov decision process.
Definition Mdp.h:15
This class represents a discrete-time stochastic two-player game.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30