Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HybridMarkovAutomatonCslModelChecker.cpp
Go to the documentation of this file.
2
16
17namespace storm {
18namespace modelchecker {
19template<typename ModelType>
21 : SymbolicPropositionalModelChecker<ModelType>(model) {
22 // Intentionally left empty.
23}
24
25template<typename ModelType>
44
45template<typename ModelType>
47 return canHandleStatic(checkTask);
48}
49
50template<typename ModelType>
53 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
54 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
55 storm::logic::UntilFormula const& pathFormula = checkTask.getFormula();
56 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
57 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
58 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
59 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
60
62 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), leftResult.getTruthValuesVector(),
63 rightResult.getTruthValuesVector(), checkTask.isQualitativeSet());
64}
65
66template<typename ModelType>
69 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
70 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
71 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
72 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
73 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
74 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
75 return storm::modelchecker::helper::HybridMarkovAutomatonCslHelper::computeReachabilityRewards<DdType, ValueType>(
76 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
77 this->getModel().getExitRateVector(), rewardModel.get(), subResult.getTruthValuesVector(), checkTask.isQualitativeSet());
78}
79
80template<typename ModelType>
83 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
84 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
85
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::HybridMarkovAutomatonCslHelper::computeReachabilityRewards<DdType, ValueType>(
93 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
94 this->getModel().getExitRateVector(), timeRewardModel, subResult.getTruthValuesVector(), 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 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
103
104 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
105 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
106
107 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
108 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
109 STORM_LOG_THROW(pathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
110 "Currently step-bounded and reward-bounded properties on MarkovAutomatons are not supported.");
111 double lowerBound = 0;
112 double upperBound = 0;
113 if (pathFormula.hasLowerBound()) {
114 lowerBound = pathFormula.getLowerBound<double>();
115 }
116 if (pathFormula.hasUpperBound()) {
117 upperBound = pathFormula.getNonStrictUpperBound<double>();
118 } else {
119 upperBound = storm::utility::infinity<double>();
120 }
121
122 return storm::modelchecker::helper::HybridMarkovAutomatonCslHelper::computeBoundedUntilProbabilities<DdType, ValueType>(
123 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
124 this->getModel().getExitRateVector(), leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(), checkTask.isQualitativeSet(), lowerBound,
125 upperBound);
126}
127
128template<typename ModelType>
131 storm::logic::StateFormula const& stateFormula = checkTask.getFormula();
132 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
133 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
134 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
135 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
136
138 this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRateVector());
140 return helper.computeLongRunAverageProbabilities(env, subResult.getTruthValuesVector());
141}
142
143template<typename ModelType>
146 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
147 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
148 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
150 this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRateVector());
152 return helper.computeLongRunAverageRewards(env, rewardModel.get());
153}
154
155// Explicitly instantiate the model checker.
158
160
161} // namespace modelchecker
162} // 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
FragmentSpecification & setNextFormulasAllowed(bool newValue)
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setGloballyFormulasAllowed(bool newValue)
FragmentSpecification & setCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setTotalRewardFormulasAllowed(bool newValue)
FragmentSpecification & setReachabilityRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageProbabilitiesAllowed(bool newValue)
FragmentSpecification & setRewardOperatorsAllowed(bool newValue)
FragmentSpecification & setBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setInstantaneousFormulasAllowed(bool newValue)
FragmentSpecification & setTimeAllowed(bool newValue)
Formula const & getSubformula() const
SymbolicQualitativeCheckResult< Type > & asSymbolicQualitativeCheckResult()
bool isOptimizationDirectionSet() const
Retrieves whether an optimization direction was set.
Definition CheckTask.h:147
bool isQualitativeSet() const
Retrieves whether the computation only needs to be performed qualitatively, because the values will o...
Definition CheckTask.h:257
FormulaType const & getFormula() const
Retrieves the formula from this task.
Definition CheckTask.h:140
storm::OptimizationDirection const & getOptimizationDirection() const
Retrieves the optimization direction (if set).
Definition CheckTask.h:154
static bool canHandleStatic(CheckTask< storm::logic::Formula, ValueType > const &checkTask)
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, ValueType > const &checkTask) override
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const 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 > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, 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.
static std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, OptimizationDirection dir, storm::models::symbolic::NondeterministicModel< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &phiStates, storm::dd::Bdd< DdType > const &psiStates, bool qualitative)
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
FragmentSpecification csl()
void setInformationFromCheckTaskNondeterministic(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)