Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HybridMarkovAutomatonCslModelChecker.cpp
Go to the documentation of this file.
2
18
19namespace storm {
20namespace modelchecker {
21template<typename ModelType>
23 : SymbolicPropositionalModelChecker<ModelType>(model) {
24 // Intentionally left empty.
25}
26
27template<typename ModelType>
46
47template<typename ModelType>
49 return canHandleStatic(checkTask);
50}
51
52template<typename ModelType>
55 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
56 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
57 storm::logic::UntilFormula const& pathFormula = checkTask.getFormula();
58 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
59 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
60 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
61 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
62
64 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), leftResult.getTruthValuesVector(),
65 rightResult.getTruthValuesVector(), checkTask.isQualitativeSet());
66}
67
68template<typename ModelType>
71 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
72 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
73 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
74 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
75 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
76 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
77 return storm::modelchecker::helper::HybridMarkovAutomatonCslHelper::computeReachabilityRewards<DdType, ValueType>(
78 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
79 this->getModel().getExitRateVector(), rewardModel.get(), subResult.getTruthValuesVector(), checkTask.isQualitativeSet());
80}
81
82template<typename ModelType>
85 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
86 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
87
88 storm::logic::EventuallyFormula const& eventuallyFormula = checkTask.getFormula();
89 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.getSubformula());
90 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
91
92 storm::models::symbolic::StandardRewardModel<DdType, ValueType> timeRewardModel(this->getModel().getManager().getConstant(storm::utility::one<ValueType>()),
93 boost::none, boost::none);
94 return storm::modelchecker::helper::HybridMarkovAutomatonCslHelper::computeReachabilityRewards<DdType, ValueType>(
95 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
96 this->getModel().getExitRateVector(), timeRewardModel, subResult.getTruthValuesVector(), checkTask.isQualitativeSet());
97}
98
99template<typename ModelType>
102 storm::logic::BoundedUntilFormula const& pathFormula = checkTask.getFormula();
103 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.getLeftSubformula());
104 SymbolicQualitativeCheckResult<DdType> const& leftResult = leftResultPointer->asSymbolicQualitativeCheckResult<DdType>();
105
106 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.getRightSubformula());
107 SymbolicQualitativeCheckResult<DdType> const& rightResult = rightResultPointer->asSymbolicQualitativeCheckResult<DdType>();
108
109 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
110 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
111 STORM_LOG_THROW(pathFormula.getTimeBoundReference().isTimeBound(), storm::exceptions::NotImplementedException,
112 "Currently step-bounded and reward-bounded properties on MarkovAutomatons are not supported.");
113 double lowerBound = 0;
114 double upperBound = 0;
115 if (pathFormula.hasLowerBound()) {
116 lowerBound = pathFormula.getLowerBound<double>();
117 }
118 if (pathFormula.hasUpperBound()) {
119 upperBound = pathFormula.getNonStrictUpperBound<double>();
120 } else {
121 upperBound = storm::utility::infinity<double>();
122 }
123
124 return storm::modelchecker::helper::HybridMarkovAutomatonCslHelper::computeBoundedUntilProbabilities<DdType, ValueType>(
125 env, checkTask.getOptimizationDirection(), this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(),
126 this->getModel().getExitRateVector(), leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(), checkTask.isQualitativeSet(), lowerBound,
127 upperBound);
128}
129
130template<typename ModelType>
133 storm::logic::StateFormula const& stateFormula = checkTask.getFormula();
134 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
135 SymbolicQualitativeCheckResult<DdType> const& subResult = subResultPointer->asSymbolicQualitativeCheckResult<DdType>();
136 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
137 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
138
140 this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRateVector());
142 return helper.computeLongRunAverageProbabilities(env, subResult.getTruthValuesVector());
143}
144
145template<typename ModelType>
148 STORM_LOG_THROW(checkTask.isOptimizationDirectionSet(), storm::exceptions::InvalidPropertyException,
149 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
150 auto rewardModel = storm::utility::createFilteredRewardModel(this->getModel(), checkTask);
152 this->getModel(), this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRateVector());
154 return helper.computeLongRunAverageRewards(env, rewardModel.get());
155}
156
157// Explicitly instantiate the model checker.
160
162
163} // namespace modelchecker
164} // 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)
LabParser.cpp.
Definition cli.cpp:18