28namespace modelchecker {
29template<
typename SparseMdpModelType>
35template<
typename SparseMdpModelType>
37 bool* requiresSingleInitialState) {
39 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
88 if (requiresSingleInitialState) {
89 *requiresSingleInitialState =
true;
98template<
typename SparseMdpModelType>
100 bool requiresSingleInitialState =
false;
101 if (canHandleStatic(checkTask, &requiresSingleInitialState)) {
102 return !requiresSingleInitialState || this->getModel().getInitialStates().getNumberOfSetBits() == 1;
108template<
typename SparseMdpModelType>
111 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
112 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented bounded until with intervals");
117 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
120 "Checking non-trivial bounded until probabilities can only be computed for the initial states of the model.");
126 auto formula = std::make_shared<storm::logic::ProbabilityOperatorFormula>(checkTask.
getFormula().asSharedPointer(), opInfo);
132 STORM_LOG_THROW(pathFormula.
hasUpperBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have (a single) upper step bound.");
134 "Formula lower step bound must be discrete/integral.");
136 "Formula needs to have discrete upper time bound.");
137 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
138 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
142 std::vector<SolutionType> numericResult =
151template<
typename SparseMdpModelType>
156 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
157 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
164template<
typename SparseMdpModelType>
169 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
170 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
171 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
180 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(std::move(ret.scheduler));
185template<
typename SparseMdpModelType>
190 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
191 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
198 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(std::move(ret.scheduler));
203template<
typename SparseMdpModelType>
206 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
207 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented automata-props with intervals");
215 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
222 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(
230template<
typename SparseMdpModelType>
233 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
234 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented LTL with intervals");
239 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
245 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
251 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(
259template<
typename SparseMdpModelType>
264 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
265 STORM_LOG_THROW(this->getModel().getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::InvalidPropertyException,
266 "Cannot compute conditional probabilities on MDPs with more than one initial state.");
268 "Illegal conditional probability formula.");
270 "Illegal conditional probability formula.");
282template<
typename SparseMdpModelType>
287 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
289 if constexpr (std::is_same_v<storm::Interval, ValueType>) {
290 throw exceptions::NotImplementedException() <<
"Multi-reward bounded is not supported with interval models";
293 "Checking reward bounded cumulative reward formulas can only be done for the initial states of the model.");
295 "Checking reward bounded cumulative reward formulas is not supported if reward accumulations are given.");
301 auto formula = std::make_shared<storm::logic::RewardOperatorFormula>(checkTask.
getFormula().asSharedPointer(), checkTask.
getRewardModel(), opInfo);
308 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
317template<
typename SparseMdpModelType>
322 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
323 STORM_LOG_THROW(rewardPathFormula.
hasIntegerBound(), storm::exceptions::InvalidPropertyException,
"Formula needs to have a discrete time bound.");
327 rewardPathFormula.
getBound<uint64_t>());
331template<
typename SparseMdpModelType>
336 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
337 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
346 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(std::move(ret.scheduler));
351template<
typename SparseMdpModelType>
356 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
357 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
365 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(std::move(ret.scheduler));
370template<
typename SparseMdpModelType>
374 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
381 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(std::move(ret.scheduler));
386template<
typename SparseMdpModelType>
389 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
390 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented LRA probabilities with intervals");
394 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
395 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
404 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(
411template<
typename SparseMdpModelType>
414 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
415 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented lra with intervals");
418 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
425 result->asExplicitQuantitativeCheckResult<
SolutionType>().setScheduler(
432template<
typename SparseMdpModelType>
435 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
436 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented multi-objective with intervals");
442template<
class SparseMdpModelType>
445 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
446 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented lexicographic model checking with intervals");
449 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
457template<
typename SparseMdpModelType>
460 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
461 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We have not yet implemented quantile formulas with intervals");
464 "Computing quantiles is only supported for the initial states of a model.");
465 STORM_LOG_THROW(this->getModel().getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::InvalidOperationException,
466 "Quantiles not supported on models with multiple initial states.");
467 uint64_t initialState = *this->getModel().getInitialStates().begin();
472 if (res.size() == 1 && res.front().size() == 1) {
FragmentSpecification & setStepBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setRewardBoundedCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setOnlyEventuallyFormuluasInConditionalFormulasAllowed(bool newValue)
FragmentSpecification & setMultiDimensionalBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setTimeOperatorsAllowed(bool newValue)
FragmentSpecification & setTimeBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setCumulativeRewardFormulasAllowed(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 & setTimeBoundedCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setHOAPathFormulasAllowed(bool newValue)
FragmentSpecification & setReachbilityTimeFormulasAllowed(bool newValue)
FragmentSpecification & setTimeAllowed(bool newValue)
FragmentSpecification & setStepBoundedCumulativeRewardFormulasAllowed(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 isOptimizationDirectionSet() const
Retrieves whether an optimization direction was set.
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 isProduceSchedulersSet() const
Retrieves whether scheduler(s) are to be produced (if supported).
storm::logic::Bound const & getBound() const
Retrieves the bound (if set).
storm::OptimizationDirection const & getOptimizationDirection() const
Retrieves the optimization direction (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 > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeCumulativeRewards(Environment const &env, CheckTask< storm::logic::CumulativeRewardFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, 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 > checkMultiObjectiveFormula(Environment const &env, CheckTask< storm::logic::MultiObjectiveFormula, SolutionType > const &checkTask) override
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 > computeGloballyProbabilities(Environment const &env, CheckTask< storm::logic::GloballyFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > checkQuantileFormula(Environment const &env, CheckTask< storm::logic::QuantileFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > checkLexObjectiveFormula(Environment const &env, CheckTask< storm::logic::MultiObjectiveFormula, SolutionType > const &checkTask) override
virtual bool canHandle(CheckTask< storm::logic::Formula, SolutionType > const &checkTask) const override
Determines whether the model checker can handle the given verification task.
virtual std::unique_ptr< CheckResult > computeReachabilityRewards(Environment const &env, CheckTask< storm::logic::EventuallyFormula, SolutionType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeHOAPathProbabilities(Environment const &env, CheckTask< storm::logic::HOAPathFormula, SolutionType > const &checkTask) override
typename std::conditional< std::is_same_v< ValueType, storm::Interval >, double, ValueType >::type SolutionType
virtual std::unique_ptr< CheckResult > computeInstantaneousRewards(Environment const &env, CheckTask< storm::logic::InstantaneousRewardFormula, 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 > computeTotalRewards(Environment const &env, CheckTask< storm::logic::TotalRewardFormula, SolutionType > const &checkTask) override
SparseMdpPrctlModelChecker(SparseMdpModelType const &model)
virtual std::unique_ptr< CheckResult > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, SolutionType > const &checkTask) override
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.
storm::storage::Scheduler< ValueType > extractScheduler(storm::models::sparse::Model< ValueType > const &model)
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.
static MDPSparseModelCheckingHelperReturnType< SolutionType > 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, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
static MDPSparseModelCheckingHelperReturnType< 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, bool produceScheduler, bool useMecBasedTechnique=false)
static std::unique_ptr< CheckResult > 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)
static MDPSparseModelCheckingHelperReturnType< SolutionType > 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, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
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 std::map< storm::storage::sparse::state_type, SolutionType > computeRewardBoundedValues(Environment const &env, OptimizationDirection dir, rewardbounded::MultiDimensionalRewardUnfolding< ValueType, true > &rewardUnfolding, storm::storage::BitVector const &initialStates)
static std::vector< SolutionType > computeNextProbabilities(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
static MDPSparseModelCheckingHelperReturnType< 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, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
static MDPSparseModelCheckingHelperReturnType< SolutionType > 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, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
storm::storage::Scheduler< ValueType > extractScheduler() const
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())
std::vector< std::vector< ValueType > > computeQuantile(Environment const &env)
This class defines which action is chosen in a particular state of a non-deterministic model.
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification prctlstar()
FragmentSpecification propositional()
FragmentSpecification lexObjective()
FragmentSpecification multiObjective()
FragmentSpecification reachability()
FragmentSpecification quantiles()
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.
helper::MDPSparseModelCheckingHelperReturnType< ValueType > check(Environment const &, SparseModelType const &model, CheckTask< storm::logic::MultiObjectiveFormula, ValueType > const &checkTask, CheckFormulaCallback const &formulaChecker)
check a lexicographic LTL-formula
std::unique_ptr< CheckResult > performMultiObjectiveModelChecking(Environment const &env, SparseModelType const &model, storm::logic::MultiObjectiveFormula const &formula)
FilteredRewardModel< RewardModelType > createFilteredRewardModel(RewardModelType const &baseRewardModel, storm::logic::RewardAccumulation const &acc, bool isDiscreteTimeModel)