41template<
typename SparseModelType,
typename ConstantType,
bool Robust>
47template<
typename SparseModelType,
typename ConstantType,
bool Robust>
50 : solverFactory(
std::move(solverFactory)), solvingRequiresUpperRewardBounds(false) {
54template<
typename SparseModelType,
typename ConstantType,
bool Robust>
61 result &=
static_cast<bool>(dtmc);
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));
75template<
typename SparseModelType,
typename ConstantType,
bool Robust>
79 bool allowModelSimplifications,
bool graphPreserving) {
81 "Combination of model " <<
parametricModel->getType() <<
" and formula '" << checkTask.
getFormula() <<
"' is not supported.");
84 this->graphPreserving = graphPreserving;
86 if (isOrderBasedMonotonicityBackend()) {
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");
90 getOrderBasedMonotonicityBackend().initializeMonotonicityChecker(dtmc->getTransitionMatrix());
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.");
101 this->parametricModel = simplifier.getSimplifiedModel();
104 this->parametricModel = dtmc;
107 if constexpr (!Robust) {
108 if (isOrderBasedMonotonicityBackend()) {
109 getOrderBasedMonotonicityBackend().registerParameterLifterReference(*parameterLifter);
110 getOrderBasedMonotonicityBackend().registerPLABoundFunction(
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);
127template<
typename SparseModelType,
typename ConstantType,
bool Robust>
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.");
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.");
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.");
150 storm::exceptions::NotSupportedException,
"Parameter lifting with non-propositional subformulas is not supported");
152 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
153 .getTruthValuesVector());
155 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
156 .getTruthValuesVector());
160 maybeStates &= ~psiStates;
167 if (Robust || !maybeStates.empty()) {
169 std::vector<ParametricType> b = this->
parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
171 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
172 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates,
false, isOrderBasedMonotonicityBackend());
179 solverFactory->setRequirementsChecked(
true);
181 if (isOrderBasedMonotonicityBackend()) {
183 getOrderBasedMonotonicityBackend().initializeOrderExtender(prob1, prob0, this->
parametricModel->getTransitionMatrix());
187template<
typename SparseModelType,
typename ConstantType,
bool Robust>
194 storm::exceptions::NotSupportedException,
"Parameter lifting with non-propositional subformulas is not supported");
196 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
197 .getTruthValuesVector());
199 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
200 .getTruthValuesVector());
203 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
205 maybeStates = ~(statesWithProbability01.first | statesWithProbability01.second);
212 if (Robust || !maybeStates.empty()) {
213 if constexpr (Robust) {
219 if (!graphPreserving) {
221 maybeStates = ~statesWithProbability01.first & ~psiStates;
227 auto rowFilter = this->
parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
228 auto filteredMatrix = this->
parametricModel->getTransitionMatrix().filterEntries(rowFilter);
230 maybeStates = allTrue;
232 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
233 filteredMatrix, target, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
236 std::vector<ParametricType> b = this->
parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
238 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
239 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
240 isOrderBasedMonotonicityBackend());
250 auto req = solverFactory->getRequirements(env,
true,
true, boost::none, !Robust);
252 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
253 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
254 solverFactory->setRequirementsChecked(
true);
256 if (isOrderBasedMonotonicityBackend()) {
257 getOrderBasedMonotonicityBackend().initializeOrderExtender(statesWithProbability01.second, statesWithProbability01.first,
258 this->parametricModel->getTransitionMatrix());
262template<
typename SparseModelType,
typename ConstantType,
bool Robust>
268 "Parameter lifting with non-propositional subformulas is not supported");
270 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
271 .getTruthValuesVector());
276 maybeStates = ~(targetStates | infinityStates);
283 if (Robust || !maybeStates.empty()) {
286 (!checkTask.
isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
287 storm::exceptions::InvalidPropertyException,
"The reward model specified by the CheckTask is not available in the given model.");
289 typename SparseModelType::RewardModelType
const& rewardModel =
292 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->
parametricModel->getTransitionMatrix());
294 if constexpr (Robust) {
296 if (!graphPreserving) {
297 maybeStates = ~targetStates;
299 auto rowFilter = this->
parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
300 auto filteredMatrix = this->
parametricModel->getTransitionMatrix().filterEntries(rowFilter);
301 maybeStates = allTrue;
303 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
304 filteredMatrix, b, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
306 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
307 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
308 isOrderBasedMonotonicityBackend());
317 auto req = solverFactory->getRequirements(env,
true,
true, boost::none, !Robust);
318 req.clearLowerBounds();
319 if (req.upperBounds()) {
320 solvingRequiresUpperRewardBounds =
true;
321 req.clearUpperBounds();
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.");
329template<
typename SparseModelType,
typename ConstantType,
bool Robust>
334 stepBound = checkTask.
getFormula().getBound().evaluateAsInt();
336 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
"Expected a strict upper step bound that is greater than zero.");
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.");
344 resultsForNonMaybeStates = std::vector<ConstantType>(this->
parametricModel->getNumberOfStates());
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 =
352 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->
parametricModel->getTransitionMatrix());
355 std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates);
360 solverFactory->setRequirementsChecked(
true);
362 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(),
"Order-based monotonicity not used for cumulative reward formula.");
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
373 instantiationCheckerSAT->setInstantiationsAreGraphPreserving(
true);
375 return *instantiationCheckerSAT;
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
386 instantiationCheckerVIO->setInstantiationsAreGraphPreserving(
true);
388 return *instantiationCheckerVIO;
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
399 instantiationChecker->setInstantiationsAreGraphPreserving(
true);
401 return *instantiationChecker;
404template<
typename SparseModelType,
typename ConstantType,
bool Robust>
407 if (maybeStates.empty()) {
409 return resultsForNonMaybeStates;
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>();
419 if (!graphPreserving) {
421 auto const& result = endComponentPreserver.
eliminateMECs(liftedMatrix, liftedVector);
425 liftedMatrix = *result;
426 nonTrivialEndComponents =
true;
430 const uint64_t resultVectorSize = liftedMatrix.getColumnCount();
433 if constexpr (!Robust) {
434 assert(*stepBound > 0);
437 multiplier->repeatedMultiplyAndReduce(env, dirForParameters, x, &liftedVector, *stepBound);
442 auto solver = solverFactory->create(env, liftedMatrix);
443 solver->setHasUniqueSolution();
444 solver->setHasNoEndComponents();
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) {
454 std::vector<ConstantType> oneStepProbs;
455 oneStepProbs.reserve(liftedMatrix.getRowCount());
456 for (uint64_t row = 0; row < liftedMatrix.getRowCount(); ++row) {
459 if (dirForParameters == storm::OptimizationDirection::Minimize) {
470 solver->setTrackScheduler(
true);
476 if constexpr (!Robust) {
478 if (isOrderBasedMonotonicityBackend()) {
480 if (!choices.has_value()) {
481 choices.emplace(parameterLifter->getRowGroupCount(), 0u);
483 statesWithFixedChoice = getOrderBasedMonotonicityBackend().getChoicesToFixForPLASolver(
region, dirForParameters, *choices);
487 if (choices.has_value()) {
488 solver->setInitialScheduler(std::move(choices.value()));
489 if (statesWithFixedChoice.
size() != 0) {
491 solver->setSchedulerFixedForRowGroup(std::move(statesWithFixedChoice));
496 if (!nonTrivialEndComponents && choices.has_value()) {
497 solver->setInitialScheduler(std::move(choices.value()));
504 std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond;
510 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumBelowThreshold<ConstantType>>(
511 relevantStatesInSubsystem,
true, this->
currentCheckTask->getBoundThreshold(),
false);
514 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumExceedsThreshold<ConstantType>>(
515 relevantStatesInSubsystem,
true, this->
currentCheckTask->getBoundThreshold(),
true);
517 solver->setTerminationCondition(std::move(termCond));
522 solver->solveEquations(env, dirForParameters, x, liftedVector);
523 if (isValueDeltaRegionSplitEstimates()) {
527 if (!nonTrivialEndComponents) {
528 choices =
solver->getSchedulerChoices();
533 std::vector<ConstantType> result = resultsForNonMaybeStates;
534 auto maybeStateResIt = x.begin();
535 for (
auto const& maybeState : maybeStates) {
536 result[maybeState] = *maybeStateResIt;
540 STORM_LOG_INFO(dirForParameters <<
" " <<
region.region <<
": " << result[this->getUniqueInitialState()] << std::endl);
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();
558 auto const instantiatedModel = instantiator.
instantiate(
region.getCenterPoint());
561 uint64_t rowIndex = 0;
562 for (
auto const& state : maybeStates) {
563 weighting[rowIndex++] = visitingTimes[state];
570 std::map<VariableType, ConstantType> deltaLower, deltaUpper;
571 for (
auto const& p :
region.getVariables()) {
575 if constexpr (Robust) {
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) {
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);
594 auto const derivative = function.derivative(p);
598 functionDerivatives.emplace(function,
derivative);
599 constantDerivatives.emplace_back(
false, 0);
601 constantDerivatives.emplace_back(
false, 0);
607 cachedRegionSplitEstimates.clear();
608 for (
auto const& p :
region.getVariables()) {
612 uint64_t entryCount = 0;
614 for (uint64_t state : maybeStates) {
615 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
616 if (variables.size() == 0) {
620 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
622 auto const p = *variables.begin();
624 const uint64_t rowIndex = maybeStates.getNumberOfSetBitsBeforeIndex(state);
626 std::vector<ConstantType> derivatives;
627 for (
auto const& entry : this->
parametricModel->getTransitionMatrix().getRow(state)) {
634 auto const& cDer = constantDerivatives.at(entryCount);
636 derivatives.push_back(cDer.second);
645 std::vector<ConstantType> results(0);
650 for (
auto const& direction : {OptimizationDirection::Maximize, OptimizationDirection::Minimize}) {
659 "Non-constant vector indices not supported (this includes parametric rewards).");
661 std::vector<std::pair<ConstantType, std::pair<ConstantType, uint64_t>>> robustOrder;
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;
670 robustOrder.emplace_back(quantitativeResult[entry.getColumn()], std::make_pair(diameter, index));
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;
681 return a.first < b.first;
685 for (
auto const& pair : robustOrder) {
686 auto availableMass = std::min(pair.second.first, remainingValue);
687 result += availableMass * pair.first;
690 if (derivatives[pair.second.second] > 1e-6) {
691 distrToPositiveDerivative += availableMass;
692 }
else if (derivatives[pair.second.second] < 1e-6) {
693 distrToNegativeDerivative += availableMass;
696 remainingValue -= availableMass;
699 results.push_back(result);
702 ConstantType diff = std::abs(results[0] - results[1]);
703 if (distrToPositiveDerivative > distrToNegativeDerivative) {
704 deltaUpper[p] += diff * weighting[rowIndex];
706 deltaLower[p] += diff * weighting[rowIndex];
710 auto const& choiceValuations = parameterLifter->getRowLabels();
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]);
723 bool checkUpperParameters =
false;
725 auto const& consideredParameters = checkUpperParameters ? optimalChoiceVal.getUpperParameters() : optimalChoiceVal.getLowerParameters();
726 for (
auto const& p : consideredParameters) {
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 ||
738 foundBestValue =
true;
739 bestValue = choiceValue;
744 auto const& optimal = stateResults[optimalChoice];
746 if (foundBestValue) {
747 if (checkUpperParameters) {
748 deltaLower[p] += diff * weighting[state];
750 deltaUpper[p] += diff * weighting[state];
754 checkUpperParameters = !checkUpperParameters;
755 }
while (checkUpperParameters);
759 cachedRegionSplitEstimates.clear();
760 for (
auto const& p :
region.getVariables()) {
762 auto minDelta = std::min(deltaLower[p], deltaUpper[p]);
763 cachedRegionSplitEstimates.emplace(p, minDelta);
772 instantiationModelChecker.
specifyFormula(*this->currentCheckTaskNoBound);
774 auto const center =
region.getCenterPoint();
776 std::unique_ptr<storm::modelchecker::CheckResult> result = instantiationModelChecker.
check(env, center);
777 auto const reachabilityProbabilities = result->asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();
779 STORM_LOG_ASSERT(this->derivativeChecker,
"Derivative checker not intialized");
781 for (
auto const& param :
region.getVariables()) {
782 auto result = this->derivativeChecker->check(env, center, param, reachabilityProbabilities);
784 result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()[this->derivativeChecker->getInitialState()];
790 STORM_LOG_ERROR(
"Region split estimate kind not handled by SparseDtmcParameterLiftingModelChecker.");
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;
806 lowerResultBound = std::nullopt;
807 upperResultBound = std::nullopt;
808 cachedRegionSplitEstimates.clear();
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;
815 result.emplace(choices->size());
817 for (
auto const& choice : choices.value()) {
818 result->setChoice(choice, state);
825template<
typename SparseModelType,
typename ConstantType,
bool Robust>
830template<
typename SparseModelType,
typename ConstantType,
bool Robust>
846 return sub.
isUntilFormula() || sub.isEventuallyFormula() || sub.isBoundedUntilFormula();
851template<
typename SparseModelType,
typename ConstantType,
bool Robust>
860template<
typename SparseModelType,
typename ConstantType,
bool Robust>
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()) {
873 std::vector<CoefficientType> result;
874 for (
auto const& par : relevantParameters) {
875 auto est = cachedRegionSplitEstimates.find(par);
877 "Requested region split estimate for parameter " << par.name() <<
" but none was generated.");
887template<
typename SparseModelType,
typename ConstantType,
bool Robust>
898template<
typename SparseModelType,
typename ConstantType,
bool Robust>
899bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isOrderBasedMonotonicityBackend()
const {
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);
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);
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>;
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.
bool isRewardModelSet() const
Retrieves whether a reward model was set.
std::string const & getRewardModel() const
Retrieves the reward model over which to perform the checking (if set).
FormulaType const & getFormula() const
Retrieves the formula from this task.
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)
std::optional< RegionSplitEstimateKind > specifiedRegionSplitEstimateKind
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
SparseDtmcParameterLiftingModelChecker()
virtual void reset() 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 > ®ion, 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 ®ion, 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 > ®ion, storm::solver::OptimizationDirection dir, std::vector< ConstantType > const &newValues)
std::shared_ptr< SparseModelType > parametricModel
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.
void complement()
Negates all bits in the bit vector.
size_t size() const
Retrieves the number of bits this bit vector can store.
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)
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_ERROR_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification reachability()
bool supportsStateValueDeltaEstimates(storm::logic::Formula const &f)
bool supportsOrderBasedMonotonicity(storm::logic::Formula const &f)
@ StateValueDeltaWeighted
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...
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...
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...
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.
bool isZero(ValueType const &a)
ValueType abs(ValueType const &number)
TargetType convertNumber(SourceType const &number)
solver::OptimizationDirection OptimizationDirection