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>
81 "Combination of model " <<
parametricModel->getType() <<
" and formula '" << checkTask.
getFormula() <<
"' is not supported.");
84 this->graphPreservationStatus = graphPreservationStatus;
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());
97 simplifier.setPreserveParametricTransitions(
true);
98 STORM_LOG_THROW(simplifier.simplify(checkTask.
getFormula()), storm::exceptions::UnexpectedException,
"Simplifying the model was not successfull.");
99 this->parametricModel = simplifier.getSimplifiedModel();
102 this->parametricModel = dtmc;
105 if constexpr (!Robust) {
106 if (isOrderBasedMonotonicityBackend()) {
107 getOrderBasedMonotonicityBackend().registerParameterLifterReference(*parameterLifter);
108 getOrderBasedMonotonicityBackend().registerPLABoundFunction(
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);
120 this->derivativeChecker =
121 std::make_unique<storm::derivative::SparseDerivativeInstantiationModelChecker<ParametricType, ConstantType>>(*this->parametricModel);
122 this->derivativeChecker->specifyFormula(env, *this->currentCheckTaskNoBound);
126template<
typename SparseModelType,
typename ConstantType,
bool Robust>
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.");
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.");
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.");
149 storm::exceptions::NotSupportedException,
"Parameter lifting with non-propositional subformulas is not supported.");
151 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
152 .getTruthValuesVector());
154 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
155 .getTruthValuesVector());
159 maybeStates &= ~psiStates;
166 if (Robust || !maybeStates.empty()) {
168 std::vector<ParametricType> b = this->
parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
170 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
171 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates,
false, isOrderBasedMonotonicityBackend());
178 solverFactory->setRequirementsChecked(
true);
180 if (isOrderBasedMonotonicityBackend()) {
182 getOrderBasedMonotonicityBackend().initializeOrderExtender(prob1, prob0, this->
parametricModel->getTransitionMatrix());
186template<
typename SparseModelType,
typename ConstantType,
bool Robust>
193 storm::exceptions::NotSupportedException,
"Parameter lifting with non-propositional subformulas is not supported.");
195 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
196 .getTruthValuesVector());
198 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
199 .getTruthValuesVector());
202 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
204 maybeStates = ~(statesWithProbability01.first | statesWithProbability01.second);
211 if (Robust || !maybeStates.empty()) {
212 if constexpr (Robust) {
220 maybeStates = ~statesWithProbability01.first & ~psiStates;
226 auto rowFilter = this->
parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
227 auto filteredMatrix = this->
parametricModel->getTransitionMatrix().filterEntries(rowFilter);
229 maybeStates = allTrue;
231 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
232 filteredMatrix, target, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
235 std::vector<ParametricType> b = this->
parametricModel->getTransitionMatrix().getConstrainedRowSumVector(
237 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
238 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
239 isOrderBasedMonotonicityBackend());
249 auto req = solverFactory->getRequirements(env,
true,
true, boost::none, !Robust);
251 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
252 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
253 solverFactory->setRequirementsChecked(
true);
255 if (isOrderBasedMonotonicityBackend()) {
256 getOrderBasedMonotonicityBackend().initializeOrderExtender(statesWithProbability01.second, statesWithProbability01.first,
257 this->parametricModel->getTransitionMatrix());
261template<
typename SparseModelType,
typename ConstantType,
bool Robust>
267 "Parameter lifting with non-propositional subformulas is not supported.");
269 ->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>()
270 .getTruthValuesVector());
275 maybeStates = ~(targetStates | infinityStates);
282 if (Robust || !maybeStates.empty()) {
285 (!checkTask.
isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
286 storm::exceptions::InvalidPropertyException,
"The reward model specified by the CheckTask is not available in the given model.");
288 typename SparseModelType::RewardModelType
const& rewardModel =
291 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->
parametricModel->getTransitionMatrix());
293 if constexpr (Robust) {
296 maybeStates = ~targetStates;
298 auto rowFilter = this->
parametricModel->getTransitionMatrix().getRowFilter(maybeStates);
299 auto filteredMatrix = this->
parametricModel->getTransitionMatrix().filterEntries(rowFilter);
300 maybeStates = allTrue;
302 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
303 filteredMatrix, b, allTrue, allTrue, isValueDeltaRegionSplitEstimates(), isOrderBasedMonotonicityBackend());
305 parameterLifter = std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(
306 this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates, isValueDeltaRegionSplitEstimates(),
307 isOrderBasedMonotonicityBackend());
316 auto req = solverFactory->getRequirements(env,
true,
true, boost::none, !Robust);
317 req.clearLowerBounds();
318 if (req.upperBounds()) {
319 solvingRequiresUpperRewardBounds =
true;
320 req.clearUpperBounds();
322 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
323 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
324 solverFactory->setRequirementsChecked(
true);
325 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(),
"Order-based monotonicity not used for reachability reward formula.");
328template<
typename SparseModelType,
typename ConstantType,
bool Robust>
333 stepBound = checkTask.
getFormula().getBound().evaluateAsInt();
335 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
"Expected a strict upper step bound that is greater than zero.");
338 STORM_LOG_THROW(*stepBound > 0, storm::exceptions::NotSupportedException,
339 "Can not apply parameter lifting on step bounded formula: The step bound has to be positive.");
343 resultsForNonMaybeStates = std::vector<ExtendedConstantType>(this->
parametricModel->getNumberOfStates());
347 (!checkTask.
isRewardModelSet() && this->parametricModel->hasUniqueRewardModel()),
348 storm::exceptions::InvalidPropertyException,
"The reward model specified by the CheckTask is not available in the given model.");
349 typename SparseModelType::RewardModelType
const& rewardModel =
351 std::vector<ParametricType> b = rewardModel.getTotalRewardVector(this->
parametricModel->getTransitionMatrix());
354 std::make_unique<ParameterLifterType<ParametricType, ConstantType, Robust>>(this->
parametricModel->getTransitionMatrix(), b, maybeStates, maybeStates);
359 solverFactory->setRequirementsChecked(
true);
361 STORM_LOG_WARN_COND(!isOrderBasedMonotonicityBackend(),
"Order-based monotonicity not used for cumulative reward formula.");
364template<
typename SparseModelType,
typename ConstantType,
bool Robust>
367 if (!instantiationCheckerSAT) {
368 instantiationCheckerSAT =
369 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(env, *this->
parametricModel);
370 instantiationCheckerSAT->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
372 instantiationCheckerSAT->setInstantiationsAreGraphPreserving(
true);
374 return *instantiationCheckerSAT;
377template<
typename SparseModelType,
typename ConstantType,
bool Robust>
380 if (!instantiationCheckerVIO) {
381 instantiationCheckerVIO =
382 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(env, *this->
parametricModel);
383 instantiationCheckerVIO->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
385 instantiationCheckerVIO->setInstantiationsAreGraphPreserving(
true);
387 return *instantiationCheckerVIO;
390template<
typename SparseModelType,
typename ConstantType,
bool Robust>
393 if (!instantiationChecker) {
394 instantiationChecker =
395 std::make_unique<storm::modelchecker::SparseDtmcInstantiationModelChecker<SparseModelType, ConstantType>>(env, *this->
parametricModel);
396 instantiationChecker->specifyFormula(quantitative ? *this->currentCheckTaskNoBound
398 instantiationChecker->setInstantiationsAreGraphPreserving(
true);
400 return *instantiationChecker;
403template<
typename SparseModelType,
typename ConstantType,
bool Robust>
404std::vector<typename SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::ExtendedConstantType>
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<ExtendedConstantType>();
421 auto const& result = endComponentPreserver.
eliminateMECs(liftedMatrix, liftedVector);
423 liftedMatrix = *result;
424 nonTrivialEndComponents =
true;
428 const uint64_t resultVectorSize = liftedMatrix.getColumnCount();
431 if constexpr (!Robust) {
435 multiplier->repeatedMultiplyAndReduce(env, dirForParameters, x, &liftedVector, *stepBound);
440 auto solver = solverFactory->create(env, liftedMatrix);
441 solver->setHasUniqueSolution();
442 solver->setHasNoEndComponents();
444 solver->setUncertaintyResolutionMode(UncertaintyResolutionMode::Cooperative);
445 if (lowerResultBound) {
446 solver->setLowerBound(lowerResultBound.value());
448 if (upperResultBound) {
449 solver->setUpperBound(upperResultBound.value());
450 }
else if (solvingRequiresUpperRewardBounds) {
451 if constexpr (!Robust) {
453 std::vector<ConstantType> oneStepProbs;
454 oneStepProbs.reserve(liftedMatrix.getRowCount());
455 for (uint64_t row = 0; row < liftedMatrix.getRowCount(); ++row) {
458 if (dirForParameters == storm::OptimizationDirection::Minimize) {
469 solver->setTrackScheduler(
true);
475 if constexpr (!Robust) {
477 if (isOrderBasedMonotonicityBackend()) {
479 if (!choices.has_value()) {
480 choices.emplace(parameterLifter->getRowGroupCount(), 0u);
482 statesWithFixedChoice = getOrderBasedMonotonicityBackend().getChoicesToFixForPLASolver(
region, dirForParameters, *choices);
486 if (choices.has_value()) {
487 solver->setInitialScheduler(std::move(choices.value()));
488 if (statesWithFixedChoice.
size() != 0) {
490 solver->setSchedulerFixedForRowGroup(std::move(statesWithFixedChoice));
495 if (!nonTrivialEndComponents && choices.has_value()) {
496 solver->setInitialScheduler(std::move(choices.value()));
503 std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond;
509 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumBelowThreshold<ConstantType>>(
510 relevantStatesInSubsystem,
true, this->
currentCheckTask->getBoundThreshold(),
false);
513 termCond = std::make_unique<storm::solver::TerminateIfFilteredExtremumExceedsThreshold<ConstantType>>(
514 relevantStatesInSubsystem,
true, this->
currentCheckTask->getBoundThreshold(),
true);
516 solver->setTerminationCondition(std::move(termCond));
521 solver->solveEquations(env, dirForParameters, x, liftedVector);
522 if (isValueDeltaRegionSplitEstimates()) {
526 if (!nonTrivialEndComponents) {
527 choices =
solver->getSchedulerChoices();
532 std::vector<ExtendedConstantType> result = resultsForNonMaybeStates;
533 auto maybeStateResIt = x.begin();
534 for (uint64_t maybeState : maybeStates) {
535 result[maybeState] = *maybeStateResIt;
539 STORM_LOG_INFO(dirForParameters <<
" " <<
region.region <<
": " << result[this->getUniqueInitialState()]);
545template<
typename SparseModelType,
typename ConstantType,
bool Robust>
547 Environment const& env, std::vector<ConstantType>
const& quantitativeResult, std::vector<uint64_t>
const& schedulerChoices,
549 auto const& matrix = parameterLifter->getMatrix();
550 auto const& vector = parameterLifter->getVector();
557 auto const instantiatedModel = instantiator.
instantiate(
region.getCenterPoint());
560 uint64_t rowIndex = 0;
561 for (uint64_t state : maybeStates) {
574 std::map<VariableType, ConstantType> deltaLower, deltaUpper;
575 for (
auto const& p :
region.getVariables()) {
579 if constexpr (Robust) {
581 static std::map<RationalFunction, RationalFunction> functionDerivatives;
582 static std::vector<std::pair<bool, double>> constantDerivatives;
583 if (constantDerivatives.empty()) {
584 for (uint64_t state : maybeStates) {
585 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
586 if (variables.size() == 0) {
590 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
591 auto const p = *variables.begin();
592 for (
auto const& entry : this->
parametricModel->getTransitionMatrix().getRow(state)) {
593 auto const& function = entry.getValue();
594 if (functionDerivatives.count(function)) {
595 constantDerivatives.emplace_back(
false, 0);
598 auto const derivative = function.derivative(p);
602 functionDerivatives.emplace(function,
derivative);
603 constantDerivatives.emplace_back(
false, 0);
605 constantDerivatives.emplace_back(
false, 0);
611 cachedRegionSplitEstimates.clear();
612 for (
auto const& p :
region.getVariables()) {
616 uint64_t entryCount = 0;
618 for (uint64_t state : maybeStates) {
619 auto variables = parameterLifter->getOccurringVariablesAtState().at(state);
620 if (variables.size() == 0) {
624 "Cannot compute state-value-delta split estimates in robust mode if there are states with multiple parameters.");
626 auto const p = *variables.begin();
628 const uint64_t rowIndex = maybeStates.getNumberOfSetBitsBeforeIndex(state);
630 std::vector<ConstantType> derivatives;
631 for (
auto const& entry : this->
parametricModel->getTransitionMatrix().getRow(state)) {
638 auto const& cDer = constantDerivatives.at(entryCount);
640 derivatives.push_back(cDer.second);
649 std::vector<ConstantType> results(0);
654 for (
auto const& direction : {OptimizationDirection::Maximize, OptimizationDirection::Minimize}) {
663 "Non-constant vector indices not supported (this includes parametric rewards).");
665 std::vector<std::pair<ConstantType, std::pair<ConstantType, uint64_t>>> robustOrder;
668 for (
auto const& entry : matrix.getRow(rowIndex)) {
669 auto const lower = entry.getValue().lower();
670 result += quantitativeResult[entry.getColumn()] * lower;
671 remainingValue -= lower;
672 auto const diameter = entry.getValue().upper() - lower;
674 robustOrder.emplace_back(quantitativeResult[entry.getColumn()], std::make_pair(diameter, index));
679 std::sort(robustOrder.begin(), robustOrder.end(),
680 [direction](
const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& a,
681 const std::pair<ConstantType, std::pair<ConstantType, uint64_t>>& b) {
682 if (direction == OptimizationDirection::Maximize) {
683 return a.first > b.first;
685 return a.first < b.first;
689 for (
auto const& pair : robustOrder) {
690 auto availableMass = std::min(pair.second.first, remainingValue);
691 result += availableMass * pair.first;
694 if (derivatives[pair.second.second] > 1e-6) {
695 distrToPositiveDerivative += availableMass;
696 }
else if (derivatives[pair.second.second] < 1e-6) {
697 distrToNegativeDerivative += availableMass;
700 remainingValue -= availableMass;
703 results.push_back(result);
706 ConstantType diff = std::abs(results[0] - results[1]);
707 if (distrToPositiveDerivative > distrToNegativeDerivative) {
708 deltaUpper[p] += diff * weighting[rowIndex];
710 deltaLower[p] += diff * weighting[rowIndex];
714 auto const& choiceValuations = parameterLifter->getRowLabels();
716 std::vector<ConstantType> stateResults;
717 for (uint64_t state = 0; state < schedulerChoices.size(); ++state) {
718 uint64_t rowOffset = matrix.getRowGroupIndices()[state];
719 uint64_t optimalChoice = schedulerChoices[state];
720 auto const& optimalChoiceVal = choiceValuations[rowOffset + optimalChoice];
721 STORM_LOG_ASSERT(optimalChoiceVal.getUnspecifiedParameters().empty(),
"Expected no unspecified parameters.");
722 stateResults.clear();
723 for (uint64_t row = rowOffset; row < matrix.getRowGroupIndices()[state + 1]; ++row) {
724 stateResults.push_back(matrix.multiplyRowWithVector(row, quantitativeResult) + vector[row]);
727 bool checkUpperParameters =
false;
729 auto const& consideredParameters = checkUpperParameters ? optimalChoiceVal.getUpperParameters() : optimalChoiceVal.getLowerParameters();
730 for (
auto const& p : consideredParameters) {
732 ConstantType bestValue = 0;
733 bool foundBestValue =
false;
734 for (uint64_t choice = 0; choice < stateResults.size(); ++choice) {
735 if (choice != optimalChoice) {
736 auto const& otherBoundParsOfChoice = checkUpperParameters ? choiceValuations[rowOffset + choice].getLowerParameters()
737 : choiceValuations[rowOffset + choice].getUpperParameters();
738 if (otherBoundParsOfChoice.find(p) != otherBoundParsOfChoice.end()) {
739 ConstantType
const& choiceValue = stateResults[choice];
740 if (!foundBestValue ||
742 foundBestValue =
true;
743 bestValue = choiceValue;
748 auto const& optimal = stateResults[optimalChoice];
750 if (foundBestValue) {
751 if (checkUpperParameters) {
752 deltaLower[p] += diff * weighting[state];
754 deltaUpper[p] += diff * weighting[state];
758 checkUpperParameters = !checkUpperParameters;
759 }
while (checkUpperParameters);
763 cachedRegionSplitEstimates.clear();
764 for (
auto const& p :
region.getVariables()) {
766 auto minDelta = std::min(deltaLower[p], deltaUpper[p]);
767 cachedRegionSplitEstimates.emplace(p, minDelta);
776 instantiationModelChecker.
specifyFormula(*this->currentCheckTaskNoBound);
778 auto const center =
region.getCenterPoint();
780 std::unique_ptr<storm::modelchecker::CheckResult> result = instantiationModelChecker.
check(env, center);
781 auto const reachabilityProbabilities = result->asExplicitQuantitativeCheckResult<ConstantType>().getFiniteValueVector();
783 STORM_LOG_ASSERT(this->derivativeChecker,
"Derivative checker not intialized.");
785 for (
auto const& param :
region.getVariables()) {
786 auto result = this->derivativeChecker->check(env, center, param, reachabilityProbabilities);
788 result->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector()[this->derivativeChecker->getInitialState()]);
794 STORM_LOG_ERROR(
"Region split estimate kind not handled by SparseDtmcParameterLiftingModelChecker.");
798template<
typename SparseModelType,
typename ConstantType,
bool Robust>
800 maybeStates.resize(0);
801 resultsForNonMaybeStates.clear();
802 stepBound = std::nullopt;
803 instantiationChecker =
nullptr;
804 instantiationCheckerSAT =
nullptr;
805 instantiationCheckerVIO =
nullptr;
806 parameterLifter =
nullptr;
807 minSchedChoices = std::nullopt;
808 maxSchedChoices = std::nullopt;
810 lowerResultBound = std::nullopt;
811 upperResultBound = std::nullopt;
812 cachedRegionSplitEstimates.clear();
815template<
typename ConstantType>
816std::optional<storm::storage::Scheduler<ConstantType>>
getSchedulerHelper(std::optional<std::vector<uint64_t>>
const& choices) {
817 std::optional<storm::storage::Scheduler<ConstantType>> result;
819 result.emplace(choices->size());
821 for (
auto const& choice : choices.value()) {
822 result->setChoice(choice, state);
829template<
typename SparseModelType,
typename ConstantType,
bool Robust>
834template<
typename SparseModelType,
typename ConstantType,
bool Robust>
850 return sub.
isUntilFormula() || sub.isEventuallyFormula() || sub.isBoundedUntilFormula();
855template<
typename SparseModelType,
typename ConstantType,
bool Robust>
864template<
typename SparseModelType,
typename ConstantType,
bool Robust>
871template<
typename SparseModelType,
typename ConstantType,
bool Robust>
872std::vector<typename SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::CoefficientType>
874 std::set<VariableType>
const& relevantParameters)
const {
875 if (isValueDeltaRegionSplitEstimates()) {
877 std::vector<CoefficientType> result;
878 for (
auto const& par : relevantParameters) {
879 auto est = cachedRegionSplitEstimates.find(par);
881 "Requested region split estimate for parameter " << par.name() <<
" but none was generated.");
891template<
typename SparseModelType,
typename ConstantType,
bool Robust>
902template<
typename SparseModelType,
typename ConstantType,
bool Robust>
903bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isOrderBasedMonotonicityBackend()
const {
907template<
typename SparseModelType,
typename ConstantType,
bool Robust>
908OrderBasedMonotonicityBackend<typename SparseModelType::ValueType, ConstantType>&
909SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::getOrderBasedMonotonicityBackend() {
910 return dynamic_cast<OrderBasedMonotonicityBackend<ParametricType, ConstantType>&
>(*this->monotonicityBackend);
913template<
typename SparseModelType,
typename ConstantType,
bool Robust>
914bool SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robust>::isValueDeltaRegionSplitEstimates()
const {
915 return this->getSpecifiedRegionSplitEstimateKind().has_value() &&
916 (this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDelta ||
917 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::StateValueDeltaWeighted ||
918 this->getSpecifiedRegionSplitEstimateKind().value() == RegionSplitEstimateKind::Derivative);
921template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double,
false>;
922template class SparseDtmcParameterLiftingModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double,
true>;
923template 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 > & getInstantiationCheckerVIO(Environment const &env, 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 std::vector< ExtendedConstantType > computeQuantitativeValues(Environment const &env, AnnotatedRegion< ParametricType > ®ion, storm::solver::OptimizationDirection const &dirForParameters) override
SparseDtmcParameterLiftingModelChecker()
virtual void reset() override
virtual void specifyBoundedUntilFormula(const CheckTask< storm::logic::BoundedUntilFormula, ConstantType > &checkTask) 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)
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationCheckerSAT(Environment const &env, bool qualitative) override
virtual storm::modelchecker::SparseInstantiationModelChecker< SparseModelType, ConstantType > & getInstantiationChecker(Environment const &env, bool qualitative) override
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 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, storm::pars::analysis::GraphPreservationStatus graphPreservationStatus=storm::pars::analysis::GraphPreservationStatus::GraphPreserving) override
virtual void specifyUntilFormula(Environment const &env, CheckTask< storm::logic::UntilFormula, ConstantType > const &checkTask) override
typename SparseParameterLiftingModelChecker< SparseModelType, ConstantType >::ExtendedConstantType ExtendedConstantType
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)
void updateKnownValueBoundInRegion(AnnotatedRegion< ParametricType > ®ion, storm::solver::OptimizationDirection dir, std::vector< ExtendedConstantType > const &newValues)
std::unique_ptr< CheckTask< storm::logic::Formula, ConstantType > > currentCheckTask
void specifyFormula(Environment const &env, CheckTask< storm::logic::Formula, ParametricType > const &checkTask)
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< ExtendedValueType > 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
GraphPreservationStatus
Describes to what extent a set of regions is known to be well-defined and to preserve the graph struc...
bool isGraphPreserving(GraphPreservationStatus status)
Returns whether the given status guarantees that the graph structure of the model is preserved.
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< S > const &values)
Sets the provided values at the provided positions in the given vector.
ExtendedValueType< ValueType > positiveInfinity()
bool isZero(ValueType const &a)
ValueType abs(ValueType const &number)
std::vector< ValueType > narrowFinite(std::vector< ExtendedValueType< ValueType > > &&values)
The counterpart of widen for a vector all of whose values are finite.
bool isInfinity(ValueType const &a)
ValueType const & getFinite(ExtendedNumber< ValueType > const &value)
TargetType convertNumber(SourceType const &number)
solver::OptimizationDirection OptimizationDirection