Storm 1.13.0.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()
63 .setRewardOperatorsAllowed(true)
64 .setReachabilityRewardFormulasAllowed(true)
65 .setBoundedUntilFormulasAllowed(true)
66 .setCumulativeRewardFormulasAllowed(true)
67 .setStepBoundedCumulativeRewardFormulasAllowed(true)
68 .setTimeBoundedCumulativeRewardFormulasAllowed(true)
69 .setTimeBoundedUntilFormulasAllowed(true)
70 .setStepBoundedUntilFormulasAllowed(true)
71 .setTimeBoundedUntilFormulasAllowed(true));
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);
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);
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
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 = std::move(propositionalChecker.check(checkTask.getFormula().getLeftSubformula())
152 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
153 .getTruthValuesVector());
154 storm::storage::BitVector psiStates = std::move(propositionalChecker.check(checkTask.getFormula().getRightSubformula())
155 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
156 .getTruthValuesVector());
157
158 // get the maybeStates
159 maybeStates = storm::utility::graph::performProbGreater0(this->parametricModel->getBackwardTransitions(), phiStates, psiStates, true, *stepBound);
160 maybeStates &= ~psiStates;
161
162 // set the result for all non-maybe states
163 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
165
166 // if there are maybestates, create the parameterLifter
167 if (Robust || !maybeStates.empty()) {
168 // Create the vector of one-step probabilities to go to target states.
169 std::vector<ParametricType> b = this->parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
170 storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getRowCount(), true), psiStates);
171 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
172 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, false, isOrderBasedMonotonicityBackend());
173 }
174
175 // We know some bounds for the results so set them
176 lowerResultBound = storm::utility::zero<ConstantType>();
177 upperResultBound = storm::utility::one<ConstantType>();
178 // No requirements for bounded formulas
179 solverFactory->setRequirementsChecked(true);
180
181 if (isOrderBasedMonotonicityBackend()) {
182 auto [prob0, prob1] = storm::utility::graph::performProb01(this->parametricModel->getBackwardTransitions(), phiStates, psiStates);
183 getOrderBasedMonotonicityBackend().initializeOrderExtender(prob1, prob0, this->parametricModel->getTransitionMatrix());
184 }
185}
186
187template<typename SparseModelType, typename ConstantType, bool Robust>
190 // get the results for the subformulas
192 STORM_LOG_THROW(propositionalChecker.canHandle(checkTask.getFormula().getLeftSubformula()) &&
193 propositionalChecker.canHandle(checkTask.getFormula().getRightSubformula()),
194 storm::exceptions::NotSupportedException, "Parameter lifting with non-propositional subformulas is not supported");
195 storm::storage::BitVector phiStates = std::move(propositionalChecker.check(checkTask.getFormula().getLeftSubformula())
196 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
197 .getTruthValuesVector());
198 storm::storage::BitVector psiStates = std::move(propositionalChecker.check(checkTask.getFormula().getRightSubformula())
199 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
200 .getTruthValuesVector());
201
202 // get the maybeStates
203 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
204 storm::utility::graph::performProb01(this->parametricModel->getBackwardTransitions(), phiStates, psiStates);
205 maybeStates = ~(statesWithProbability01.first | statesWithProbability01.second);
206
207 // set the result for all non-maybe states
208 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
209 storm::utility::vector::setVectorValues(resultsForNonMaybeStates, statesWithProbability01.second, storm::utility::one<ConstantType>());
210
211 // if there are maybestates, create the parameterLifter
212 if (Robust || !maybeStates.empty()) {
213 if constexpr (Robust) {
214 // Create the vector of one-step probabilities to go to target states.
215 // Robust PLA doesn't support eliminating states because it gets complicated with the polynomials you know
216 std::vector<ParametricType> target(this->parametricModel->getNumberOfStates(), storm::utility::zero<ParametricType>());
217 storm::storage::BitVector allTrue(maybeStates.size(), true);
218
219 if (!graphPreserving) {
221 maybeStates = ~statesWithProbability01.first & ~psiStates;
222 } else {
223 storm::utility::vector::setVectorValues(target, statesWithProbability01.second, storm::utility::one<ParametricType>());
224 }
225
226 // With Robust PLA, we cannot drop the non-maybe states out of the matrix for technical reasons
227 auto rowFilter = this->parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
228 auto filteredMatrix = this->parametricModel->getTransitionMatrix().filterEntries(rowFilter);
229
230 maybeStates = allTrue;
231
232 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
233 filteredMatrix, target, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
234 } else {
235 // Create the vector of one-step probabilities to go to target states.
236 std::vector<ParametricType> b = this->parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
237 storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getRowCount(), true), statesWithProbability01.second);
238 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
239 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
240 isOrderBasedMonotonicityBackend());
241 }
242 }
243
244 // We know some bounds for the results so set them
245 lowerResultBound = storm::utility::zero<ConstantType>();
246 upperResultBound = storm::utility::one<ConstantType>();
247
248 // The solution of the min-max equation system will always be unique (assuming graph-preserving instantiations, every induced DTMC has the same graph
249 // structure).
250 auto req = solverFactory->getRequirements(env, true, true, boost::none, !Robust);
251 req.clearBounds();
252 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
253 "Solver requirements " + req.getEnabledRequirementsAsString() + " not checked.");
254 solverFactory->setRequirementsChecked(true);
255
256 if (isOrderBasedMonotonicityBackend()) {
257 getOrderBasedMonotonicityBackend().initializeOrderExtender(statesWithProbability01.second, statesWithProbability01.first,
258 this->parametricModel->getTransitionMatrix());
259 }
260}
261
262template<typename SparseModelType, typename ConstantType, bool Robust>
265 // get the results for the subformula
267 STORM_LOG_THROW(propositionalChecker.canHandle(checkTask.getFormula().getSubformula()), storm::exceptions::NotSupportedException,
268 "Parameter lifting with non-propositional subformulas is not supported");
269 storm::storage::BitVector targetStates = std::move(propositionalChecker.check(checkTask.getFormula().getSubformula())
270 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
271 .getTruthValuesVector());
272 // get the maybeStates
274 this->parametricModel->getBackwardTransitions(), storm::storage::BitVector(this->parametricModel->getNumberOfStates(), true), targetStates);
275 infinityStates.complement();
276 maybeStates = ~(targetStates | infinityStates);
277
278 // set the result for all the non-maybe states
279 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates(), storm::utility::zero<ConstantType>());
280 storm::utility::vector::setVectorValues(resultsForNonMaybeStates, infinityStates, storm::utility::infinity<ConstantType>());
281
282 // if there are maybestates, create the parameterLifter
283 if (Robust || !maybeStates.empty()) {
284 // Create the reward vector
285 STORM_LOG_THROW((checkTask.isRewardModelSet() && this->parametricModel->hasRewardModel(checkTask.getRewardModel())) ||
286 (!checkTask.isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
287 storm::exceptions::InvalidPropertyException, "The reward model specified by the CheckTask is not available in the given model.");
288
289 typename SparseModelType::RewardModelType const& rewardModel =
290 checkTask.isRewardModelSet() ? this->parametricModel->getRewardModel(checkTask.getRewardModel()) : this->parametricModel->getUniqueRewardModel();
291
292 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->parametricModel->getTransitionMatrix());
293
294 if constexpr (Robust) {
295 storm::storage::BitVector allTrue(maybeStates.size(), true);
296 if (!graphPreserving) {
297 maybeStates = ~targetStates;
298 }
299 auto rowFilter = this->parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
300 auto filteredMatrix = this->parametricModel->getTransitionMatrix().filterEntries(rowFilter);
301 maybeStates = allTrue;
302
303 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
304 filteredMatrix, b, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
305 } else {
306 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
307 this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
308 isOrderBasedMonotonicityBackend());
309 }
310 }
311
312 // We only know a lower bound for the result
313 lowerResultBound = storm::utility::zero<ConstantType>();
314
315 // The solution of the min-max equation system will always be unique (assuming graph-preserving instantiations, every induced DTMC has the same graph
316 // structure).
317 auto req = solverFactory->getRequirements(env, true, true, boost::none, !Robust);
318 req.clearLowerBounds();
319 if (req.upperBounds()) {
320 solvingRequiresUpperRewardBounds = true;
321 req.clearUpperBounds();
322 }
323 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
324 "Solver requirements " + req.getEnabledRequirementsAsString() + " not checked.");
325 solverFactory->setRequirementsChecked(true);
326 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(), "Order-based monotonicity not used for reachability reward formula.");
327}
328
329template<typename SparseModelType, typename ConstantType, bool Robust>
332 STORM_LOG_ERROR_COND(!Robust, "Not implemented for robust mode.");
333 // Obtain the stepBound
334 stepBound = checkTask.getFormula().getBound().evaluateAsInt();
335 if (checkTask.getFormula().isBoundStrict()) {
336 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException, "Expected a strict upper step bound that is greater than zero.");
337 --(*stepBound);
338 }
339 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
340 "Can not apply parameter lifting on step bounded formula: The step bound has to be positive.");
341
342 // Every state is a maybeState
343 maybeStates = storm::storage::BitVector(this->parametricModel->getTransitionMatrix().getColumnCount(), true);
344 resultsForNonMaybeStates = std::vector<ConstantType>(this->parametricModel->getNumberOfStates());
345
346 // Create the reward vector
347 STORM_LOG_THROW((checkTask.isRewardModelSet() && this->parametricModel->hasRewardModel(checkTask.getRewardModel())) ||
348 (!checkTask.isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
349 storm::exceptions::InvalidPropertyException, "The reward model specified by the CheckTask is not available in the given model.");
350 typename SparseModelType::RewardModelType const& rewardModel =
351 checkTask.isRewardModelSet() ? this->parametricModel->getRewardModel(checkTask.getRewardModel()) : this->parametricModel->getUniqueRewardModel();
352 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->parametricModel->getTransitionMatrix());
353
354 parameterLifter =
355 std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(this->parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates);
356 // We only know a lower bound for the result
357 lowerResultBound = storm::utility::zero<ConstantType>();
358
359 // No requirements for bounded reward formula
360 solverFactory->setRequirementsChecked(true);
361
362 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(), "Order-based monotonicity not used for cumulative reward formula.");
363}
364
365template<typename SparseModelType, typename ConstantType, bool Robust>
368 if (!instantiationCheckerSAT) {
369 instantiationCheckerSAT =
370 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
371 instantiationCheckerSAT->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
372 : this->currentCheckTask->template convertValueType<ParametricType>());
373 instantiationCheckerSAT->setInstantiationsAreGraphPreserving(true);
374 }
375 return *instantiationCheckerSAT;
376}
377
378template<typename SparseModelType, typename ConstantType, bool Robust>
381 if (!instantiationCheckerVIO) {
382 instantiationCheckerVIO =
383 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
384 instantiationCheckerVIO->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
385 : this->currentCheckTask->template convertValueType<ParametricType>());
386 instantiationCheckerVIO->setInstantiationsAreGraphPreserving(true);
387 }
388 return *instantiationCheckerVIO;
389}
390
391template<typename SparseModelType, typename ConstantType, bool Robust>
394 if (!instantiationChecker) {
395 instantiationChecker =
396 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(*this->parametricModel);
397 instantiationChecker->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
398 : this->currentCheckTask->template convertValueType<ParametricType>());
399 instantiationChecker->setInstantiationsAreGraphPreserving(true);
400 }
401 return *instantiationChecker;
402}
403
404template<typename SparseModelType, typename ConstantType, bool Robust>
407 if (maybeStates.empty()) {
408 this->updateKnownValueBoundInRegion(region, dirForParameters, resultsForNonMaybeStates);
409 return resultsForNonMaybeStates;
410 }
411 parameterLifter->specifyRegion(region.region, dirForParameters);
412 auto liftedMatrix = parameterLifter->getMatrix();
413 auto liftedVector = parameterLifter->getVector();
414 bool nonTrivialEndComponents = false;
415 if constexpr (Robust) {
416 if (parameterLifter->isCurrentRegionAllIllDefined()) {
417 return std::vector<ConstantType>();
418 }
419 if (!graphPreserving) {
420 transformer::IntervalEndComponentPreserver endComponentPreserver;
421 auto const& result = endComponentPreserver.eliminateMECs(liftedMatrix, liftedVector);
422 if (result) {
423 // std::cout << liftedMatrix << std::endl;
424 // std::cout << *result << std::endl;
425 liftedMatrix = *result;
426 nonTrivialEndComponents = true;
427 }
428 }
429 }
430 const uint64_t resultVectorSize = liftedMatrix.getColumnCount();
431
432 if (stepBound) {
433 if constexpr (!Robust) {
434 assert(*stepBound > 0);
435 x = std::vector<ConstantType>(resultVectorSize, storm::utility::zero<ConstantType>());
436 auto multiplier = storm::solver::MultiplierFactory<ConstantType>().create(env, liftedMatrix);
437 multiplier->repeatedMultiplyAndReduce(env, dirForParameters, x, &liftedVector, *stepBound);
438 } else {
439 STORM_LOG_ERROR("Cannot check step-bounded formulas in robust mode.");
440 }
441 } else {
442 auto solver = solverFactory->create(env, liftedMatrix);
443 solver->setHasUniqueSolution();
444 solver->setHasNoEndComponents();
445 // Uncertainty is not robust (=adversarial)
446 solver->setUncertaintyResolutionMode(UncertaintyResolutionMode::Cooperative);
447 if (lowerResultBound)
448 solver->setLowerBound(lowerResultBound.value());
449 if (upperResultBound) {
450 solver->setUpperBound(upperResultBound.value());
451 } else if (solvingRequiresUpperRewardBounds) {
452 if constexpr (!Robust) {
453 // For the min-case, we use DS-MPI, for the max-case variant 2 of the Baier et al. paper (CAV'17).
454 std::vector<ConstantType> oneStepProbs;
455 oneStepProbs.reserve(liftedMatrix.getRowCount());
456 for (uint64_t row = 0; row < liftedMatrix.getRowCount(); ++row) {
457 oneStepProbs.push_back(storm::utility::one<ConstantType>() - liftedMatrix.getRowSum(row));
458 }
459 if (dirForParameters == storm::OptimizationDirection::Minimize) {
460 storm::modelchecker::helper::DsMpiMdpUpperRewardBoundsComputer<ConstantType> dsmpi(liftedMatrix, liftedVector, oneStepProbs);
461 solver->setUpperBounds(dsmpi.computeUpperBounds());
462 } else {
464 solver->setUpperBound(baier.computeTotalRewardBounds(liftedVector).upper);
465 }
466 } else {
467 STORM_LOG_ERROR("Cannot use upper reward bounds in robust mode.");
468 }
469 }
470 solver->setTrackScheduler(true);
471
472 // Get reference to relevant scheduler choices
473 auto& choices = storm::solver::minimize(dirForParameters) ? minSchedChoices : maxSchedChoices;
474
475 // Potentially fix some choices if order based monotonicity is known
476 if constexpr (!Robust) {
477 storm::storage::BitVector statesWithFixedChoice;
478 if (isOrderBasedMonotonicityBackend()) {
479 // Ensure choices are initialized
480 if (!choices.has_value()) {
481 choices.emplace(parameterLifter->getRowGroupCount(), 0u);
482 }
483 statesWithFixedChoice = getOrderBasedMonotonicityBackend().getChoicesToFixForPLASolver(region, dirForParameters, *choices);
484 }
485
486 // Set initial scheduler
487 if (choices.has_value()) {
488 solver->setInitialScheduler(std::move(choices.value()));
489 if (statesWithFixedChoice.size() != 0) {
490 // Choices need to be fixed after setting a scheduler
491 solver->setSchedulerFixedForRowGroup(std::move(statesWithFixedChoice));
492 }
493 }
494 } else {
495 // Set initial scheduler
496 if (!nonTrivialEndComponents && choices.has_value()) {
497 solver->setInitialScheduler(std::move(choices.value()));
498 }
499 }
500
501 if (this->currentCheckTask->isBoundSet() && solver->hasInitialScheduler()) {
502 // 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
503 // minimize).
504 std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond;
505 storm::storage::BitVector relevantStatesInSubsystem = this->currentCheckTask->isOnlyInitialStatesRelevantSet()
506 ? this->parametricModel->getInitialStates() % maybeStates
507 : storm::storage::BitVector(maybeStates.getNumberOfSetBits(), true);
508 if (storm::solver::minimize(dirForParameters)) {
509 // Terminate if the value for ALL relevant states is already below the threshold
510 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumBelowThreshold<ConstantType>>(
511 relevantStatesInSubsystem, true, this->currentCheckTask->getBoundThreshold(), false);
512 } else {
513 // Terminate if the value for ALL relevant states is already above the threshold
514 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumExceedsThreshold<ConstantType>>(
515 relevantStatesInSubsystem, true, this->currentCheckTask->getBoundThreshold(), true);
516 }
517 solver->setTerminationCondition(std::move(termCond));
518 }
519
520 // Invoke the solver
521 x.resize(resultVectorSize, storm::utility::zero<ConstantType>());
522 solver->solveEquations(env, dirForParameters, x, liftedVector);
523 if (isValueDeltaRegionSplitEstimates()) {
524 computeStateValueDeltaRegionSplitEstimates(env, x, solver->getSchedulerChoices(), region.region, dirForParameters);
525 }
526 // Store choices for next time, if we have no non-trivial end components
527 if (!nonTrivialEndComponents) {
528 choices = solver->getSchedulerChoices();
529 }
530 }
531
532 // Get the result for the complete model (including maybestates)
533 std::vector<ConstantType> result = resultsForNonMaybeStates;
534 auto maybeStateResIt = x.begin();
535 for (auto const& maybeState : maybeStates) {
536 result[maybeState] = *maybeStateResIt;
537 ++maybeStateResIt;
538 }
539
540 STORM_LOG_INFO(dirForParameters << " " << region.region << ": " << result[this->getUniqueInitialState()] << std::endl);
541
542 this->updateKnownValueBoundInRegion(region, dirForParameters, result);
543 return result;
544}
545
546template<typename SparseModelType, typename ConstantType, bool Robust>
548 Environment const& env, std::vector<ConstantType> const& quantitativeResult, std::vector<uint64_t> const& schedulerChoices,
550 auto const& matrix = parameterLifter->getMatrix();
551 auto const& vector = parameterLifter->getVector();
552
553 std::vector<ConstantType> weighting = std::vector<ConstantType>(vector.size(), utility::one<ConstantType>());
555 // Instantiated on center, instantiate on choices instead?
556 // Kinda complicated tho
558 auto const instantiatedModel = instantiator.instantiate(region.getCenterPoint());
559 helper::SparseDeterministicVisitingTimesHelper<ConstantType> visitingTimesHelper(instantiatedModel.getTransitionMatrix());
560 auto const visitingTimes = visitingTimesHelper.computeExpectedVisitingTimes(env, this->parametricModel->getInitialStates());
561 uint64_t rowIndex = 0;
562 for (auto const& state : maybeStates) {
563 weighting[rowIndex++] = visitingTimes[state];
564 }
565 }
566
567 switch (*this->specifiedRegionSplitEstimateKind) {
570 std::map<VariableType, ConstantType> deltaLower, deltaUpper;
571 for (auto const& p : region.getVariables()) {
572 deltaLower.emplace(p, storm::utility::zero<ConstantType>());
573 deltaUpper.emplace(p, storm::utility::zero<ConstantType>());
574 }
575 if constexpr (Robust) {
576 // Cache all derivatives of functions that turn up in pMC
577 static std::map<RationalFunction, RationalFunction> functionDerivatives;
578 static std::vector<std::pair<bool, double>> constantDerivatives;
579 if (constantDerivatives.empty()) {
580 for (uint64_t state : maybeStates) {
581 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
582 if (variables.size() == 0) {
583 continue;
584 }
585 STORM_LOG_ERROR_COND(variables.size() == 1,
586 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
587 auto const p = *variables.begin();
588 for (auto const& entry : this->parametricModel->getTransitionMatrix().getRow(state)) {
589 auto const& function = entry.getValue();
590 if (functionDerivatives.count(function)) {
591 constantDerivatives.emplace_back(false, 0);
592 continue;
593 }
594 auto const derivative = function.derivative(p);
595 if (derivative.isConstant()) {
596 constantDerivatives.emplace_back(true, utility::convertNumber<double>(derivative.constantPart()));
597 } else if (!storm::transformer::BigStep::lastSavedAnnotations.count(entry.getValue())) {
598 functionDerivatives.emplace(function, derivative);
599 constantDerivatives.emplace_back(false, 0);
600 } else {
601 constantDerivatives.emplace_back(false, 0);
602 }
603 }
604 }
605 }
606
607 cachedRegionSplitEstimates.clear();
608 for (auto const& p : region.getVariables()) {
609 cachedRegionSplitEstimates.emplace(p, utility::zero<ConstantType>());
610 }
611
612 uint64_t entryCount = 0;
613 // Assumption: Only one parameter per state
614 for (uint64_t state : maybeStates) {
615 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
616 if (variables.size() == 0) {
617 continue;
618 }
619 STORM_LOG_ERROR_COND(variables.size() == 1,
620 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
621
622 auto const p = *variables.begin();
623
624 const uint64_t rowIndex = maybeStates.getNumberOfSetBitsBeforeIndex(state);
625
626 std::vector<ConstantType> derivatives;
627 for (auto const& entry : this->parametricModel->getTransitionMatrix().getRow(state)) {
628 if (storm::transformer::BigStep::lastSavedAnnotations.count(entry.getValue())) {
629 auto& annotation = storm::transformer::BigStep::lastSavedAnnotations.at(entry.getValue());
630 ConstantType derivative =
631 annotation.derivative()->template evaluate<ConstantType>(utility::convertNumber<ConstantType>(region.getCenter(p)));
632 derivatives.push_back(derivative);
633 } else {
634 auto const& cDer = constantDerivatives.at(entryCount);
635 if (cDer.first) {
636 derivatives.push_back(cDer.second);
637 } else {
638 CoefficientType derivative = functionDerivatives.at(entry.getValue()).evaluate(region.getCenterPoint());
639 derivatives.push_back(utility::convertNumber<ConstantType>(derivative));
640 }
641 }
642 entryCount++;
643 }
644
645 std::vector<ConstantType> results(0);
646
647 ConstantType distrToNegativeDerivative = storm::utility::zero<ConstantType>();
648 ConstantType distrToPositiveDerivative = storm::utility::zero<ConstantType>();
649
650 for (auto const& direction : {OptimizationDirection::Maximize, OptimizationDirection::Minimize}) {
651 // Do a step of robust value iteration
652 // 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
653 // Currently "fixed in preprocessing"
654 // It's different for rewards (same problem in ValueIterationOperator.h, search for word "octopus" in codebase)
655 ConstantType remainingValue = utility::one<ConstantType>();
656 ConstantType result = utility::zero<ConstantType>();
657
658 STORM_LOG_ASSERT(vector[rowIndex].upper() == vector[rowIndex].lower(),
659 "Non-constant vector indices not supported (this includes parametric rewards).");
660
661 std::vector<std::pair<ConstantType, std::pair<ConstantType, uint64_t>>> robustOrder;
662
663 uint64_t index = 0;
664 for (auto const& entry : matrix.getRow(rowIndex)) {
665 auto const lower = entry.getValue().lower();
666 result += quantitativeResult[entry.getColumn()] * lower;
667 remainingValue -= lower;
668 auto const diameter = entry.getValue().upper() - lower;
669 if (!storm::utility::isZero(diameter)) {
670 robustOrder.emplace_back(quantitativeResult[entry.getColumn()], std::make_pair(diameter, index));
671 }
672 index++;
673 }
674
675 std::sort(robustOrder.begin(), robustOrder.end(),
676 [direction](const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& a,
677 const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& b) {
678 if (direction == OptimizationDirection::Maximize) {
679 return a.first > b.first;
680 } else {
681 return a.first < b.first;
682 }
683 });
684
685 for (auto const& pair : robustOrder) {
686 auto availableMass = std::min(pair.second.first, remainingValue);
687 result += availableMass * pair.first;
688 // TODO hardcoded precision
689 if (direction == this->currentCheckTask->getOptimizationDirection()) {
690 if (derivatives[pair.second.second] > 1e-6) {
691 distrToPositiveDerivative += availableMass;
692 } else if (derivatives[pair.second.second] < 1e-6) {
693 distrToNegativeDerivative += availableMass;
694 }
695 }
696 remainingValue -= availableMass;
697 }
698
699 results.push_back(result);
700 }
701
702 ConstantType diff = std::abs(results[0] - results[1]);
703 if (distrToPositiveDerivative > distrToNegativeDerivative) { // Choose as upper
704 deltaUpper[p] += diff * weighting[rowIndex];
705 } else { // Choose as lower
706 deltaLower[p] += diff * weighting[rowIndex];
707 }
708 }
709 } else {
710 auto const& choiceValuations = parameterLifter->getRowLabels();
711
712 std::vector<ConstantType> stateResults;
713 for (uint64_t state = 0; state < schedulerChoices.size(); ++state) {
714 uint64_t rowOffset = matrix.getRowGroupIndices()[state];
715 uint64_t optimalChoice = schedulerChoices[state];
716 auto const& optimalChoiceVal = choiceValuations[rowOffset + optimalChoice];
717 assert(optimalChoiceVal.getUnspecifiedParameters().empty());
718 stateResults.clear();
719 for (uint64_t row = rowOffset; row < matrix.getRowGroupIndices()[state + 1]; ++row) {
720 stateResults.push_back(matrix.multiplyRowWithVector(row, quantitativeResult) + vector[row]);
721 }
722 // Do this twice, once for upperbound once for lowerbound
723 bool checkUpperParameters = false;
724 do {
725 auto const& consideredParameters = checkUpperParameters ? optimalChoiceVal.getUpperParameters() : optimalChoiceVal.getLowerParameters();
726 for (auto const& p : consideredParameters) {
727 // Find the 'best' choice that assigns the parameter to the other bound
728 ConstantType bestValue = 0;
729 bool foundBestValue = false;
730 for (uint64_t choice = 0; choice < stateResults.size(); ++choice) {
731 if (choice != optimalChoice) {
732 auto const& otherBoundParsOfChoice = checkUpperParameters ? choiceValuations[rowOffset + choice].getLowerParameters()
733 : choiceValuations[rowOffset + choice].getUpperParameters();
734 if (otherBoundParsOfChoice.find(p) != otherBoundParsOfChoice.end()) {
735 ConstantType const& choiceValue = stateResults[choice];
736 if (!foundBestValue ||
737 (storm::solver::minimize(dirForParameters) ? choiceValue < bestValue : choiceValue > bestValue)) {
738 foundBestValue = true;
739 bestValue = choiceValue;
740 }
741 }
742 }
743 }
744 auto const& optimal = stateResults[optimalChoice];
746 if (foundBestValue) {
747 if (checkUpperParameters) {
748 deltaLower[p] += diff * weighting[state];
749 } else {
750 deltaUpper[p] += diff * weighting[state];
751 }
752 }
753 }
754 checkUpperParameters = !checkUpperParameters;
755 } while (checkUpperParameters);
756 }
757 }
758
759 cachedRegionSplitEstimates.clear();
760 for (auto const& p : region.getVariables()) {
761 // TODO: previously, the reginSplitEstimates were only used in splitting if at least one parameter is possibly monotone. Why?
762 auto minDelta = std::min(deltaLower[p], deltaUpper[p]);
763 cachedRegionSplitEstimates.emplace(p, minDelta);
764 }
765
766 // large regionsplitestimate implies that parameter p occurs as p and 1-p at least once
767 break;
768 }
771 *this->parametricModel);
772 instantiationModelChecker.specifyFormula(*this->currentCheckTaskNoBound);
773
774 auto const center = region.getCenterPoint();
775
776 std::unique_ptr<storm::modelchecker::CheckResult> result = instantiationModelChecker.check(env, center);
777 auto const reachabilityProbabilities = result->asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
778
779 STORM_LOG_ASSERT(this->derivativeChecker, "Derivative checker not intialized");
780
781 for (auto const& param : region.getVariables()) {
782 auto result = this->derivativeChecker->check(env, center, param, reachabilityProbabilities);
783 ConstantType derivative =
784 result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()[this->derivativeChecker->getInitialState()];
785 cachedRegionSplitEstimates[param] = utility::abs(derivative) * utility::convertNumber<ConstantType>(region.getDifference(param));
786 }
787 break;
788 }
789 default:
790 STORM_LOG_ERROR("Region split estimate kind not handled by SparseDtmcParameterLiftingModelChecker.");
791 }
792}
793
794template<typename SparseModelType, typename ConstantType, bool Robust>
796 maybeStates.resize(0);
797 resultsForNonMaybeStates.clear();
798 stepBound = std::nullopt;
799 instantiationChecker = nullptr;
800 instantiationCheckerSAT = nullptr;
801 instantiationCheckerVIO = nullptr;
802 parameterLifter = nullptr;
803 minSchedChoices = std::nullopt;
804 maxSchedChoices = std::nullopt;
805 x.clear();
806 lowerResultBound = std::nullopt;
807 upperResultBound = std::nullopt;
808 cachedRegionSplitEstimates.clear();
809}
810
811template<typename ConstantType>
812std::optional<storm::storage::Scheduler<ConstantType>> getSchedulerHelper(std::optional<std::vector<uint64_t>> const& choices) {
813 std::optional<storm::storage::Scheduler<ConstantType>> result;
814 if (choices) {
815 result.emplace(choices->size());
816 uint64_t state = 0;
817 for (auto const& choice : choices.value()) {
818 result->setChoice(choice, state);
819 ++state;
820 }
821 }
822 return result;
823}
824
825template<typename SparseModelType, typename ConstantType, bool Robust>
827 return getSchedulerHelper<ConstantType>(minSchedChoices);
828}
829
830template<typename SparseModelType, typename ConstantType, bool Robust>
832 return getSchedulerHelper<ConstantType>(maxSchedChoices);
833}
834
836 if (f.isOperatorFormula()) {
837 auto const& sub = f.asOperatorFormula().getSubformula();
838 return sub.isUntilFormula() || sub.isEventuallyFormula();
839 }
840 return false;
841}
842
845 auto const& sub = f.asProbabilityOperatorFormula().getSubformula();
846 return sub.isUntilFormula() || sub.isEventuallyFormula() || sub.isBoundedUntilFormula();
847 }
848 return false;
849}
850
851template<typename SparseModelType, typename ConstantType, bool Robust>
859
860template<typename SparseModelType, typename ConstantType, bool Robust>
866
867template<typename SparseModelType, typename ConstantType, bool Robust>
868std::vector<typename SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::CoefficientType>
870 std::set<VariableType> const& relevantParameters) const {
871 if (isValueDeltaRegionSplitEstimates()) {
872 // Cached region split estimates are value-delta
873 std::vector<CoefficientType> result;
874 for (auto const& par : relevantParameters) {
875 auto est = cachedRegionSplitEstimates.find(par);
876 STORM_LOG_ASSERT(est != cachedRegionSplitEstimates.end(),
877 "Requested region split estimate for parameter " << par.name() << " but none was generated.");
878 result.push_back(storm::utility::convertNumber<CoefficientType>(est->second));
879 }
880 return result;
881 } else {
882 // Call super method, which might support the estimate type
884 }
885}
886
887template<typename SparseModelType, typename ConstantType, bool Robust>
897
898template<typename SparseModelType, typename ConstantType, bool Robust>
899bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isOrderBasedMonotonicityBackend() const {
900 return dynamic_cast<OrderBasedMonotonicityBackend<ParametricType, ConstantType>*>(this->monotonicityBackend.get()) != nullptr;
901}
902
903template<typename SparseModelType, typename ConstantType, bool Robust>
904OrderBasedMonotonicityBackend<typename SparseModelType::ValueType, ConstantType>&
905SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::getOrderBasedMonotonicityBackend() {
906 return dynamic_cast<OrderBasedMonotonicityBackend<ParametricType, ConstantType>&>(*this->monotonicityBackend);
907}
908
909template<typename SparseModelType, typename ConstantType, bool Robust>
910bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isValueDeltaRegionSplitEstimates() const {
911 return this->getSpecifiedRegionSplitEstimateKind().has_value() &&
912 (this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDelta ||
913 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDeltaWeighted ||
914 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::Derivative);
915}
916
917template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double, false>;
918template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double, true>;
919template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::RationalNumber, false>;
920} // namespace modelchecker
921} // 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
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...
virtual bool isRegionSplitEstimateKindSupported(RegionSplitEstimateKind kind, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const
virtual RegionSplitEstimateKind getDefaultRegionSplitEstimateKind(CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const
virtual void specifyMonotonicity(std::shared_ptr< MonotonicityBackend< SparseModelType::ValueType > > backend, CheckTask< storm::logic::Formula, SparseModelType::ValueType > const &checkTask)
std::shared_ptr< MonotonicityBackend< SparseModelType::ValueType > > monotonicityBackend
virtual std::vector< CoefficientType > obtainRegionSplitEstimates(std::set< VariableType > const &relevantParameters) const
Returns an estimate of the benefit of splitting the last checked region with respect to each of the g...
virtual void specifySplitEstimates(std::optional< RegionSplitEstimateKind > splitEstimates, CheckTask< storm::logic::Formula, SparseModelType::ValueType > const &checkTask)
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
std::optional< storm::storage::Scheduler< ConstantType > > getCurrentMinScheduler()
virtual bool isRegionSplitEstimateKindSupported(RegionSplitEstimateKind kind, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const override
typename RegionModelChecker< ParametricType >::CoefficientType CoefficientType
virtual std::vector< CoefficientType > obtainRegionSplitEstimates(std::set< VariableType > const &relevantParameters) const override
Returns an estimate of the benefit of splitting the last checked region with respect to each of the g...
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationCheckerSAT(bool qualitative) override
virtual RegionSplitEstimateKind getDefaultRegionSplitEstimateKind(CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const 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)
std::optional< storm::storage::Scheduler< ConstantType > > getCurrentMaxScheduler()
virtual void specifyReachabilityRewardFormula(Environment const &env, CheckTask< storm::logic::EventuallyFormula, ConstantType > const &checkTask) override
virtual bool isMonotonicitySupported(MonotonicityBackend< ParametricType > const &backend, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const override
Returns whether this region model checker can work together with the given monotonicity backend.
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)
std::unique_ptr< CheckTask< storm::logic::Formula, ConstantType > > currentCheckTask
void specifyFormula(Environment const &env, CheckTask< storm::logic::Formula, ParametricType > const &checkTask)
void updateKnownValueBoundInRegion(AnnotatedRegion< ParametricType > &region, storm::solver::OptimizationDirection dir, std::vector< ConstantType > const &newValues)
virtual bool canHandle(CheckTask< storm::logic::Formula, SolutionType > const &checkTask) const override
Bounds computeTotalRewardBounds(std::vector< ValueType > const &rewards)
Computes a lower and an upper bound on the expected total 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, SolutionType > > 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.
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::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
std::conditional_t< Robust, storm::solver::GeneralMinMaxLinearEquationSolverFactory< storm::Interval, ConstantType >, storm::solver::GeneralMinMaxLinearEquationSolverFactory< ConstantType > > GeneralSolverFactoryType
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)
ValueType zero()
Definition constants.cpp:24
ValueType infinity()
Definition constants.cpp:29
ValueType one()
Definition constants.cpp:19
TargetType convertNumber(SourceType const &number)
solver::OptimizationDirection OptimizationDirection