Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HybridCtmcCslModelChecker.cpp
Go to the documentation of this file.
2
4
18
19namespace storm {
20namespace modelchecker {
21template<typename ModelType>
23 // Intentionally left empty.
24}
25
26template<typename ModelType>
40
41template<typename ModelType>
43 return canHandleStatic(checkTask);
44}
45
46template<typename ModelType>
49 storm::logic::UntilFormula const& pathFormula = checkTask.getFormula();
50 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
51 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
52 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
53 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
54
55 return storm::modelchecker::helper::HybridCtmcCslHelper::computeUntilProbabilities<DdType, ValueType>(
56 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), leftResult.getTruthValuesVector(),
57 rightResult.getTruthValuesVector(), checkTask.isQualitativeSet());
58}
59
60template<typename ModelType>
63 storm::logic::NextFormula const& pathFormula = checkTask.getFormula();
64 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.getSubformula());
65 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
66
67 return storm::modelchecker::helper::HybridCtmcCslHelper::computeNextProbabilities<DdType, ValueType>(
68 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), subResult.getTruthValuesVector());
69}
70
71template<typename ModelType>
74 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
75 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
76 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
77 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
78 return storm::modelchecker::helper::HybridCtmcCslHelper::computeReachabilityRewards<DdType, ValueType>(
79 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), rewardModel.get(),
80 subResult.getTruthValuesVector(), checkTask.isQualitativeSet());
81}
82
83template<typename ModelType>
86 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
87 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
88 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
89
90 storm::models::symbolic::StandardRewardModel<DdType, ValueType> timeRewardModel(this->getModel().getManager().getConstant(storm::utility::one<ValueType>()),
91 boost::none, boost::none);
92 return storm::modelchecker::helper::HybridCtmcCslHelper::computeReachabilityRewards<DdType, ValueType>(
93 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), timeRewardModel, subResult.getTruthValuesVector(),
94 checkTask.isQualitativeSet());
95}
96
97template<typename ModelType>
100 storm::logic::BoundedUntilFormula const& pathFormula = checkTask.getFormula();
101 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
102 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
103 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
104 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
105
106 STORM_LOG_THROW(pathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
107 "Currently step-bounded and reward-bounded properties on CTMCs are not supported.");
108 double lowerBound = 0;
109 double upperBound = 0;
110 if (pathFormula.hasLowerBound()) {
111 lowerBound = pathFormula.getLowerBound<double>();
112 }
113 if (pathFormula.hasUpperBound()) {
114 upperBound = pathFormula.getNonStrictUpperBound<double>();
115 } else {
116 upperBound = storm::utility::infinity<double>();
117 }
118
119 return storm::modelchecker::helper::HybridCtmcCslHelper::computeBoundedUntilProbabilities<DdType, ValueType>(
120 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
121 leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(), checkTask.isQualitativeSet(), lowerBound, upperBound);
122}
123
124template<typename ModelType>
127 storm::logic::InstantaneousRewardFormula const& rewardPathFormula = checkTask.getFormula();
128
129 STORM_LOG_THROW(!rewardPathFormula.isStepBounded(), storm::exceptions::NotImplementedException,
130 "Currently step-bounded properties on CTMCs are not supported.");
131 return storm::modelchecker::helper::HybridCtmcCslHelper::computeInstantaneousRewards<DdType, ValueType>(
132 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
133 checkTask.isRewardModelSet() ? this->getModel().getRewardModel(checkTask.getRewardModel()) : this->getModel().getRewardModel(""),
134 rewardPathFormula.getBound<double>());
135}
136
137template<typename ModelType>
140 storm::logic::CumulativeRewardFormula const& rewardPathFormula = checkTask.getFormula();
141
142 STORM_LOG_THROW(rewardPathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
143 "Currently step-bounded and reward-bounded properties on CTMCs are not supported.");
144 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
145 return storm::modelchecker::helper::HybridCtmcCslHelper::computeCumulativeRewards<DdType, ValueType>(
146 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
147 rewardModel.get(), rewardPathFormula.getNonStrictBound<double>());
148}
149
150template<typename ModelType>
153 storm::logic::StateFormula const& stateFormula = checkTask.getFormula();
154 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
155 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
156
157 auto probabilisticTransitions = this->getModel().computeProbabilityMatrix();
158 storm::modelchecker::helper::HybridInfiniteHorizonHelper<ValueType, DdType, false> helper(this->getModel(), probabilisticTransitions,
159 this->getModel().getExitRateVector());
161 return helper.computeLongRunAverageProbabilities(env, subResult.getTruthValuesVector());
162}
163
164template<typename ModelType>
167 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
168 auto probabilisticTransitions = this->getModel().computeProbabilityMatrix();
169 storm::modelchecker::helper::HybridInfiniteHorizonHelper<ValueType, DdType, false> helper(this->getModel(), probabilisticTransitions,
170 this->getModel().getExitRateVector());
172 return helper.computeLongRunAverageRewards(env, rewardModel.get());
173}
174
175// Explicitly instantiate the model checker.
178
181
182} // namespace modelchecker
183} // namespace storm
Formula const & getRightSubformula() const
Formula const & getLeftSubformula() const
TimeBoundReference const & getTimeBoundReference(unsigned i=0) const
ValueType getNonStrictUpperBound(unsigned i=0) const
storm::expressions::Expression const & getLowerBound(unsigned i=0) const
TimeBoundReference const & getTimeBoundReference() const
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setTimeOperatorsAllowed(bool newValue)
FragmentSpecification & setGloballyFormulasAllowed(bool newValue)
FragmentSpecification & setCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageProbabilitiesAllowed(bool newValue)
FragmentSpecification & setBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setInstantaneousFormulasAllowed(bool newValue)
FragmentSpecification & setTimeAllowed(bool newValue)
storm::expressions::Expression const & getBound() const
Formula const & getSubformula() const
SymbolicQualitativeCheckResult< Type > & asSymbolicQualitativeCheckResult()
bool isRewardModelSet() const
Retrieves whether a reward model was set.
Definition CheckTask.h:190
bool isQualitativeSet() const
Retrieves whether the computation only needs to be performed qualitatively, because the values will o...
Definition CheckTask.h:257
std::string const & getRewardModel() const
Retrieves the reward model over which to perform the checking (if set).
Definition CheckTask.h:197
FormulaType const & getFormula() const
Retrieves the formula from this task.
Definition CheckTask.h:140
bool isOnlyInitialStatesRelevantSet() const
Retrieves whether only the initial states are relevant in the computation.
Definition CheckTask.h:204
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const override
virtual std::unique_ptr< CheckResult > computeInstantaneousRewards(Environment const &env, CheckTask< storm::logic::InstantaneousRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeReachabilityTimes(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeNextProbabilities(Environment const &env, CheckTask< storm::logic::NextFormula, ValueType > const &checkTask) override
static bool canHandleStatic(CheckTask< storm::logic::Formula, ValueType > const &checkTask)
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeCumulativeRewards(Environment const &env, CheckTask< storm::logic::CumulativeRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeReachabilityRewards(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ValueType > const &checkTask) override
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
std::unique_ptr< HybridQuantitativeCheckResult< DdType, ValueType > > computeLongRunAverageProbabilities(Environment const &env, storm::dd::Bdd< DdType > const &psiStates)
Computes the long run average probabilities, i.e., the fraction of the time we are in a psiState.
std::unique_ptr< HybridQuantitativeCheckResult< DdType, ValueType > > computeLongRunAverageRewards(Environment const &env, storm::models::symbolic::StandardRewardModel< DdType, ValueType > const &rewardModel)
Computes the long run average rewards, i.e., the average reward collected per time unit.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
FragmentSpecification csrl()
void setInformationFromCheckTaskDeterministic(HelperType &helper, storm::modelchecker::CheckTask< FormulaType, typename ModelType::ValueType > const &checkTask, ModelType const &model)
Forwards relevant information stored in the given CheckTask to the given helper.
FilteredRewardModel< RewardModelType > createFilteredRewardModel(RewardModelType const &baseRewardModel, storm::logic::RewardAccumulation const &acc, bool isDiscreteTimeModel)
LabParser.cpp.
Definition cli.cpp:18