Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HybridCtmcCslModelChecker.cpp
Go to the documentation of this file.
2
4
19
20namespace storm {
21namespace modelchecker {
22template<typename ModelType>
24 // Intentionally left empty.
25}
26
27template<typename ModelType>
41
42template<typename ModelType>
44 return canHandleStatic(checkTask);
45}
46
47template<typename ModelType>
50 storm::logic::UntilFormula const& pathFormula = checkTask.getFormula();
51 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
52 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
53 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
54 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
55
56 return storm::modelchecker::helper::HybridCtmcCslHelper::computeUntilProbabilities<DdType, ValueType>(
57 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), leftResult.getTruthValuesVector(),
58 rightResult.getTruthValuesVector(), checkTask.isQualitativeSet());
59}
60
61template<typename ModelType>
64 storm::logic::NextFormula const& pathFormula = checkTask.getFormula();
65 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.getSubformula());
66 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
67
68 return storm::modelchecker::helper::HybridCtmcCslHelper::computeNextProbabilities<DdType, ValueType>(
69 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), subResult.getTruthValuesVector());
70}
71
72template<typename ModelType>
75 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
76 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
77 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
78 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
79 return storm::modelchecker::helper::HybridCtmcCslHelper::computeReachabilityRewards<DdType, ValueType>(
80 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), rewardModel.get(),
81 subResult.getTruthValuesVector(), checkTask.isQualitativeSet());
82}
83
84template<typename ModelType>
87 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
88 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
89 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
90
91 storm::models::symbolic::StandardRewardModel<DdType, ValueType> timeRewardModel(this->getModel().getManager().getConstant(storm::utility::one<ValueType>()),
92 boost::none, boost::none);
93 return storm::modelchecker::helper::HybridCtmcCslHelper::computeReachabilityRewards<DdType, ValueType>(
94 env, this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(), timeRewardModel, subResult.getTruthValuesVector(),
95 checkTask.isQualitativeSet());
96}
97
98template<typename ModelType>
102 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Computing bounded until probabilities is not supported for this numeric type.");
103 return nullptr;
104 } else {
105 storm::logic::BoundedUntilFormula const& pathFormula = checkTask.getFormula();
106 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
107 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
108 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
109 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
110
111 STORM_LOG_THROW(pathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
112 "Currently step-bounded and reward-bounded properties on CTMCs are not supported.");
113 ValueType lowerBound = 0;
114 ValueType upperBound = 0;
115 if (pathFormula.hasLowerBound()) {
116 lowerBound = pathFormula.getLowerBound<ValueType>();
117 }
118 if (pathFormula.hasUpperBound()) {
119 upperBound = pathFormula.getNonStrictUpperBound<ValueType>();
120 } else {
121 upperBound = storm::utility::infinity<ValueType>();
122 }
123
124 return storm::modelchecker::helper::HybridCtmcCslHelper::computeBoundedUntilProbabilities<DdType, ValueType>(
125 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
126 leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(), checkTask.isQualitativeSet(), lowerBound, upperBound);
127 }
128}
129
130template<typename ModelType>
134 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Computing Instantaneous Rewards is not supported for this numeric type.");
135 return nullptr;
136 } else {
137 storm::logic::InstantaneousRewardFormula const& rewardPathFormula = checkTask.getFormula();
138
139 STORM_LOG_THROW(!rewardPathFormula.isStepBounded(), storm::exceptions::NotImplementedException,
140 "Currently step-bounded properties on CTMCs are not supported.");
141 return storm::modelchecker::helper::HybridCtmcCslHelper::computeInstantaneousRewards<DdType, ValueType>(
142 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
143 checkTask.isRewardModelSet() ? this->getModel().getRewardModel(checkTask.getRewardModel()) : this->getModel().getRewardModel(""),
144 rewardPathFormula.getBound<ValueType>());
145 }
146}
147
148template<typename ModelType>
152 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Computing Cumulative Rewards is not supported for this numeric type.");
153 return nullptr;
154 } else {
155 storm::logic::CumulativeRewardFormula const& rewardPathFormula = checkTask.getFormula();
156
157 STORM_LOG_THROW(rewardPathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
158 "Currently step-bounded and reward-bounded properties on CTMCs are not supported.");
159 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
160 return storm::modelchecker::helper::HybridCtmcCslHelper::computeCumulativeRewards<DdType, ValueType>(
161 env, this->getModel(), checkTask.isOnlyInitialStatesRelevantSet(), this->getModel().getTransitionMatrix(), this->getModel().getExitRateVector(),
162 rewardModel.get(), rewardPathFormula.getNonStrictBound<ValueType>());
163 }
164}
165
166template<typename ModelType>
169 storm::logic::StateFormula const& stateFormula = checkTask.getFormula();
170 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
171 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
172
173 auto probabilisticTransitions = this->getModel().computeProbabilityMatrix();
174 storm::modelchecker::helper::HybridInfiniteHorizonHelper<ValueType, DdType, false> helper(this->getModel(), probabilisticTransitions,
175 this->getModel().getExitRateVector());
177 return helper.computeLongRunAverageProbabilities(env, subResult.getTruthValuesVector());
178}
179
180template<typename ModelType>
183 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
184 auto probabilisticTransitions = this->getModel().computeProbabilityMatrix();
185 storm::modelchecker::helper::HybridInfiniteHorizonHelper<ValueType, DdType, false> helper(this->getModel(), probabilisticTransitions,
186 this->getModel().getExitRateVector());
188 return helper.computeLongRunAverageRewards(env, rewardModel.get());
189}
190
191// Explicitly instantiate the model checker.
194
197
198} // namespace modelchecker
199} // 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.