27template<
typename SparseDtmcModelType>
33template<
typename SparseDtmcModelType>
35 bool* requiresSingleInitialState) {
45 storm::logic::prctlstar().setBoundedUntilFormulasAllowed(
true).setTimeOperatorsAllowed(
true).setReachbilityTimeFormulasAllowed(
true))) {
50 .setLongRunAverageRewardFormulasAllowed(
true)
51 .setLongRunAverageProbabilitiesAllowed(
true)
52 .setConditionalProbabilityFormulasAllowed(
true)
53 .setConditionalRewardFormulasAllowed(
true)
54 .setTotalRewardFormulasAllowed(
true)
55 .setOnlyEventuallyFormuluasInConditionalFormulasAllowed(
true)
56 .setRewardBoundedUntilFormulasAllowed(
true)
57 .setRewardBoundedCumulativeRewardFormulasAllowed(
true)
58 .setMultiDimensionalBoundedUntilFormulasAllowed(
true)
59 .setMultiDimensionalCumulativeRewardFormulasAllowed(
true)
60 .setTimeOperatorsAllowed(
true)
61 .setReachbilityTimeFormulasAllowed(
true)
62 .setRewardAccumulationAllowed(
true)
63 .setHOAPathFormulasAllowed(
true)
64 .setDiscountedTotalRewardFormulasAllowed(
true)
65 .setDiscountedCumulativeRewardFormulasAllowed(
true))) {
68 if (requiresSingleInitialState) {
69 *requiresSingleInitialState =
true;
78template<
typename SparseDtmcModelType>
80 bool requiresSingleInitialState =
false;
82 return !requiresSingleInitialState || this->
getModel().getInitialStates().getNumberOfSetBits() == 1;
88template<
typename SparseDtmcModelType>
94 "Checking non-trivial bounded until probabilities can only be computed for the initial states of the model.");
99 auto formula = std::make_shared<storm::logic::ProbabilityOperatorFormula>(checkTask.
getFormula().asSharedPointer(), opInfo);
105 STORM_LOG_THROW(pathFormula.
hasUpperBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have (a single) upper step bound.");
113 std::vector<SolutionType> numericResult =
helper.computeStepBoundedUntilProbabilities(
118 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(numericResult));
119 result->setValuesExact();
124template<
typename SparseDtmcModelType>
128 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented next probabilities with intervals.");
131 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, pathFormula.
getSubformula());
133 std::vector<SolutionType> numericResult =
136 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(numericResult));
137 result->setValuesExact();
142template<
typename SparseDtmcModelType>
148 "Uncertainty resolution mode must be set for uncertain (interval) models.");
151 storm::exceptions::InvalidSettingsException,
152 "Uncertainty resolution modes robust or cooperative not allowed if optimization direction is not stated explicitly.");
153 STORM_LOG_THROW(this->
getModel().getTransitionMatrix().isProbabilisticGraphPreserving(), storm::exceptions::InvalidSettingsException,
154 "Computing until probabilities on uncertain model requires graph-preservation.");
164 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(ret.values));
165 result->setBounds(std::move(ret.solutionBounds));
169template<
typename SparseDtmcModelType>
173 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented globally probabilities with intervals.");
176 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, pathFormula.
getSubformula());
181 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(ret.values));
182 result->setBounds(std::move(ret.solutionBounds));
187template<
typename SparseDtmcModelType>
191 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented automata-props with intervals.");
199 return this->
check(env, formula)->template asExplicitQualitativeCheckResult<SolutionType>().getTruthValuesVector();
202 std::vector<ValueType> numericResult =
helper.computeDAProductProbabilities(env, *pathFormula.
readAutomaton(), apSets);
208template<
typename SparseDtmcModelType>
212 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented LTL with interval models.");
220 return this->
check(env, formula)->template asExplicitQualitativeCheckResult<SolutionType>().getTruthValuesVector();
222 std::vector<ValueType> numericResult =
helper.computeLTLProbabilities(env, pathFormula, formulaChecker);
228template<
typename SparseDtmcModelType>
235 "We have not yet implemented multi-dimensional or reward-bounded cumulative rewards with intervals.");
238 "Checking non-trivial bounded until probabilities can only be computed for the initial states of the model.");
240 "Checking reward bounded cumulative reward formulas is not supported if reward accumulations are given.");
245 auto formula = std::make_shared<storm::logic::RewardOperatorFormula>(checkTask.
getFormula().asSharedPointer(), checkTask.
getRewardModel(), opInfo);
254 "Uncertainty resolution mode must be set for uncertain (interval) models.");
257 storm::exceptions::InvalidSettingsException,
258 "Uncertainty resolution modes robust or cooperative not allowed if optimization direction is not stated explicitly.");
260 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
262 std::vector<SolutionType> numericResult =
266 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(numericResult));
267 result->setValuesExact();
275 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Discounted properties are not implemented for parametric models.");
278template<
typename SparseDtmcModelType>
282 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented discounted cumulative rewards with intervals.");
285 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
287 std::vector<SolutionType> numericResult =
291 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(numericResult));
292 result->setValuesExact();
297template<
typename SparseDtmcModelType>
301 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented instantaneous rewards with intervals.");
304 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
305 std::vector<SolutionType> numericResult =
309 rewardPathFormula.
getBound<uint64_t>());
310 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(numericResult));
311 result->setValuesExact();
316template<
typename SparseDtmcModelType>
322 "Uncertainty resolution mode must be set for uncertain (interval) models.");
325 storm::exceptions::InvalidSettingsException,
326 "Uncertainty resolution modes robust or cooperative not allowed if optimization direction is not stated explicitly.");
327 STORM_LOG_THROW(this->
getModel().getTransitionMatrix().isProbabilisticGraphPreserving(), storm::exceptions::InvalidSettingsException,
328 "Computing rewards on uncertain model requires graph-preservation.");
330 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, eventuallyFormula.
getSubformula());
336 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(ret.values));
337 result->setBounds(std::move(ret.solutionBounds));
341template<
typename SparseDtmcModelType>
346 "Uncertainty resolution mode must be set for uncertain (interval) models.");
349 storm::exceptions::InvalidSettingsException,
350 "Uncertainty resolution modes robust or cooperative not allowed if optimization direction is not stated explicitly.");
351 STORM_LOG_THROW(this->
getModel().getTransitionMatrix().isProbabilisticGraphPreserving(), storm::exceptions::InvalidSettingsException,
352 "Computing reachability times on uncertain model requires graph-preservation.");
355 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, eventuallyFormula.
getSubformula());
360 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(ret.values));
361 result->setBounds(std::move(ret.solutionBounds));
365template<
typename SparseDtmcModelType>
369 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented total rewards with intervals.");
375 auto result = std::make_unique<ExplicitQuantitativeCheckResult<SolutionType>>(std::move(ret.values));
376 result->setBounds(std::move(ret.solutionBounds));
384 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Discounted properties are not implemented for parametric models.");
387template<
typename SparseDtmcModelType>
391 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented discounted total rewards with intervals.");
404template<
typename SparseDtmcModelType>
408 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented LRA probabilities with intervals.");
411 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, stateFormula);
422template<
typename SparseDtmcModelType>
426 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented lra with intervals.");
431 auto values =
helper.computeLongRunAverageRewards(env, rewardModel.get());
436template<
typename SparseDtmcModelType>
440 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented conditional probabilities with intervals.");
444 "Illegal conditional probability formula.");
446 "Illegal conditional probability formula.");
453 std::vector<ExtendedSolutionType> numericResult =
461template<
typename SparseDtmcModelType>
465 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented conditional rewards with intervals.");
469 "Illegal conditional probability formula.");
471 "Illegal conditional probability formula.");
478 std::vector<ExtendedSolutionType> numericResult =
481 this->
getModel().getBackwardTransitions(),
491 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Quantiles for parametric models are not implemented.");
494template<
typename SparseDtmcModelType>
498 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented quantile formulas with intervals.");
501 "Computing quantiles is only supported for the initial states of a model.");
502 STORM_LOG_THROW(this->
getModel().getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::InvalidOperationException,
503 "Quantiles not supported on models with multiple initial states.");
504 uint64_t initialState = *this->
getModel().getInitialStates().begin();
509 if (res.size() == 1 && res.front().size() == 1) {
517template<
typename SparseDtmcModelType>
520 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented steady state distributions with intervals.");
526 std::vector<SolutionType> result;
527 auto const& initialStates = this->
getModel().getInitialStates();
528 uint64_t numInitStates = initialStates.getNumberOfSetBits();
529 if (numInitStates == 1) {
530 result =
helper.computeLongRunAverageStateDistribution(env, *initialStates.begin());
532 STORM_LOG_WARN(
"Multiple initial states found. A uniform distribution over initial states is assumed.");
534 result =
helper.computeLongRunAverageStateDistribution(env, [&initialStates, &initProb](uint64_t
const& stateIndex) {
544template<
typename SparseDtmcModelType>
547 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented expected visiting times with intervals.");
553 std::vector<ExtendedSolutionType> result;
554 auto const& initialStates = this->
getModel().getInitialStates();
555 uint64_t numInitStates = initialStates.getNumberOfSetBits();
556 STORM_LOG_THROW(numInitStates > 0, storm::exceptions::InvalidOperationException,
"No initial states given. Cannot compute expected visiting times.");
557 STORM_LOG_WARN_COND(numInitStates == 1,
"Multiple initial states found. A uniform distribution over initial states is assumed.");
558 result =
helper.computeExpectedVisitingTimes(env, initialStates);
bool isRewardBound() const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
bool isBoundSet() const
Retrieves whether there is a bound with which the values for the states will be compared.
bool isRewardModelSet() const
Retrieves whether a reward model was set.
bool isQualitativeSet() const
Retrieves whether the computation only needs to be performed qualitatively, because the values will o...
std::string const & getRewardModel() const
Retrieves the reward model over which to perform the checking (if set).
FormulaType const & getFormula() const
Retrieves the formula from this task.
ModelCheckerHint const & getHint() const
Retrieves a hint that might contain information that speeds up the modelchecking process (if supporte...
bool isUncertaintyResolutionModeSet() const
Returns whether the mode, which decides how the uncertainty will be resolved, is set.
storm::logic::Bound const & getBound() const
Retrieves the bound (if set).
bool isOnlyInitialStatesRelevantSet() const
Retrieves whether only the initial states are relevant in the computation.
UncertaintyResolutionMode getUncertaintyResolutionMode() const
Retrieves the mode which decides how the uncertainty will be resolved.
A qualitative check result over the states of a sparse model.
vector_type const & getTruthValuesVector() const
Retrieves the truth values, one per state this result is for.
A quantitative check result over the states of a sparse model.
virtual std::unique_ptr< CheckResult > computeReachabilityTimes(Environment const &env, CheckTask< storm::logic::EventuallyFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLTLProbabilities(Environment const &env, CheckTask< storm::logic::PathFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeConditionalProbabilities(Environment const &env, CheckTask< storm::logic::ConditionalFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeNextProbabilities(Environment const &env, CheckTask< storm::logic::NextFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeReachabilityRewards(Environment const &env, CheckTask< storm::logic::EventuallyFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, SolutionType > const &checkTask) override
std::unique_ptr< CheckResult > computeExpectedVisitingTimes(Environment const &env)
Computes for each state the expected number of times we visit that state.
storm::IntervalBaseType< ValueType > SolutionType
virtual std::unique_ptr< CheckResult > computeTotalRewards(Environment const &env, CheckTask< storm::logic::TotalRewardFormula, SolutionType > const &checkTask) override
SparseDtmcModelType::ValueType ValueType
virtual std::unique_ptr< CheckResult > computeDiscountedTotalRewards(Environment const &env, CheckTask< storm::logic::DiscountedTotalRewardFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeDiscountedCumulativeRewards(Environment const &env, CheckTask< storm::logic::DiscountedCumulativeRewardFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeHOAPathProbabilities(Environment const &env, CheckTask< storm::logic::HOAPathFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeInstantaneousRewards(Environment const &env, CheckTask< storm::logic::InstantaneousRewardFormula, SolutionType > const &checkTask) override
SparseDtmcPrctlModelChecker(SparseDtmcModelType const &model)
virtual std::unique_ptr< CheckResult > computeCumulativeRewards(Environment const &env, CheckTask< storm::logic::CumulativeRewardFormula, SolutionType > const &checkTask) override
static bool canHandleStatic(CheckTask< storm::logic::Formula, SolutionType > const &checkTask, bool *requiresSingleInitialState=nullptr)
Returns false, if this task can certainly not be handled by this model checker (independent of the co...
virtual std::unique_ptr< CheckResult > computeGloballyProbabilities(Environment const &env, CheckTask< storm::logic::GloballyFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, SolutionType > const &checkTask) override
virtual bool canHandle(CheckTask< storm::logic::Formula, SolutionType > const &checkTask) const override
std::unique_ptr< CheckResult > computeSteadyStateDistribution(Environment const &env)
Computes the long run average (or: steady state) distribution over all states Assumes a uniform distr...
virtual std::unique_ptr< CheckResult > computeConditionalRewards(Environment const &env, CheckTask< storm::logic::ConditionalFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > checkQuantileFormula(Environment const &env, CheckTask< storm::logic::QuantileFormula, SolutionType > const &checkTask) override
SparsePropositionalModelChecker(SparseDtmcModelType const &model)
SparseDtmcModelType const & getModel() const
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
Helper class for computing for each state the expected number of times to visit that state assuming a...
static std::vector< SolutionType > computeDiscountedCumulativeRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound, ValueType discountFactor)
static DTMCSparseModelCheckingHelperReturnType< ExtendedSolutionType > computeTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, bool qualitative, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< SolutionType > computeDiscountedTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, bool qualitative, ValueType discountFactor, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< SolutionType > computeRewardBoundedValues(Environment const &env, storm::models::sparse::Dtmc< ValueType > const &model, std::shared_ptr< storm::logic::OperatorFormula const > rewardBoundedFormula)
static std::vector< SolutionType > computeCumulativeRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound)
static std::vector< SolutionType > computeInstantaneousRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepCount)
static DTMCSparseModelCheckingHelperReturnType< ExtendedSolutionType > computeReachabilityTimes(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &targetStates, bool qualitative, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< ExtendedSolutionType > computeConditionalProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &targetStates, storm::storage::BitVector const &conditionStates, bool qualitative)
static std::vector< SolutionType > computeNextProbabilities(Environment const &env, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
static DTMCSparseModelCheckingHelperReturnType< ExtendedSolutionType > computeReachabilityRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, storm::storage::BitVector const &targetStates, bool qualitative, ModelCheckerHint const &hint=ModelCheckerHint())
static DTMCSparseModelCheckingHelperReturnType< SolutionType > computeUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool qualitative, ModelCheckerHint const &hint=ModelCheckerHint())
static DTMCSparseModelCheckingHelperReturnType< SolutionType > computeGloballyProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &psiStates, bool qualitative)
static std::vector< ExtendedSolutionType > computeConditionalRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, storm::storage::BitVector const &targetStates, storm::storage::BitVector const &conditionStates, bool qualitative)
Helper class for LTL model checking.
std::vector< std::vector< storm::utility::ExtendedValueType< ValueType > > > computeQuantile(Environment const &env)
#define STORM_LOG_WARN(message)
#define STORM_LOG_THROW_UNCONDITIONALLY(exception, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification prctlstar()
FragmentSpecification propositional()
FragmentSpecification reachability()
FragmentSpecification quantiles()
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)
TargetType convertNumber(SourceType const &number)
constexpr bool IsIntervalType
Helper to check if a type is an interval.