25template<
typename SparseCtmcModelType>
31template<
typename ModelType>
41 fragment.setBoundedUntilFormulasAllowed(
false).setCumulativeRewardFormulasAllowed(
false).setInstantaneousFormulasAllowed(
false);
43 return checkTask.
getFormula().isInFragment(fragment);
46template<
typename SparseCtmcModelType>
51template<
typename SparseCtmcModelType>
55 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Computing bounded until probabilities is not supported for this numeric type.");
65 "Currently step-bounded or reward-bounded properties on CTMCs are not supported.");
67 std::optional<ValueType> upperBound;
78 this->getModel().getExitRateVector(), checkTask.
isQualitativeSet(), lowerBound, upperBound);
83template<
typename SparseCtmcModelType>
87 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, pathFormula.
getSubformula());
94template<
typename SparseCtmcModelType>
98 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, pathFormula.
getSubformula());
100 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
108template<
typename SparseCtmcModelType>
118 STORM_LOG_INFO(
"Computing reachability probabilities with certificate ...");
119 std::optional<storm::storage::BitVector> constraintStates;
120 std::optional<std::string> constraintLabel;
125 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
130 return std::make_unique<ExplicitCertificateCheckResult<ValueType>>(std::move(certificate), std::move(allStates));
132 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Certificates are not implemented for this value type.");
142template<
typename SparseCtmcModelType>
147 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
152 return this->
check(env, formula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
155 std::vector<ValueType> numericResult =
helper.computeDAProductProbabilities(env, *pathFormula.
readAutomaton(), apSets);
160template<
typename SparseCtmcModelType>
165 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
170 return this->
check(env, formula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
172 std::vector<ValueType> numericResult =
helper.computeLTLProbabilities(env, pathFormula, formulaChecker);
177template<
typename SparseCtmcModelType>
181 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Computing instantaneous rewards is not supported for this numeric type.");
186 "Currently step-bounded properties on CTMCs are not supported.");
195template<
typename SparseCtmcModelType>
199 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Computing cumulative rewards is not supported for this numeric type.");
204 "Currently step-bounded and reward-bounded properties on CTMCs are not supported.");
213template<
typename SparseCtmcModelType>
217 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, eventuallyFormula.
getSubformula());
222 STORM_LOG_INFO(
"Computing reachability rewards with certificate ...");
223 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
224 auto weights = this->
getModel().getExitRateVector();
225 STORM_LOG_ASSERT(std::all_of(weights.begin(), weights.end(), [](
auto const& rate) { return rate > storm::utility::zero<ValueType>(); }),
226 "Exit rates of a CTMC must be positive.");
227 std::transform(weights.begin(), weights.end(), weights.begin(), [](
auto const& rate) { return storm::utility::one<ValueType>() / rate; });
228 auto rewardVector = rewardModel.get().getTotalActionRewardVector(probabilisticTransitions, weights);
230 env, std::nullopt, std::move(probabilisticTransitions), subResult.
getTruthValuesVector(), std::move(rewardVector),
233 return std::make_unique<ExplicitCertificateCheckResult<ValueType>>(std::move(certificate), std::move(allStates));
235 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Certificates are not implemented for this value type.");
245template<
typename SparseCtmcModelType>
255template<
typename SparseCtmcModelType>
259 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, stateFormula);
262 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
270template<
typename SparseCtmcModelType>
274 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
277 auto values =
helper.computeLongRunAverageRewards(env, rewardModel.get());
281template<
typename SparseCtmcModelType>
285 std::unique_ptr<CheckResult> subResultPointer = this->
check(env, eventuallyFormula.
getSubformula());
289 STORM_LOG_INFO(
"Computing reachability times with certificate ...");
290 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
291 auto weights = this->
getModel().getExitRateVector();
292 STORM_LOG_ASSERT(std::all_of(weights.begin(), weights.end(), [](
auto const& rate) { return rate > storm::utility::zero<ValueType>(); }),
293 "Exit rates of a CTMC must be positive.");
294 std::transform(weights.begin(), weights.end(), weights.begin(),
295 [](
auto const& rate) ->
ValueType { return storm::utility::one<ValueType>() / rate; });
300 return std::make_unique<ExplicitCertificateCheckResult<ValueType>>(std::move(certificate), std::move(allStates));
302 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Certificates are not implemented for this value type.");
311template<
typename SparseCtmcModelType>
315 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Computing transient probabilities is not supported for this numeric type.");
320 "Currently step-bounded or reward-bounded properties on CTMCs are not supported.");
321 STORM_LOG_THROW(pathFormula.
hasUpperBound(), storm::exceptions::NotImplementedException,
"Computation needs upper limit for time bound.");
336template<
typename SparseCtmcModelType>
339 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
343 std::vector<ValueType> result;
344 auto const& initialStates = this->
getModel().getInitialStates();
345 uint64_t numInitStates = initialStates.getNumberOfSetBits();
346 if (numInitStates == 1) {
347 result =
helper.computeLongRunAverageStateDistribution(env, *initialStates.begin());
349 STORM_LOG_WARN(
"Multiple initial states found. A uniform distribution over initial states is assumed.");
351 result =
helper.computeLongRunAverageStateDistribution(env, [&initialStates, &initProb](uint64_t
const& stateIndex) {
360template<
typename SparseCtmcModelType>
363 auto probabilisticTransitions = this->
getModel().computeProbabilityMatrix();
367 auto const& initialStates = this->
getModel().getInitialStates();
368 uint64_t numInitStates = initialStates.getNumberOfSetBits();
369 STORM_LOG_THROW(numInitStates > 0, storm::exceptions::InvalidOperationException,
"No initial states given. Cannot compute expected visiting times.");
370 STORM_LOG_WARN_COND(numInitStates == 1,
"Multiple initial states found. A uniform distribution over initial states is assumed.");
371 std::vector<ExtendedValueType> result =
helper.computeExpectedVisitingTimes(env, initialStates);
FragmentSpecification & setRewardAccumulationAllowed(bool newValue)
FragmentSpecification & setTimeOperatorsAllowed(bool newValue)
FragmentSpecification & setTotalRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageRewardFormulasAllowed(bool newValue)
FragmentSpecification & setLongRunAverageProbabilitiesAllowed(bool newValue)
FragmentSpecification & setTimeAllowed(bool newValue)
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
bool isProduceCertificateSet() const
Retrieves whether certificate(s) are to be produced (if supported).
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.
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 > computeCumulativeRewards(Environment const &env, CheckTask< storm::logic::CumulativeRewardFormula, 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 > computeReachabilityTimes(Environment const &env, CheckTask< storm::logic::EventuallyFormula, 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 std::unique_ptr< CheckResult > computeInstantaneousRewards(Environment const &env, CheckTask< storm::logic::InstantaneousRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeLongRunAverageProbabilities(Environment const &env, CheckTask< storm::logic::StateFormula, ValueType > const &checkTask) override
static bool canHandleStatic(CheckTask< storm::logic::Formula, ValueType > const &checkTask)
virtual std::unique_ptr< CheckResult > computeBoundedUntilProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, 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 > computeLongRunAverageRewards(Environment const &env, CheckTask< storm::logic::LongRunAverageRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeNextProbabilities(Environment const &env, CheckTask< storm::logic::NextFormula, ValueType > const &checkTask) override
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const override
SparseCtmcCslModelChecker(SparseCtmcModelType const &model)
std::unique_ptr< CheckResult > computeSteadyStateDistribution(Environment const &env)
Computes the long run average (or: steady state) distribution over all states Assumes a uniform distr...
SparseCtmcModelType::ValueType ValueType
virtual std::unique_ptr< CheckResult > computeTotalRewards(Environment const &env, CheckTask< storm::logic::TotalRewardFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeGloballyProbabilities(Environment const &env, CheckTask< storm::logic::GloballyFormula, ValueType > const &checkTask) override
std::vector< ValueType > computeAllTransientProbabilities(Environment const &env, CheckTask< storm::logic::BoundedUntilFormula, ValueType > const &checkTask)
Compute transient probabilities for all states.
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
virtual std::unique_ptr< CheckResult > computeHOAPathProbabilities(Environment const &env, CheckTask< storm::logic::HOAPathFormula, ValueType > const &checkTask) override
SparsePropositionalModelChecker(SparseCtmcModelType const &model)
SparseCtmcModelType const & getModel() const
static std::vector< ValueType > computeUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &phiStates, 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 &rateMatrix, std::vector< ValueType > const &exitRateVector, RewardModelType const &rewardModel, ValueType timeBound)
static std::vector< storm::utility::ExtendedValueType< ValueType > > computeReachabilityTimes(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &targetStates, bool qualitative)
static std::vector< ValueType > computeAllTransientProbabilities(Environment const &env, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::BitVector const &initialStates, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, std::vector< ValueType > const &exitRates, ValueType timeBound)
static std::vector< storm::utility::ExtendedValueType< ValueType > > computeReachabilityRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, RewardModelType const &rewardModel, storm::storage::BitVector const &targetStates, bool qualitative)
static std::vector< ValueType > computeBoundedUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, std::vector< ValueType > const &exitRates, bool qualitative, ValueType lowerBound, std::optional< ValueType > const &upperBound)
static std::vector< storm::utility::ExtendedValueType< ValueType > > computeTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, RewardModelType const &rewardModel, bool qualitative)
static std::vector< ValueType > computeNextProbabilities(Environment const &env, storm::storage::SparseMatrix< ValueType > const &rateMatrix, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &nextStates)
static std::vector< ValueType > computeInstantaneousRewards(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &rateMatrix, std::vector< ValueType > const &exitRateVector, RewardModelType const &rewardModel, ValueType timeBound)
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 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)
Helper class for LTL model checking.
A bit vector that is internally represented as a vector of 64-bit values.
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification csrlstar()
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.
constexpr bool SupportsCertificates
Certificates can be computed for models with these value types.
std::unique_ptr< ReachabilityRewardCertificate< ValueType > > computeReachabilityRewardCertificate(storm::Environment const &env, std::optional< storm::OptimizationDirection > dir, storm::storage::SparseMatrix< ValueType > const &transitionProbabilityMatrix, storm::storage::BitVector targetStates, std::vector< ValueType > stateActionRewardVector, std::string targetLabel, std::string rewardModelName)
Computes a certificate for expected rewards accumulated until reaching the target states.
std::unique_ptr< ReachabilityProbabilityCertificate< ValueType > > computeReachabilityProbabilityCertificate(storm::Environment const &env, std::optional< storm::OptimizationDirection > dir, storm::storage::SparseMatrix< ValueType > const &transitionProbabilityMatrix, storm::storage::BitVector targetStates, std::optional< storm::storage::BitVector > constraintStates, std::string targetLabel, std::optional< std::string > constraintLabel)
Computes a certificate for reachability probabilities (or constrained reachability probabilities if c...
FilteredRewardModel< RewardModelType > createFilteredRewardModel(RewardModelType const &baseRewardModel, storm::logic::RewardAccumulation const &acc, bool isDiscreteTimeModel)
TargetType convertNumber(SourceType const &number)
The contract of a DD backend.
static const bool SupportsExponential