27namespace modelchecker {
28template<
typename SparseDtmcModelType>
34template<
typename SparseDtmcModelType>
36 bool* requiresSingleInitialState) {
55 if (requiresSingleInitialState) {
56 *requiresSingleInitialState =
true;
63template<
typename SparseDtmcModelType>
65 bool requiresSingleInitialState =
false;
66 if (canHandleStatic(checkTask, &requiresSingleInitialState)) {
67 return !requiresSingleInitialState || this->getModel().getInitialStates().getNumberOfSetBits() == 1;
73template<
typename SparseDtmcModelType>
79 "Checking non-trivial bounded until probabilities can only be computed for the initial states of the model.");
84 auto formula = std::make_shared<storm::logic::ProbabilityOperatorFormula>(checkTask.
getFormula().asSharedPointer(), opInfo);
88 STORM_LOG_THROW(pathFormula.
hasUpperBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have (a single) upper step bound.");
91 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
92 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
96 std::vector<ValueType> numericResult =
105template<
typename SparseDtmcModelType>
109 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
116template<
typename SparseDtmcModelType>
120 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
121 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
131template<
typename SparseDtmcModelType>
135 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
143template<
typename SparseDtmcModelType>
152 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
160template<
typename SparseDtmcModelType>
169 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
176template<
typename SparseDtmcModelType>
182 "Checking non-trivial bounded until probabilities can only be computed for the initial states of the model.");
184 "Checking reward bounded cumulative reward formulas is not supported if reward accumulations are given.");
189 auto formula = std::make_shared<storm::logic::RewardOperatorFormula>(checkTask.
getFormula().asSharedPointer(), checkTask.
getRewardModel(), opInfo);
193 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
202template<
typename SparseDtmcModelType>
206 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
210 rewardPathFormula.
getBound<uint64_t>());
214template<
typename SparseDtmcModelType>
218 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
227template<
typename SparseDtmcModelType>
231 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
239template<
typename SparseDtmcModelType>
245 this->getModel().getBackwardTransitions(), rewardModel.get(), checkTask.
isQualitativeSet(), checkTask.
getHint());
249template<
typename SparseDtmcModelType>
253 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
263template<
typename SparseDtmcModelType>
273template<
typename SparseDtmcModelType>
278 "Illegal conditional probability formula.");
280 "Illegal conditional probability formula.");
293template<
typename SparseDtmcModelType>
298 "Illegal conditional probability formula.");
300 "Illegal conditional probability formula.");
309 this->getModel().getBackwardTransitions(),
318 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Quantiles for parametric models are not implemented.");
321template<
typename SparseDtmcModelType>
325 "Computing quantiles is only supported for the initial states of a model.");
326 STORM_LOG_THROW(this->getModel().getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::InvalidOperationException,
327 "Quantiles not supported on models with multiple initial states.");
328 uint64_t initialState = *this->getModel().getInitialStates().begin();
333 if (res.size() == 1 && res.front().size() == 1) {
340template<
typename SparseDtmcModelType>
346 std::vector<ValueType> result;
347 auto const& initialStates = this->getModel().getInitialStates();
348 uint64_t numInitStates = initialStates.getNumberOfSetBits();
349 if (numInitStates == 1) {
352 STORM_LOG_WARN(
"Multiple initial states found. A uniform distribution over initial states is assumed.");
353 ValueType initProb = storm::utility::one<ValueType>() / storm::utility::convertNumber<ValueType, uint64_t>(numInitStates);
355 return initialStates.get(stateIndex) ? initProb : storm::utility::zero<ValueType>();
363template<
typename SparseDtmcModelType>
369 std::vector<ValueType> result;
370 auto const& initialStates = this->getModel().getInitialStates();
371 uint64_t numInitStates = initialStates.getNumberOfSetBits();
372 STORM_LOG_THROW(numInitStates > 0, storm::exceptions::InvalidOperationException,
"No initial states given. Cannot compute expected visiting times.");
373 STORM_LOG_WARN_COND(numInitStates == 1,
"Multiple initial states found. A uniform distribution over initial states is assumed.");
382#ifdef STORM_HAVE_CARL
FragmentSpecification & setConditionalRewardFormulasAllowed(bool newValue)
FragmentSpecification & setRewardBoundedCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setOnlyEventuallyFormuluasInConditionalFormulasAllowed(bool newValue)
FragmentSpecification & setMultiDimensionalBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setTimeOperatorsAllowed(bool newValue)
FragmentSpecification & setTotalRewardFormulasAllowed(bool newValue)
FragmentSpecification & setMultiDimensionalCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setConditionalProbabilityFormulasAllowed(bool newValue)
FragmentSpecification & setRewardBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageProbabilitiesAllowed(bool newValue)
FragmentSpecification & setHOAPathFormulasAllowed(bool newValue)
FragmentSpecification & setReachbilityTimeFormulasAllowed(bool newValue)
bool isRewardBound() const
ExplicitQualitativeCheckResult & asExplicitQualitativeCheckResult()
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...
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.
vector_type const & getTruthValuesVector() const
virtual std::unique_ptr< CheckResult > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, ValueType > const &checkTask) override
static bool canHandleStatic(CheckTask< storm::logic::Formula, ValueType > 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 > computeConditionalRewards(Environment const &env, CheckTask< storm::logic::ConditionalFormula, 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 > computeInstantaneousRewards(Environment const &env, CheckTask< storm::logic::InstantaneousRewardFormula, ValueType > const &checkTask) override
std::unique_ptr< CheckResult > computeExpectedVisitingTimes(Environment const &env)
Computes for each state the expected number of times we visit that state.
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const override
virtual std::unique_ptr< CheckResult > computeConditionalProbabilities(Environment const &env, CheckTask< storm::logic::ConditionalFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeCumulativeRewards(Environment const &env, CheckTask< storm::logic::CumulativeRewardFormula, ValueType > const &checkTask) override
SparseDtmcModelType::ValueType ValueType
virtual std::unique_ptr< CheckResult > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeGloballyProbabilities(Environment const &env, CheckTask< storm::logic::GloballyFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > checkQuantileFormula(Environment const &env, CheckTask< storm::logic::QuantileFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeTotalRewards(Environment const &env, CheckTask< storm::logic::TotalRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeReachabilityRewards(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
SparseDtmcPrctlModelChecker(SparseDtmcModelType const &model)
virtual std::unique_ptr< CheckResult > computeLTLProbabilities(Environment const &env, CheckTask< storm::logic::PathFormula, ValueType > const &checkTask) 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 > computeHOAPathProbabilities(Environment const &env, CheckTask< storm::logic::HOAPathFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeNextProbabilities(Environment const &env, CheckTask< storm::logic::NextFormula, ValueType > const &checkTask) override
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
std::vector< ValueType > computeLongRunAverageStateDistribution(Environment const &env)
Computes the long run average state distribution, i.e., a vector that assigns for each state s the av...
std::vector< ValueType > compute(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, uint64_t lowerBound, uint64_t upperBound, ModelCheckerHint const &hint=ModelCheckerHint())
Helper class for computing for each state the expected number of times to visit that state assuming a...
std::vector< ValueType > computeExpectedVisitingTimes(Environment const &env, storm::storage::BitVector const &initialStates)
Computes for each state the expected number of times we are visiting that state assuming the given in...
static std::vector< ValueType > computeNextProbabilities(Environment const &env, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
static std::vector< ValueType > computeReachabilityTimes(Environment const &env, storm::solver::SolveGoal< ValueType > &&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< ValueType > computeReachabilityRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&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 std::vector< ValueType > computeUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&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 std::vector< ValueType > computeConditionalProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&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< ValueType > computeTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, bool qualitative, ModelCheckerHint const &hint=ModelCheckerHint())
static std::map< storm::storage::sparse::state_type, ValueType > computeRewardBoundedValues(Environment const &env, storm::models::sparse::Dtmc< ValueType > const &model, std::shared_ptr< storm::logic::OperatorFormula const > rewardBoundedFormula)
static std::vector< ValueType > computeConditionalRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&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)
static std::vector< ValueType > computeInstantaneousRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepCount)
static std::vector< ValueType > computeGloballyProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &psiStates, bool qualitative)
static std::vector< ValueType > computeCumulativeRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound)
std::vector< ValueType > computeLongRunAverageRewards(Environment const &env, storm::models::sparse::StandardRewardModel< ValueType > const &rewardModel)
Computes the long run average rewards, i.e., the average reward collected per time unit.
std::vector< ValueType > computeLongRunAverageProbabilities(Environment const &env, storm::storage::BitVector const &psiStates)
Computes the long run average probabilities, i.e., the fraction of the time we are in a psiState.
Helper class for LTL model checking.
std::vector< ValueType > computeLTLProbabilities(Environment const &env, storm::logic::PathFormula const &formula, CheckFormulaCallback const &formulaChecker)
Computes the LTL probabilities.
static std::map< std::string, storm::storage::BitVector > computeApSets(std::map< std::string, std::shared_ptr< storm::logic::Formula const > > const &extracted, CheckFormulaCallback const &formulaChecker)
Computes the states that are satisfying the AP.
std::vector< ValueType > computeDAProductProbabilities(Environment const &env, storm::automata::DeterministicAutomaton const &da, std::map< std::string, storm::storage::BitVector > &apSatSets)
Computes the (maximizing) probabilities for the constructed DA product.
std::vector< std::vector< ValueType > > computeQuantile(Environment const &env)
#define STORM_LOG_WARN(message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification prctlstar()
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)