26 STORM_LOG_THROW(this->currentCheckTask, storm::exceptions::InvalidStateException,
"Checking has been invoked but no property has been specified before.");
27 auto const& instantiatedModel = modelInstantiator.instantiate(valuation);
28 if (instantiatedModel.isExact()) {
29 STORM_LOG_THROW(instantiatedModel.getTransitionMatrix().isProbabilistic(storm::utility::zero<ConstantType>()),
30 storm::exceptions::InvalidArgumentException,
"Instantiation point is invalid as the transition matrix becomes non-stochastic.");
32 auto const& generalSettings = storm::settings::getModule<storm::settings::modules::GeneralSettings>();
33 STORM_LOG_THROW(instantiatedModel.getTransitionMatrix().isProbabilistic(storm::utility::convertNumber<ConstantType>(generalSettings.getPrecision())),
34 storm::exceptions::InvalidArgumentException,
"Instantiation point is invalid as the transition matrix becomes non-stochastic.");
41 return checkReachabilityProbabilityFormula(env, modelChecker);
47 return checkReachabilityRewardFormula(env, modelChecker);
55 return checkBoundedUntilFormula(env, modelChecker);
57 return modelChecker.
check(env, *this->currentCheckTask);
64 if (!this->currentCheckTask->getHint().isExplicitModelCheckerHint()) {
69 if (this->getInstantiationsAreGraphPreserving() && !hint.
hasMaybeStates()) {
71 std::vector<ConstantType> qualitativeResult;
72 if (this->currentCheckTask->getFormula().asOperatorFormula().hasQuantitativeResult()) {
73 auto newCheckTask = *this->currentCheckTask;
74 newCheckTask.setQualitative(
true);
75 newCheckTask.setOnlyInitialStatesRelevant(
false);
76 qualitativeResult = modelChecker.check(env, newCheckTask)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
78 auto newCheckTask = this->currentCheckTask->substituteFormula(this->currentCheckTask->getFormula().asOperatorFormula().getSubformula());
79 newCheckTask.setQualitative(
true);
80 newCheckTask.setOnlyInitialStatesRelevant(
false);
82 modelChecker.computeProbabilities(env, newCheckTask)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
84 storm::storage::BitVector maybeStates = storm::utility::vector::filter<ConstantType>(qualitativeResult, [](ConstantType
const& value) ->
bool {
85 return !(storm::utility::isZero<ConstantType>(value) || storm::utility::isOne<ConstantType>(value));
92 std::unique_ptr<CheckResult> result;
95 if (this->currentCheckTask->getFormula().asOperatorFormula().hasQuantitativeResult()) {
96 result = modelChecker.check(env, *this->currentCheckTask);
97 hint.
setResultHint(result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector());
99 auto newCheckTask = this->currentCheckTask->substituteFormula(this->currentCheckTask->getFormula().asOperatorFormula().getSubformula())
100 .setOnlyInitialStatesRelevant(
false);
101 std::unique_ptr<CheckResult> quantitativeResult = modelChecker.computeProbabilities(env, newCheckTask);
102 result = quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().compareAgainstBound(
103 this->currentCheckTask->getFormula().asOperatorFormula().getComparisonType(),
104 this->currentCheckTask->getFormula().asOperatorFormula().template getThresholdAs<ConstantType>());
105 hint.
setResultHint(std::move(quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()));
114 if (!this->currentCheckTask->getHint().isExplicitModelCheckerHint()) {
119 if (this->getInstantiationsAreGraphPreserving() && !hint.
hasMaybeStates()) {
121 std::vector<ConstantType> qualitativeResult;
122 if (this->currentCheckTask->getFormula().asOperatorFormula().hasQuantitativeResult()) {
123 auto newCheckTask = *this->currentCheckTask;
124 newCheckTask.setQualitative(
true);
125 newCheckTask.setOnlyInitialStatesRelevant(
false);
126 qualitativeResult = modelChecker.check(env, newCheckTask)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
128 auto newCheckTask = this->currentCheckTask->substituteFormula(this->currentCheckTask->getFormula().asOperatorFormula().getSubformula());
129 newCheckTask.setQualitative(
true);
130 newCheckTask.setOnlyInitialStatesRelevant(
false);
131 qualitativeResult = modelChecker.computeRewards(env, newCheckTask)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
133 storm::storage::BitVector maybeStates = storm::utility::vector::filter<ConstantType>(qualitativeResult, [](ConstantType
const& value) ->
bool {
134 return !(storm::utility::isZero<ConstantType>(value) || storm::utility::isInfinity<ConstantType>(value));
141 std::unique_ptr<CheckResult> result;
145 if (this->currentCheckTask->getFormula().asOperatorFormula().hasQuantitativeResult()) {
146 result = modelChecker.check(env, *this->currentCheckTask);
147 this->currentCheckTask->getHint().template asExplicitModelCheckerHint<ConstantType>().setResultHint(
148 result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector());
150 auto newCheckTask = this->currentCheckTask->substituteFormula(this->currentCheckTask->getFormula().asOperatorFormula().getSubformula())
151 .setOnlyInitialStatesRelevant(
false);
152 std::unique_ptr<CheckResult> quantitativeResult = modelChecker.computeRewards(env, newCheckTask);
153 result = quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().compareAgainstBound(
154 this->currentCheckTask->getFormula().asOperatorFormula().getComparisonType(),
155 this->currentCheckTask->getFormula().asOperatorFormula().template getThresholdAs<ConstantType>());
156 this->currentCheckTask->getHint().template asExplicitModelCheckerHint<ConstantType>().setResultHint(
157 std::move(quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()));
166 if (!this->currentCheckTask->getHint().isExplicitModelCheckerHint()) {
169 std::unique_ptr<CheckResult> result;
172 if (this->getInstantiationsAreGraphPreserving() && !hint.
hasMaybeStates()) {
175 if (this->currentCheckTask->getFormula().asOperatorFormula().hasQuantitativeResult()) {
176 result = modelChecker.check(env, *this->currentCheckTask);
177 hint.
setResultHint(result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector());
179 auto newCheckTask = this->currentCheckTask->substituteFormula(this->currentCheckTask->getFormula().asOperatorFormula().getSubformula())
180 .setOnlyInitialStatesRelevant(
false);
181 std::unique_ptr<CheckResult> quantitativeResult = modelChecker.computeProbabilities(env, newCheckTask);
182 result = quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().compareAgainstBound(
183 this->currentCheckTask->getFormula().asOperatorFormula().getComparisonType(),
184 this->currentCheckTask->getFormula().asOperatorFormula().template getThresholdAs<ConstantType>());
185 hint.
setResultHint(std::move(quantitativeResult->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()));
191 std::unique_ptr<CheckResult> subFormulaResult =
192 modelChecker.check(env, this->currentCheckTask->getFormula().asOperatorFormula().getSubformula().asBoundedUntilFormula().getRightSubformula());
193 maybeStates = maybeStates & ~(subFormulaResult->asExplicitQualitativeCheckResult().getTruthValuesVector());
197 result = modelChecker.check(env, *this->currentCheckTask);