20namespace modelchecker {
21template<
typename SparseMarkovAutomatonModelType>
27template<
typename ModelType>
29 bool* requiresSingleInitialState) {
39 auto multiObjectiveFragment =
45 if (checkTask.
getFormula().isInFragment(singleObjectiveFragment)) {
48 if (requiresSingleInitialState) {
49 *requiresSingleInitialState =
true;
56template<
typename SparseMarkovAutomatonModelType>
58 bool requiresSingleInitialState =
false;
59 if (canHandleStatic(checkTask, &requiresSingleInitialState)) {
60 return !requiresSingleInitialState || this->getModel().getInitialStates().getNumberOfSetBits() == 1;
66template<
typename SparseMarkovAutomatonModelType>
71 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
72 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
73 "Unable to compute time-bounded reachability probabilities in non-closed Markov automaton.");
74 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
77 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
81 "Currently step-bounded and reward-bounded properties on MAs are not supported.");
82 double lowerBound = 0;
83 double upperBound = 0;
90 upperBound = storm::utility::infinity<double>();
99template<
typename SparseMarkovAutomatonModelType>
104 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
105 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
112template<
typename SparseMarkovAutomatonModelType>
117 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
118 std::unique_ptr<CheckResult> subResultPointer = this->check(env, pathFormula.
getSubformula());
125 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(std::move(ret.scheduler));
130template<
typename SparseMarkovAutomatonModelType>
135 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
136 std::unique_ptr<CheckResult> leftResultPointer = this->check(env, pathFormula.
getLeftSubformula());
137 std::unique_ptr<CheckResult> rightResultPointer = this->check(env, pathFormula.
getRightSubformula());
142 env, checkTask.
getOptimizationDirection(), this->getModel().getTransitionMatrix(), this->getModel().getBackwardTransitions(),
146 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(std::move(ret.scheduler));
151template<
typename SparseMarkovAutomatonModelType>
160 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
167 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(
174template<
typename SparseMarkovAutomatonModelType>
180 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
186 return this->check(env, formula)->asExplicitQualitativeCheckResult().getTruthValuesVector();
192 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(
199template<
typename SparseMarkovAutomatonModelType>
204 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
205 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
206 "Unable to compute reachability rewards in non-closed Markov automaton.");
207 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
212 env, checkTask.
getOptimizationDirection(), this->getModel().getTransitionMatrix(), this->getModel().getBackwardTransitions(),
213 this->getModel().getExitRates(), this->getModel().getMarkovianStates(), rewardModel.get(), subResult.
getTruthValuesVector(),
217 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(std::move(ret.scheduler));
222template<
typename SparseMarkovAutomatonModelType>
226 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
227 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
228 "Unable to compute reachability rewards in non-closed Markov automaton.");
232 env, checkTask.
getOptimizationDirection(), this->getModel().getTransitionMatrix(), this->getModel().getBackwardTransitions(),
233 this->getModel().getExitRates(), this->getModel().getMarkovianStates(), rewardModel.get(), checkTask.
isProduceSchedulersSet());
236 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(std::move(ret.scheduler));
241template<
typename SparseMarkovAutomatonModelType>
246 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
247 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
248 "Unable to compute long-run average in non-closed Markov automaton.");
249 std::unique_ptr<CheckResult> subResultPointer = this->check(env, stateFormula);
253 this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRates());
264template<
typename SparseMarkovAutomatonModelType>
268 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
269 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
270 "Unable to compute long run average rewards in non-closed Markov automaton.");
274 this->getModel().getTransitionMatrix(), this->getModel().getMarkovianStates(), this->getModel().getExitRates());
285template<
typename SparseMarkovAutomatonModelType>
290 "Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model.");
291 STORM_LOG_THROW(this->getModel().isClosed(), storm::exceptions::InvalidPropertyException,
292 "Unable to compute expected times in non-closed Markov automaton.");
293 std::unique_ptr<CheckResult> subResultPointer = this->check(env, eventuallyFormula.
getSubformula());
297 env, checkTask.
getOptimizationDirection(), this->getModel().getTransitionMatrix(), this->getModel().getBackwardTransitions(),
301 result->asExplicitQuantitativeCheckResult<
ValueType>().setScheduler(std::move(ret.scheduler));
306template<
typename SparseMarkovAutomatonModelType>
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setTimeBoundedUntilFormulasAllowed(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)
ExplicitQualitativeCheckResult & asExplicitQualitativeCheckResult()
bool isOptimizationDirectionSet() const
Retrieves whether an optimization direction was set.
bool isQualitativeSet() const
Retrieves whether the computation only needs to be performed qualitatively, because the values will o...
FormulaType const & getFormula() const
Retrieves the formula from this task.
bool isProduceSchedulersSet() const
Retrieves whether scheduler(s) are to be produced (if supported).
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 > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, 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 > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLTLProbabilities(Environment const &env, CheckTask< storm::logic::PathFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, ValueType > const &checkTask) override
SparseMarkovAutomatonModelType::ValueType ValueType
virtual std::unique_ptr< CheckResult > checkMultiObjectiveFormula(Environment const &env, CheckTask< storm::logic::MultiObjectiveFormula, ValueType > const &checkTask) override
SparseMarkovAutomatonCslModelChecker(SparseMarkovAutomatonModelType const &model)
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const override
virtual std::unique_ptr< CheckResult > computeGloballyProbabilities(Environment const &env, CheckTask< storm::logic::GloballyFormula, 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 > computeNextProbabilities(Environment const &env, CheckTask< storm::logic::NextFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeHOAPathProbabilities(Environment const &env, CheckTask< storm::logic::HOAPathFormula, 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 > computeReachabilityTimes(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeReachabilityRewards(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ValueType > 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< ValueType > computeTotalRewards(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, RewardModelType const &rewardModel, bool produceScheduler)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeReachabilityRewards(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, RewardModelType const &rewardModel, storm::storage::BitVector const &psiStates, bool produceScheduler)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeUntilProbabilities(Environment const &env, OptimizationDirection dir, 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)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeReachabilityTimes(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, storm::storage::BitVector const &psiStates, bool produceScheduler)
static std::vector< ValueType > computeBoundedUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, std::pair< double, double > const &boundsPair)
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::vector< SolutionType > computeNextProbabilities(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
storm::storage::Scheduler< ValueType > extractScheduler() const
This class defines which action is chosen in a particular state of a non-deterministic model.
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification csrlstar()
FragmentSpecification multiObjective()
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.
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)