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