Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseDtmcParameterLiftingModelChecker.cpp
Go to the documentation of this file.
2
3#include <memory>
4#include <vector>
5
33#include "storm/utility/graph.h"
37
38namespace storm {
39namespace modelchecker {
40
41template<typename SparseModelType, typename ConstantType, bool Robust>
43 : SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>(std::make_unique<GeneralSolverFactoryType<ConstantType, Robust>>()) {
44 // Intentionally left empty
45}
46
47template<typename SparseModelType, typename ConstantType, bool Robust>
49 std::unique_ptr<SolverFactoryType<ConstantType, Robust>>&& solverFactory)
50 : solverFactory(std::move(solverFactory)), solvingRequiresUpperRewardBounds(false) {
51 // Intentionally left empty
52}
53
54template<typename SparseModelType, typename ConstantType, bool Robust>
56 std::shared_ptr<storm::models::ModelBase> parametricModel, CheckTask<storm::logic::Formula, ParametricType> const& checkTask) const {
57 bool result = parametricModel->isOfType(storm::models::ModelType::Dtmc);
58 result &= parametricModel->isSparseModel();
59 result &= parametricModel->supportsParameters();
60 auto dtmc = parametricModel->template as<SparseModelType>();
61 result &= static_cast<bool>(dtmc);
62 result &= checkTask.getFormula().isInFragment(storm::logic::reachability()
72 return result;
73}
74
75template<typename SparseModelType, typename ConstantType, bool Robust>
77 Environment const& env, std::shared_ptr<storm::models::ModelBase> parametricModel, CheckTask<storm::logic::Formula, ParametricType> const& checkTask,
78 std::optional<RegionSplitEstimateKind> generateRegionSplitEstimates, std::shared_ptr<MonotonicityBackend<ParametricType>> monotonicityBackend,
79 bool allowModelSimplifications, bool graphPreserving) {
80 STORM_LOG_THROW(this->canHandle(parametricModel, checkTask), storm::exceptions::NotSupportedException,
81 "Combination of model " << parametricModel->getType() << " and formula '" << checkTask.getFormula() << "' is not supported.");
82 this->specifySplitEstimates(generateRegionSplitEstimates, checkTask);
83 this->specifyMonotonicity(monotonicityBackend, checkTask);
84 this->graphPreserving = graphPreserving;
85 auto dtmc = parametricModel->template as<SparseModelType>();
86 if (isOrderBasedMonotonicityBackend()) {
87 STORM_LOG_WARN_COND(!(allowModelSimplifications),
88 "Allowing model simplification when using order-based monotonicity is not useful, as for order-based monotonicity checking model "
89 "simplification is done as preprocessing"); // TODO: Find out where this preprocessing for monotonicity is done
90 getOrderBasedMonotonicityBackend().initializeMonotonicityChecker(dtmc->getTransitionMatrix());
91 }
92
93 reset();
94
95 if (allowModelSimplifications && graphPreserving) {
97 simplifier.setPreserveParametricTransitions(true);
98 if (!simplifier.simplify(checkTask.getFormula())) {
99 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
100 }
101 this->parametricModel = simplifier.getSimplifiedModel();
102 this->specifyFormula(env, checkTask.substituteFormula(*simplifier.getSimplifiedFormula()));
103 } else {
104 this->parametricModel = dtmc;
105 this->specifyFormula(env, checkTask);
106 }
107 if constexpr (!Robust) {
108 if (isOrderBasedMonotonicityBackend()) {
109 getOrderBasedMonotonicityBackend().registerParameterLifterReference(*parameterLifter);
110 getOrderBasedMonotonicityBackend().registerPLABoundFunction(
112 return this->computeQuantitativeValues(environment, region, dir); // sets known value bounds within the region
113 });
114 }
115 }
116 std::shared_ptr<storm::logic::Formula> formulaWithoutBounds = this->currentCheckTask->getFormula().clone();
117 formulaWithoutBounds->asOperatorFormula().removeBound();
118 this->currentFormulaNoBound = formulaWithoutBounds->asSharedPointer();
119 this->currentCheckTaskNoBound = std::make_unique<storm::modelchecker::CheckTask<storm::logic::Formula, ParametricType>>(*this->currentFormulaNoBound);
120 if (this->specifiedRegionSplitEstimateKind == RegionSplitEstimateKind::Derivative) {
121 this->derivativeChecker =
122 std::make_unique<storm::derivative::SparseDerivativeInstantiationModelChecker<ParametricType, ConstantType>>(*this->parametricModel);
123 this->derivativeChecker->specifyFormula(env, *this->currentCheckTaskNoBound);
124 }
125}
126
127template<typename SparseModelType, typename ConstantType, bool Robust>
130 STORM_LOG_ERROR_COND(!Robust, "Bounded until formulas not implemented for Robust PLA");
131 // get the step bound
132 STORM_LOG_THROW(!checkTask.getFormula().hasLowerBound(), storm::exceptions::NotSupportedException, "Lower step bounds are not supported.");
133 STORM_LOG_THROW(checkTask.getFormula().hasUpperBound(), storm::exceptions::NotSupportedException, "Expected a bounded until formula with an upper bound.");
134 STORM_LOG_THROW(checkTask.getFormula().getTimeBoundReference().isStepBound(), storm::exceptions::NotSupportedException,
135 "Expected a bounded until formula with step bounds.");
136 stepBound = checkTask.getFormula().getUpperBound().evaluateAsInt();
137 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
138 "Can not apply parameter lifting on step bounded formula: The step bound has to be positive.");
139 if (checkTask.getFormula().isUpperBoundStrict()) {
140 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException, "Expected a strict upper step bound that is greater than zero.");
141 --(*stepBound);
142 }
143 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
144 "Can not apply parameter lifting on step bounded formula: The step bound has to be positive.");
145
146 // get the results for the subformulas
147 storm::modelchecker::SparsePropositionalModelChecker<SparseModelType> propositionalChecker(*this->parametricModel);
148 STORM_LOG_THROW(propositionalChecker.canHandle(checkTask.getFormula().getLeftSubformula()) &&
149 propositionalChecker.canHandle(checkTask.getFormula().getRightSubformula()),
150 storm::exceptions::NotSupportedException, "Parameter lifting with non-propositional subformulas is not supported");
151 storm::storage::BitVector phiStates =
152 std::move(propositionalChecker.check(checkTask.getFormula().getLeftSubformula())->asExplicitQualitativeCheckResult().getTruthValuesVector());
153 storm::storage::BitVector psiStates =
154 std::move(propositionalChecker.check(checkTask.getFormula().getRightSubformula())->asExplicitQualitativeCheckResult().getTruthValuesVector());
155
156 // get the maybeStates
157 maybeStates = storm::utility::graph::performProbGreater0(this->parametricModel->getBackwardTransitions(), phiStates, psiStates, true, *stepBound);
158 maybeStates &= ~psiStates;
159
160 // set the result for all non-maybe states
161 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
162 storm::utility::vector::setVectorValues(resultsForNonMaybeStates, psiStates, storm::utility::one<ConstantType>());
163
164 // if there are maybestates, create the parameterLifter
165 if (Robust || !maybeStates.empty()) {
166 // Create the vector of one-step probabilities to go to target states.
167 std::vector<ParametricType> b = this->parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
168 storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getRowCount(), true), psiStates);
169 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
170 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, false, isOrderBasedMonotonicityBackend());
171 }
172
173 // We know some bounds for the results so set them
174 lowerResultBound = storm::utility::zero<ConstantType>();
175 upperResultBound = storm::utility::one<ConstantType>();
176 // No requirements for bounded formulas
177 solverFactory->setRequirementsChecked(true);
178
179 if (isOrderBasedMonotonicityBackend()) {
180 auto [prob0, prob1] = storm::utility::graph::performProb01(this->parametricModel->getBackwardTransitions(), phiStates, psiStates);
181 getOrderBasedMonotonicityBackend().initializeOrderExtender(prob1, prob0, this->parametricModel->getTransitionMatrix());
182 }
183}
184
185template<typename SparseModelType, typename ConstantType, bool Robust>
188 // get the results for the subformulas
189 storm::modelchecker::SparsePropositionalModelChecker<SparseModelType> propositionalChecker(*this->parametricModel);
190 STORM_LOG_THROW(propositionalChecker.canHandle(checkTask.getFormula().getLeftSubformula()) &&
191 propositionalChecker.canHandle(checkTask.getFormula().getRightSubformula()),
192 storm::exceptions::NotSupportedException, "Parameter lifting with non-propositional subformulas is not supported");
193 storm::storage::BitVector phiStates =
194 std::move(propositionalChecker.check(checkTask.getFormula().getLeftSubformula())->asExplicitQualitativeCheckResult().getTruthValuesVector());
195 storm::storage::BitVector psiStates =
196 std::move(propositionalChecker.check(checkTask.getFormula().getRightSubformula())->asExplicitQualitativeCheckResult().getTruthValuesVector());
197
198 // get the maybeStates
199 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
200 storm::utility::graph::performProb01(this->parametricModel->getBackwardTransitions(), phiStates, psiStates);
201 maybeStates = ~(statesWithProbability01.first | statesWithProbability01.second);
202
203 // set the result for all non-maybe states
204 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
205 storm::utility::vector::setVectorValues(resultsForNonMaybeStates, statesWithProbability01.second, storm::utility::one<ConstantType>());
206
207 // if there are maybestates, create the parameterLifter
208 if (Robust || !maybeStates.empty()) {
209 if constexpr (Robust) {
210 // Create the vector of one-step probabilities to go to target states.
211 // Robust PLA doesn't support eliminating states because it gets complicated with the polynomials you know
212 std::vector<ParametricType> target(this->parametricModel->getNumberOfStates(), storm::utility::zero<ParametricType>());
213 storm::storage::BitVector allTrue(maybeStates.size(), true);
214
215 if (!graphPreserving) {
216 storm::utility::vector::setVectorValues(target, psiStates, storm::utility::one<ParametricType>());
217 maybeStates = ~statesWithProbability01.first & ~psiStates;
218 } else {
219 storm::utility::vector::setVectorValues(target, statesWithProbability01.second, storm::utility::one<ParametricType>());
220 }
221
222 // With Robust PLA, we cannot drop the non-maybe states out of the matrix for technical reasons
223 auto rowFilter = this->parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
224 auto filteredMatrix = this->parametricModel->getTransitionMatrix().filterEntries(rowFilter);
225
226 maybeStates = allTrue;
227
228 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
229 filteredMatrix, target, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
230 } else {
231 // Create the vector of one-step probabilities to go to target states.
232 std::vector<ParametricType> b = this->parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
233 storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getRowCount(), true), statesWithProbability01.second);
234 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
235 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
236 isOrderBasedMonotonicityBackend());
237 }
238 }
239
240 // We know some bounds for the results so set them
241 lowerResultBound = storm::utility::zero<ConstantType>();
242 upperResultBound = storm::utility::one<ConstantType>();
243
244 // The solution of the min-max equation system will always be unique (assuming graph-preserving instantiations, every induced DTMC has the same graph
245 // structure).
246 auto req = solverFactory->getRequirements(env, true, true, boost::none, !Robust);
247 req.clearBounds();
248 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
249 "Solver requirements " + req.getEnabledRequirementsAsString() + " not checked.");
250 solverFactory->setRequirementsChecked(true);
251
252 if (isOrderBasedMonotonicityBackend()) {
253 getOrderBasedMonotonicityBackend().initializeOrderExtender(statesWithProbability01.second, statesWithProbability01.first,
254 this->parametricModel->getTransitionMatrix());
255 }
256}
257
258template<typename SparseModelType, typename ConstantType, bool Robust>
261 // get the results for the subformula
262 storm::modelchecker::SparsePropositionalModelChecker<SparseModelType> propositionalChecker(*this->parametricModel);
263 STORM_LOG_THROW(propositionalChecker.canHandle(checkTask.getFormula().getSubformula()), storm::exceptions::NotSupportedException,
264 "Parameter lifting with non-propositional subformulas is not supported");
265 storm::storage::BitVector targetStates =
266 std::move(propositionalChecker.check(checkTask.getFormula().getSubformula())->asExplicitQualitativeCheckResult().getTruthValuesVector());
267 // get the maybeStates
269 this->parametricModel->getBackwardTransitions(), storm::storage::BitVector(this->parametricModel->getNumberOfStates(), true), targetStates);
270 infinityStates.complement();
271 maybeStates = ~(targetStates | infinityStates);
272
273 // set the result for all the non-maybe states
274 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
275 storm::utility::vector::setVectorValues(resultsForNonMaybeStates, infinityStates, storm::utility::infinity<ConstantType>());
276
277 // if there are maybestates, create the parameterLifter
278 if (Robust || !maybeStates.empty()) {
279 // Create the reward vector
280 STORM_LOG_THROW((checkTask.isRewardModelSet() && this->parametricModel->hasRewardModel(checkTask.getRewardModel())) ||
281 (!checkTask.isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
282 storm::exceptions::InvalidPropertyException, "The reward model specified by the CheckTask is not available in the given model.");
283
284 typename SparseModelType::RewardModelType const& rewardModel =
285 checkTask.isRewardModelSet() ? this->parametricModel->getRewardModel(checkTask.getRewardModel()) : this->parametricModel->getUniqueRewardModel();
286
287 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->parametricModel->getTransitionMatrix());
288
289 if constexpr (Robust) {
290 storm::storage::BitVector allTrue(maybeStates.size(), true);
291 if (!graphPreserving) {
292 maybeStates = ~targetStates;
293 }
294 auto rowFilter = this->parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
295 auto filteredMatrix = this->parametricModel->getTransitionMatrix().filterEntries(rowFilter);
296 maybeStates = allTrue;
297
298 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
299 filteredMatrix, b, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
300 } else {
301 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
302 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
303 isOrderBasedMonotonicityBackend());
304 }
305 }
306
307 // We only know a lower bound for the result
308 lowerResultBound = storm::utility::zero<ConstantType>();
309
310 // The solution of the min-max equation system will always be unique (assuming graph-preserving instantiations, every induced DTMC has the same graph
311 // structure).
312 auto req = solverFactory->getRequirements(env, true, true, boost::none, !Robust);
313 req.clearLowerBounds();
314 if (req.upperBounds()) {
315 solvingRequiresUpperRewardBounds = true;
316 req.clearUpperBounds();
317 }
318 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
319 "Solver requirements " + req.getEnabledRequirementsAsString() + " not checked.");
320 solverFactory->setRequirementsChecked(true);
321 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(), "Order-based monotonicity not used for reachability reward formula.");
322}
323
324template<typename SparseModelType, typename ConstantType, bool Robust>
327 STORM_LOG_ERROR_COND(!Robust, "Not implemented for robust mode.");
328 // Obtain the stepBound
329 stepBound = checkTask.getFormula().getBound().evaluateAsInt();
330 if (checkTask.getFormula().isBoundStrict()) {
331 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException, "Expected a strict upper step bound that is greater than zero.");
332 --(*stepBound);
333 }
334 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
335 "Can not apply parameter lifting on step bounded formula: The step bound has to be positive.");
336
337 // Every state is a maybeState
338 maybeStates = storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getColumnCount(), true);
339 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates());
340
341 // Create the reward vector
342 STORM_LOG_THROW((checkTask.isRewardModelSet() && this->parametricModel->hasRewardModel(checkTask.getRewardModel())) ||
343 (!checkTask.isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
344 storm::exceptions::InvalidPropertyException, "The reward model specified by the CheckTask is not available in the given model.");
345 typename SparseModelType::RewardModelType const& rewardModel =
346 checkTask.isRewardModelSet() ? this->parametricModel->getRewardModel(checkTask.getRewardModel()) : this->parametricModel->getUniqueRewardModel();
347 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->parametricModel->getTransitionMatrix());
348
349 parameterLifter =
350 std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates);
351 // We only know a lower bound for the result
352 lowerResultBound = storm::utility::zero<ConstantType>();
353
354 // No requirements for bounded reward formula
355 solverFactory->setRequirementsChecked(true);
356
357 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(), "Order-based monotonicity not used for cumulative reward formula.");
358}
359
360template<typename SparseModelType, typename ConstantType, bool Robust>
363 if (!instantiationCheckerSAT) {
364 instantiationCheckerSAT =
365 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
366 instantiationCheckerSAT->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
367 : this->currentCheckTask->template convertValueType<ParametricType>());
368 instantiationCheckerSAT->setInstantiationsAreGraphPreserving(true);
369 }
370 return *instantiationCheckerSAT;
371}
372
373template<typename SparseModelType, typename ConstantType, bool Robust>
376 if (!instantiationCheckerVIO) {
377 instantiationCheckerVIO =
378 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
379 instantiationCheckerVIO->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
380 : this->currentCheckTask->template convertValueType<ParametricType>());
381 instantiationCheckerVIO->setInstantiationsAreGraphPreserving(true);
382 }
383 return *instantiationCheckerVIO;
384}
385
386template<typename SparseModelType, typename ConstantType, bool Robust>
389 if (!instantiationChecker) {
390 instantiationChecker =
391 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
392 instantiationChecker->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
393 : this->currentCheckTask->template convertValueType<ParametricType>());
394 instantiationChecker->setInstantiationsAreGraphPreserving(true);
395 }
396 return *instantiationChecker;
397}
398
399template<typename SparseModelType, typename ConstantType, bool Robust>
401 Environment const& env, AnnotatedRegion<ParametricType>& region, storm::solver::OptimizationDirection const& dirForParameters) {
402 if (maybeStates.empty()) {
403 this->updateKnownValueBoundInRegion(region, dirForParameters, resultsForNonMaybeStates);
404 return resultsForNonMaybeStates;
405 }
406 parameterLifter->specifyRegion(region.region, dirForParameters);
407 auto liftedMatrix = parameterLifter->getMatrix();
408 auto liftedVector = parameterLifter->getVector();
409 bool nonTrivialEndComponents = false;
410 if constexpr (Robust) {
411 if (parameterLifter->isCurrentRegionAllIllDefined()) {
412 return std::vector<ConstantType>();
413 }
414 if (!graphPreserving) {
415 transformer::IntervalEndComponentPreserver endComponentPreserver;
416 auto const& result = endComponentPreserver.eliminateMECs(liftedMatrix, liftedVector);
417 if (result) {
418 // std::cout << liftedMatrix << std::endl;
419 // std::cout << *result << std::endl;
420 liftedMatrix = *result;
421 nonTrivialEndComponents = true;
422 }
423 }
424 }
425 const uint64_t resultVectorSize = liftedMatrix.getColumnCount();
426
427 if (stepBound) {
428 if constexpr (!Robust) {
429 assert(*stepBound > 0);
430 x = std::vector<ConstantType>(resultVectorSize, storm::utility::zero<ConstantType>());
431 auto multiplier = storm::solver::MultiplierFactory<ConstantType>().create(env, liftedMatrix);
432 multiplier->repeatedMultiplyAndReduce(env, dirForParameters, x, &liftedVector, *stepBound);
433 } else {
434 STORM_LOG_ERROR("Cannot check step-bounded formulas in robust mode.");
435 }
436 } else {
437 auto solver = solverFactory->create(env, liftedMatrix);
438 solver->setHasUniqueSolution();
439 solver->setHasNoEndComponents();
440 // Uncertainty is not robust (=adversarial)
441 solver->setUncertaintyResolutionMode(UncertaintyResolutionMode::Cooperative);
442 if (lowerResultBound)
443 solver->setLowerBound(lowerResultBound.value());
444 if (upperResultBound) {
445 solver->setUpperBound(upperResultBound.value());
446 } else if (solvingRequiresUpperRewardBounds) {
447 if constexpr (!Robust) {
448 // For the min-case, we use DS-MPI, for the max-case variant 2 of the Baier et al. paper (CAV'17).
449 std::vector<ConstantType> oneStepProbs;
450 oneStepProbs.reserve(liftedMatrix.getRowCount());
451 for (uint64_t row = 0; row < liftedMatrix.getRowCount(); ++row) {
452 oneStepProbs.push_back(storm::utility::one<ConstantType>() - liftedMatrix.getRowSum(row));
453 }
454 if (dirForParameters == storm::OptimizationDirection::Minimize) {
455 storm::modelchecker::helper::DsMpiMdpUpperRewardBoundsComputer<ConstantType> dsmpi(liftedMatrix, liftedVector, oneStepProbs);
456 solver->setUpperBounds(dsmpi.computeUpperBounds());
457 } else {
458 storm::modelchecker::helper::BaierUpperRewardBoundsComputer<ConstantType> baier(liftedMatrix, liftedVector, oneStepProbs);
459 solver->setUpperBound(baier.computeUpperBound());
460 }
461 } else {
462 STORM_LOG_ERROR("Cannot use upper reward bounds in robust mode.");
463 }
464 }
465 solver->setTrackScheduler(true);
466
467 // Get reference to relevant scheduler choices
468 auto& choices = storm::solver::minimize(dirForParameters) ? minSchedChoices : maxSchedChoices;
469
470 // Potentially fix some choices if order based monotonicity is known
471 if constexpr (!Robust) {
472 storm::storage::BitVector statesWithFixedChoice;
473 if (isOrderBasedMonotonicityBackend()) {
474 // Ensure choices are initialized
475 if (!choices.has_value()) {
476 choices.emplace(parameterLifter->getRowGroupCount(), 0u);
477 }
478 statesWithFixedChoice = getOrderBasedMonotonicityBackend().getChoicesToFixForPLASolver(region, dirForParameters, *choices);
479 }
480
481 // Set initial scheduler
482 if (choices.has_value()) {
483 solver->setInitialScheduler(std::move(choices.value()));
484 if (statesWithFixedChoice.size() != 0) {
485 // Choices need to be fixed after setting a scheduler
486 solver->setSchedulerFixedForRowGroup(std::move(statesWithFixedChoice));
487 }
488 }
489 } else {
490 // Set initial scheduler
491 if (!nonTrivialEndComponents && choices.has_value()) {
492 solver->setInitialScheduler(std::move(choices.value()));
493 }
494 }
495
496 if (this->currentCheckTask->isBoundSet() && solver->hasInitialScheduler()) {
497 // If we reach this point, we know that after applying the hint, the x-values can only become larger (if we maximize) or smaller (if we
498 // minimize).
499 std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond;
500 storm::storage::BitVector relevantStatesInSubsystem = this->currentCheckTask->isOnlyInitialStatesRelevantSet()
501 ? this->parametricModel->getInitialStates() % maybeStates
502 : storm::storage::BitVector(maybeStates.getNumberOfSetBits(), true);
503 if (storm::solver::minimize(dirForParameters)) {
504 // Terminate if the value for ALL relevant states is already below the threshold
505 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumBelowThreshold<ConstantType>>(
506 relevantStatesInSubsystem, true, this->currentCheckTask->getBoundThreshold(), false);
507 } else {
508 // Terminate if the value for ALL relevant states is already above the threshold
509 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumExceedsThreshold<ConstantType>>(
510 relevantStatesInSubsystem, true, this->currentCheckTask->getBoundThreshold(), true);
511 }
512 solver->setTerminationCondition(std::move(termCond));
513 }
514
515 // Invoke the solver
516 x.resize(resultVectorSize, storm::utility::zero<ConstantType>());
517 solver->solveEquations(env, dirForParameters, x, liftedVector);
518 if (isValueDeltaRegionSplitEstimates()) {
519 computeStateValueDeltaRegionSplitEstimates(env, x, solver->getSchedulerChoices(), region.region, dirForParameters);
520 }
521 // Store choices for next time, if we have no non-trivial end components
522 if (!nonTrivialEndComponents) {
523 choices = solver->getSchedulerChoices();
524 }
525 }
526
527 // Get the result for the complete model (including maybestates)
528 std::vector<ConstantType> result = resultsForNonMaybeStates;
529 auto maybeStateResIt = x.begin();
530 for (auto const& maybeState : maybeStates) {
531 result[maybeState] = *maybeStateResIt;
532 ++maybeStateResIt;
533 }
534
535 STORM_LOG_INFO(dirForParameters << " " << region.region << ": " << result[this->getUniqueInitialState()] << std::endl);
536
537 this->updateKnownValueBoundInRegion(region, dirForParameters, result);
538 return result;
539}
540
541template<typename SparseModelType, typename ConstantType, bool Robust>
543 Environment const& env, std::vector<ConstantType> const& quantitativeResult, std::vector<uint64_t> const& schedulerChoices,
545 auto const& matrix = parameterLifter->getMatrix();
546 auto const& vector = parameterLifter->getVector();
547
548 std::vector<ConstantType> weighting = std::vector<ConstantType>(vector.size(), utility::one<ConstantType>());
549 if (this->specifiedRegionSplitEstimateKind == RegionSplitEstimateKind::StateValueDeltaWeighted) {
550 // Instantiated on center, instantiate on choices instead?
551 // Kinda complicated tho
553 auto const instantiatedModel = instantiator.instantiate(region.getCenterPoint());
554 helper::SparseDeterministicVisitingTimesHelper<ConstantType> visitingTimesHelper(instantiatedModel.getTransitionMatrix());
555 auto const visitingTimes = visitingTimesHelper.computeExpectedVisitingTimes(env, this->parametricModel->getInitialStates());
556 uint64_t rowIndex = 0;
557 for (auto const& state : maybeStates) {
558 weighting[rowIndex++] = visitingTimes[state];
559 }
560 }
561
562 switch (*this->specifiedRegionSplitEstimateKind) {
565 std::map<VariableType, ConstantType> deltaLower, deltaUpper;
566 for (auto const& p : region.getVariables()) {
567 deltaLower.emplace(p, storm::utility::zero<ConstantType>());
568 deltaUpper.emplace(p, storm::utility::zero<ConstantType>());
569 }
570 if constexpr (Robust) {
571 // Cache all derivatives of functions that turn up in pMC
572 static std::map<RationalFunction, RationalFunction> functionDerivatives;
573 static std::vector<std::pair<bool, double>> constantDerivatives;
574 if (constantDerivatives.empty()) {
575 for (uint64_t state : maybeStates) {
576 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
577 if (variables.size() == 0) {
578 continue;
579 }
580 STORM_LOG_ERROR_COND(variables.size() == 1,
581 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
582 auto const p = *variables.begin();
583 for (auto const& entry : this->parametricModel->getTransitionMatrix().getRow(state)) {
584 auto const& function = entry.getValue();
585 if (functionDerivatives.count(function)) {
586 constantDerivatives.emplace_back(false, 0);
587 continue;
588 }
589 auto const derivative = function.derivative(p);
590 if (derivative.isConstant()) {
591 constantDerivatives.emplace_back(true, utility::convertNumber<double>(derivative.constantPart()));
592 } else if (!storm::transformer::BigStep::lastSavedAnnotations.count(entry.getValue())) {
593 functionDerivatives.emplace(function, derivative);
594 constantDerivatives.emplace_back(false, 0);
595 } else {
596 constantDerivatives.emplace_back(false, 0);
597 }
598 }
599 }
600 }
601
602 cachedRegionSplitEstimates.clear();
603 for (auto const& p : region.getVariables()) {
604 cachedRegionSplitEstimates.emplace(p, utility::zero<ConstantType>());
605 }
606
607 uint64_t entryCount = 0;
608 // Assumption: Only one parameter per state
609 for (uint64_t state : maybeStates) {
610 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
611 if (variables.size() == 0) {
612 continue;
613 }
614 STORM_LOG_ERROR_COND(variables.size() == 1,
615 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
616
617 auto const p = *variables.begin();
618
619 const uint64_t rowIndex = maybeStates.getNumberOfSetBitsBeforeIndex(state);
620
621 std::vector<ConstantType> derivatives;
622 for (auto const& entry : this->parametricModel->getTransitionMatrix().getRow(state)) {
623 if (storm::transformer::BigStep::lastSavedAnnotations.count(entry.getValue())) {
624 auto& annotation = storm::transformer::BigStep::lastSavedAnnotations.at(entry.getValue());
625 ConstantType derivative =
626 annotation.derivative()->template evaluate<ConstantType>(utility::convertNumber<ConstantType>(region.getCenter(p)));
627 derivatives.push_back(derivative);
628 } else {
629 auto const& cDer = constantDerivatives.at(entryCount);
630 if (cDer.first) {
631 derivatives.push_back(cDer.second);
632 } else {
633 CoefficientType derivative = functionDerivatives.at(entry.getValue()).evaluate(region.getCenterPoint());
634 derivatives.push_back(utility::convertNumber<ConstantType>(derivative));
635 }
636 }
637 entryCount++;
638 }
639
640 std::vector<ConstantType> results(0);
641
642 ConstantType distrToNegativeDerivative = storm::utility::zero<ConstantType>();
643 ConstantType distrToPositiveDerivative = storm::utility::zero<ConstantType>();
644
645 for (auto const& direction : {OptimizationDirection::Maximize, OptimizationDirection::Minimize}) {
646 // Do a step of robust value iteration
647 // TODO I think it is a problem if we have probabilities and a state that is going to the vector, we don't count that
648 // Currently "fixed in preprocessing"
649 // It's different for rewards (same problem in ValueIterationOperator.h, search for word "octopus" in codebase)
650 ConstantType remainingValue = utility::one<ConstantType>();
651 ConstantType result = utility::zero<ConstantType>();
652
653 STORM_LOG_ASSERT(vector[rowIndex].upper() == vector[rowIndex].lower(),
654 "Non-constant vector indices not supported (this includes parametric rewards).");
655
656 std::vector<std::pair<ConstantType, std::pair<ConstantType, uint64_t>>> robustOrder;
657
658 uint64_t index = 0;
659 for (auto const& entry : matrix.getRow(rowIndex)) {
660 auto const lower = entry.getValue().lower();
661 result += quantitativeResult[entry.getColumn()] * lower;
662 remainingValue -= lower;
663 auto const diameter = entry.getValue().upper() - lower;
664 if (!storm::utility::isZero(diameter)) {
665 robustOrder.emplace_back(quantitativeResult[entry.getColumn()], std::make_pair(diameter, index));
666 }
667 index++;
668 }
669
670 std::sort(robustOrder.begin(), robustOrder.end(),
671 [direction](const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& a,
672 const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& b) {
673 if (direction == OptimizationDirection::Maximize) {
674 return a.first > b.first;
675 } else {
676 return a.first < b.first;
677 }
678 });
679
680 for (auto const& pair : robustOrder) {
681 auto availableMass = std::min(pair.second.first, remainingValue);
682 result += availableMass * pair.first;
683 // TODO hardcoded precision
684 if (direction == this->currentCheckTask->getOptimizationDirection()) {
685 if (derivatives[pair.second.second] > 1e-6) {
686 distrToPositiveDerivative += availableMass;
687 } else if (derivatives[pair.second.second] < 1e-6) {
688 distrToNegativeDerivative += availableMass;
689 }
690 }
691 remainingValue -= availableMass;
692 }
693
694 results.push_back(result);
695 }
696
697 ConstantType diff = std::abs(results[0] - results[1]);
698 if (distrToPositiveDerivative > distrToNegativeDerivative) { // Choose as upper
699 deltaUpper[p] += diff * weighting[rowIndex];
700 } else { // Choose as lower
701 deltaLower[p] += diff * weighting[rowIndex];
702 }
703 }
704 } else {
705 auto const& choiceValuations = parameterLifter->getRowLabels();
706
707 std::vector<ConstantType> stateResults;
708 for (uint64_t state = 0; state < schedulerChoices.size(); ++state) {
709 uint64_t rowOffset = matrix.getRowGroupIndices()[state];
710 uint64_t optimalChoice = schedulerChoices[state];
711 auto const& optimalChoiceVal = choiceValuations[rowOffset + optimalChoice];
712 assert(optimalChoiceVal.getUnspecifiedParameters().empty());
713 stateResults.clear();
714 for (uint64_t row = rowOffset; row < matrix.getRowGroupIndices()[state + 1]; ++row) {
715 stateResults.push_back(matrix.multiplyRowWithVector(row, quantitativeResult) + vector[row]);
716 }
717 // Do this twice, once for upperbound once for lowerbound
718 bool checkUpperParameters = false;
719 do {
720 auto const& consideredParameters = checkUpperParameters ? optimalChoiceVal.getUpperParameters() : optimalChoiceVal.getLowerParameters();
721 for (auto const& p : consideredParameters) {
722 // Find the 'best' choice that assigns the parameter to the other bound
723 ConstantType bestValue = 0;
724 bool foundBestValue = false;
725 for (uint64_t choice = 0; choice < stateResults.size(); ++choice) {
726 if (choice != optimalChoice) {
727 auto const& otherBoundParsOfChoice = checkUpperParameters ? choiceValuations[rowOffset + choice].getLowerParameters()
728 : choiceValuations[rowOffset + choice].getUpperParameters();
729 if (otherBoundParsOfChoice.find(p) != otherBoundParsOfChoice.end()) {
730 ConstantType const& choiceValue = stateResults[choice];
731 if (!foundBestValue ||
732 (storm::solver::minimize(dirForParameters) ? choiceValue < bestValue : choiceValue > bestValue)) {
733 foundBestValue = true;
734 bestValue = choiceValue;
735 }
736 }
737 }
738 }
739 auto const& optimal = stateResults[optimalChoice];
740 auto diff = storm::utility::abs<ConstantType>(optimal - storm::utility::convertNumber<ConstantType>(bestValue));
741 if (foundBestValue) {
742 if (checkUpperParameters) {
743 deltaLower[p] += diff * weighting[state];
744 } else {
745 deltaUpper[p] += diff * weighting[state];
746 }
747 }
748 }
749 checkUpperParameters = !checkUpperParameters;
750 } while (checkUpperParameters);
751 }
752 }
753
754 cachedRegionSplitEstimates.clear();
755 for (auto const& p : region.getVariables()) {
756 // TODO: previously, the reginSplitEstimates were only used in splitting if at least one parameter is possibly monotone. Why?
757 auto minDelta = std::min(deltaLower[p], deltaUpper[p]);
758 cachedRegionSplitEstimates.emplace(p, minDelta);
759 }
760
761 // large regionsplitestimate implies that parameter p occurs as p and 1-p at least once
762 break;
763 }
766 *this->parametricModel);
767 instantiationModelChecker.specifyFormula(*this->currentCheckTaskNoBound);
768
769 auto const center = region.getCenterPoint();
770
771 std::unique_ptr<storm::modelchecker::CheckResult> result = instantiationModelChecker.check(env, center);
772 auto const reachabilityProbabilities = result->asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
773
774 STORM_LOG_ASSERT(this->derivativeChecker, "Derivative checker not intialized");
775
776 for (auto const& param : region.getVariables()) {
777 auto result = this->derivativeChecker->check(env, center, param, reachabilityProbabilities);
778 ConstantType derivative =
779 result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()[this->derivativeChecker->getInitialState()];
780 cachedRegionSplitEstimates[param] = utility::abs(derivative) * utility::convertNumber<ConstantType>(region.getDifference(param));
781 }
782 break;
783 }
784 default:
785 STORM_LOG_ERROR("Region split estimate kind not handled by SparseDtmcParameterLiftingModelChecker.");
786 }
787}
788
789template<typename SparseModelType, typename ConstantType, bool Robust>
791 maybeStates.resize(0);
792 resultsForNonMaybeStates.clear();
793 stepBound = std::nullopt;
794 instantiationChecker = nullptr;
795 instantiationCheckerSAT = nullptr;
796 instantiationCheckerVIO = nullptr;
797 parameterLifter = nullptr;
798 minSchedChoices = std::nullopt;
799 maxSchedChoices = std::nullopt;
800 x.clear();
801 lowerResultBound = std::nullopt;
802 upperResultBound = std::nullopt;
803 cachedRegionSplitEstimates.clear();
804}
805
806template<typename ConstantType>
807std::optional<storm::storage::Scheduler<ConstantType>> getSchedulerHelper(std::optional<std::vector<uint64_t>> const& choices) {
808 std::optional<storm::storage::Scheduler<ConstantType>> result;
809 if (choices) {
810 result.emplace(choices->size());
811 uint64_t state = 0;
812 for (auto const& choice : choices.value()) {
813 result->setChoice(choice, state);
814 ++state;
815 }
816 }
817 return result;
818}
819
820template<typename SparseModelType, typename ConstantType, bool Robust>
822 return getSchedulerHelper<ConstantType>(minSchedChoices);
823}
824
825template<typename SparseModelType, typename ConstantType, bool Robust>
827 return getSchedulerHelper<ConstantType>(maxSchedChoices);
828}
829
831 if (f.isOperatorFormula()) {
832 auto const& sub = f.asOperatorFormula().getSubformula();
833 return sub.isUntilFormula() || sub.isEventuallyFormula();
834 }
835 return false;
836}
837
840 auto const& sub = f.asProbabilityOperatorFormula().getSubformula();
841 return sub.isUntilFormula() || sub.isEventuallyFormula() || sub.isBoundedUntilFormula();
842 }
843 return false;
844}
845
846template<typename SparseModelType, typename ConstantType, bool Robust>
851 (kind == RegionSplitEstimateKind::StateValueDelta || kind == RegionSplitEstimateKind::StateValueDeltaWeighted)) ||
852 kind == RegionSplitEstimateKind::Derivative;
853}
854
855template<typename SparseModelType, typename ConstantType, bool Robust>
861
862template<typename SparseModelType, typename ConstantType, bool Robust>
863std::vector<typename SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::CoefficientType>
865 std::set<VariableType> const& relevantParameters) const {
866 if (isValueDeltaRegionSplitEstimates()) {
867 // Cached region split estimates are value-delta
868 std::vector<CoefficientType> result;
869 for (auto const& par : relevantParameters) {
870 auto est = cachedRegionSplitEstimates.find(par);
871 STORM_LOG_ASSERT(est != cachedRegionSplitEstimates.end(),
872 "Requested region split estimate for parameter " << par.name() << " but none was generated.");
873 result.push_back(storm::utility::convertNumber<CoefficientType>(est->second));
874 }
875 return result;
876 } else {
877 // Call super method, which might support the estimate type
879 }
880}
881
882template<typename SparseModelType, typename ConstantType, bool Robust>
892
893template<typename SparseModelType, typename ConstantType, bool Robust>
895 return dynamic_cast<OrderBasedMonotonicityBackend<ParametricType, ConstantType>*>(this->monotonicityBackend.get()) != nullptr;
896}
897
898template<typename SparseModelType, typename ConstantType, bool Robust>
899OrderBasedMonotonicityBackend<typename SparseModelType::ValueType, ConstantType>&
900SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::getOrderBasedMonotonicityBackend() {
901 return dynamic_cast<OrderBasedMonotonicityBackend<ParametricType, ConstantType>&>(*this->monotonicityBackend);
902}
903
904template<typename SparseModelType, typename ConstantType, bool Robust>
905bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isValueDeltaRegionSplitEstimates() const {
906 return this->getSpecifiedRegionSplitEstimateKind().has_value() &&
907 (this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDelta ||
908 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDeltaWeighted ||
909 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::Derivative);
910}
911
912template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double, false>;
913template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double, true>;
914template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::RationalNumber, false>;
915} // namespace modelchecker
916} // namespace storm
virtual bool isOperatorFormula() const
Definition Formula.cpp:188
virtual bool isProbabilityOperatorFormula() const
Definition Formula.cpp:180
ProbabilityOperatorFormula & asProbabilityOperatorFormula()
Definition Formula.cpp:476
OperatorFormula & asOperatorFormula()
Definition Formula.cpp:492
virtual bool isUntilFormula() const
Definition Formula.cpp:80
FragmentSpecification & setStepBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setTimeBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setReachabilityRewardFormulasAllowed(bool newValue)
FragmentSpecification & setRewardOperatorsAllowed(bool newValue)
FragmentSpecification & setBoundedUntilFormulasAllowed(bool newValue)
FragmentSpecification & setTimeBoundedCumulativeRewardFormulasAllowed(bool newValue)
FragmentSpecification & setStepBoundedCumulativeRewardFormulasAllowed(bool newValue)
Formula const & getSubformula() const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
CheckTask< NewFormulaType, ValueType > substituteFormula(NewFormulaType const &newFormula) const
Copies the check task from the source while replacing the formula with the new one.
Definition CheckTask.h:54
bool isRewardModelSet() const
Retrieves whether a reward model was set.
Definition CheckTask.h:192
std::string const & getRewardModel() const
Retrieves the reward model over which to perform the checking (if set).
Definition CheckTask.h:199
FormulaType const & getFormula() const
Retrieves the formula from this task.
Definition CheckTask.h:142
virtual bool requiresInteractionWithRegionModelChecker() const
Returns true, if a region model checker needs to implement specific methods to properly use this back...
Class to efficiently check a formula on a parametric model with different parameter instantiations.
virtual std::unique_ptr< CheckResult > check(Environment const &env, storm::utility::parametric::Valuation< typename SparseModelType::ValueType > const &valuation) override
typename RegionModelChecker< ParametricType >::CoefficientType CoefficientType
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationCheckerSAT(bool qualitative) override
virtual bool canHandle(std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const override
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationCheckerVIO(bool qualitative) override
virtual void specify(Environment const &env, std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, ParametricType > const &checkTask, std::optional< RegionSplitEstimateKind > generateRegionSplitEstimates=std::nullopt, std::shared_ptr< MonotonicityBackend< ParametricType > > monotonicityBackend={}, bool allowModelSimplifications=true, bool graphPreserving=true) override
virtual void specifyBoundedUntilFormula(const CheckTask< storm::logic::BoundedUntilFormula, ConstantType > &checkTask) override
virtual std::vector< ConstantType > computeQuantitativeValues(Environment const &env, AnnotatedRegion< ParametricType > &region, storm::solver::OptimizationDirection const &dirForParameters) override
virtual void specifyCumulativeRewardFormula(const CheckTask< storm::logic::CumulativeRewardFormula, ConstantType > &checkTask) override
void computeStateValueDeltaRegionSplitEstimates(Environment const &env, std::vector< ConstantType > const &quantitativeResult, std::vector< uint64_t > const &schedulerChoices, storm::storage::ParameterRegion< ParametricType > const &region, storm::solver::OptimizationDirection const &dirForParameters)
virtual void specifyReachabilityRewardFormula(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ConstantType > const &checkTask) override
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationChecker(bool qualitative) override
virtual void specifyUntilFormula(Environment const &env, CheckTask< storm::logic::UntilFormula, ConstantType > const &checkTask) override
Class to efficiently check a formula on a parametric model with different parameter instantiations.
void specifyFormula(CheckTask< storm::logic::Formula, typename SparseModelType::ValueType > const &checkTask)
virtual bool canHandle(CheckTask< storm::logic::Formula, SolutionType > const &checkTask) const override
Determines whether the model checker can handle the given verification task.
ValueType computeUpperBound()
Computes an upper bound on the expected rewards.
std::vector< ValueType > computeUpperBounds()
Computes upper bounds on the expected rewards.
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...
std::unique_ptr< Multiplier< ValueType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
void complement()
Negates all bits in the bit vector.
size_t size() const
Retrieves the number of bits this bit vector can store.
std::set< VariableType > const & getVariables() const
Valuation getCenterPoint() const
Returns the center point of this region.
CoefficientType getDifference(const std::string varName) const
CoefficientType getCenter(const std::string varName) const
static std::unordered_map< RationalFunction, Annotation > lastSavedAnnotations
Definition BigStep.h:198
std::optional< storage::SparseMatrix< Interval > > eliminateMECs(storm::storage::SparseMatrix< Interval > const &matrix, std::vector< Interval > const &vector)
This class performs different steps to simplify the given (parametric) model.
This class allows efficient instantiation of the given parametric model.
ConstantSparseModelType const & instantiate(storm::utility::parametric::Valuation< ParametricType > const &valuation)
Evaluates the occurring parametric functions and retrieves the instantiated model.
#define STORM_LOG_INFO(message)
Definition logging.h:24
#define STORM_LOG_ERROR(message)
Definition logging.h:26
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:38
#define STORM_LOG_ERROR_COND(cond, message)
Definition macros.h:52
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
FragmentSpecification reachability()
bool supportsStateValueDeltaEstimates(storm::logic::Formula const &f)
bool supportsOrderBasedMonotonicity(storm::logic::Formula const &f)
std::conditional_t< Robust, storm::solver::GeneralMinMaxLinearEquationSolverFactory< storm::Interval, ConstantType >, storm::solver::GeneralMinMaxLinearEquationSolverFactory< ConstantType > > GeneralSolverFactoryType
std::optional< storm::storage::Scheduler< ConstantType > > getSchedulerHelper(std::optional< std::vector< uint64_t > > const &choices)
std::conditional_t< Robust, storm::solver::MinMaxLinearEquationSolverFactory< storm::Interval, ConstantType >, storm::solver::MinMaxLinearEquationSolverFactory< ConstantType > > SolverFactoryType
bool constexpr minimize(OptimizationDirection d)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01(storm::models::sparse::DeterministicModel< T > const &model, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 or 1, respectively, of satisfying phi until psi i...
Definition graph.cpp:393
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Performs a backward depth-first search trough the underlying graph structure of the given model to de...
Definition graph.cpp:315
storm::storage::BitVector performProb1(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &, storm::storage::BitVector const &psiStates, storm::storage::BitVector const &statesWithProbabilityGreater0)
Computes the set of states of the given model for which all paths lead to the given set of target sta...
Definition graph.cpp:376
void setVectorValues(std::vector< T > &vector, storm::storage::BitVector const &positions, std::vector< T > const &values)
Sets the provided values at the provided positions in the given vector.
Definition vector.h:78
bool isZero(ValueType const &a)
Definition constants.cpp:39
ValueType abs(ValueType const &number)
Region const region
The subregions of this region.