39namespace modelchecker {
42template<
typename ValueType,
typename SolutionType>
46 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
47 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing reward bounded values with interval models.");
60 std::vector<ValueType> x, b;
61 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> minMaxSolver;
64 initEpoch, storm::utility::convertNumber<ValueType>(storm::settings::getModule<storm::settings::modules::GeneralSettings>().getPrecision()));
69 std::vector<std::vector<ValueType>> cdfData;
74 uint64_t numCheckedEpochs = 0;
75 for (
auto const& epoch : epochOrder) {
80 rewardUnfolding.
setSolutionForCurrentEpoch(epochModel.analyzeSingleObjective(preciseEnv, dir, x, b, minMaxSolver, lowerBound, upperBound));
82 if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet() &&
84 std::vector<ValueType> cdfEntry;
91 cdfData.push_back(std::move(cdfEntry));
100 std::map<storm::storage::sparse::state_type, ValueType> result;
101 for (
auto initState : initialStates) {
107 if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet()) {
108 std::vector<std::string> headers;
110 headers.push_back(rewardUnfolding.
getDimension(i).formula->toString());
112 headers.push_back(
"Result");
113 storm::io::exportDataToCSVFile<ValueType, std::string, std::string>(
114 storm::settings::getModule<storm::settings::modules::IOSettings>().getExportCdfDirectory() +
"cdf.csv", cdfData, headers);
117 if (storm::settings::getModule<storm::settings::modules::CoreSettings>().isShowStatisticsSet()) {
132template<
typename ValueType,
typename SolutionType>
136 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
137 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support next probabilities with reward models.");
144 multiplier->multiplyAndReduce(env, dir, result,
nullptr, result);
150template<
typename ValueType,
typename SolutionType = ValueType>
156 boost::optional<storm::storage::BitVector>
const& selectedChoices) {
164 validScheduler, selectedChoices);
170 std::vector<uint64_t> schedulerHint;
172 if (selectedChoices) {
174 for (
auto maybeState : maybeStates) {
175 auto choice = validScheduler.
getChoice(maybeState).getDeterministicChoice();
177 auto const origGlobalChoiceIndex = groupStart + choice;
178 STORM_LOG_ASSERT(selectedChoices->get(origGlobalChoiceIndex),
"The computed scheduler selects an illegal choice.");
180 for (
auto pos = selectedChoices->getNextUnsetIndex(groupStart); pos < origGlobalChoiceIndex; pos = selectedChoices->getNextUnsetIndex(pos + 1)) {
183 schedulerHint.push_back(choice);
186 for (
auto maybeState : maybeStates) {
187 schedulerHint.push_back(validScheduler.
getChoice(maybeState).getDeterministicChoice());
190 return schedulerHint;
193template<
typename ValueType>
270template<
typename ValueType,
typename SolutionType>
273 boost::optional<storm::storage::BitVector>
const& selectedChoices,
ModelCheckerHint const& hint,
274 bool skipECWithinMaybeStatesCheck) {
278 STORM_LOG_WARN(
"A scheduler hint was provided, but the solver requires a specific one. The provided scheduler hint will be ignored.");
280 auto const& schedulerHint = hint.template asExplicitModelCheckerHint<ValueType>().getSchedulerHint();
281 std::vector<uint64_t> hintChoices;
285 if (!skipECWithinMaybeStatesCheck) {
286 hintChoices.reserve(maybeStates.
size());
287 for (uint_fast64_t state = 0; state < maybeStates.
size(); ++state) {
288 hintChoices.push_back(schedulerHint.getChoice(state).getDeterministicChoice());
293 hintApplicable =
true;
296 if (hintApplicable) {
300 for (
auto state : maybeStates) {
301 uint_fast64_t hintChoice = schedulerHint.getChoice(state).getDeterministicChoice();
302 if (selectedChoices) {
304 uint_fast64_t lastChoice = firstChoice + hintChoice;
306 for (uint_fast64_t choice = selectedChoices->getNextSetIndex(firstChoice); choice < lastChoice;
307 choice = selectedChoices->getNextSetIndex(choice + 1)) {
311 hintChoices.push_back(hintChoice);
327template<
typename ValueType,
typename SolutionType>
332 boost::optional<storm::storage::BitVector>
const& selectedChoices = boost::none) {
346 bool hasSchedulerHint = hint.
isExplicitModelCheckerHint() && hint.template asExplicitModelCheckerHint<ValueType>().hasSchedulerHint();
354 "The solver requires to eliminate the end components although the solution is already assumed to be unique.");
355 STORM_LOG_DEBUG(
"Scheduling EC elimination, because the solver requires a unique solution.");
367 STORM_LOG_DEBUG(
"Computing valid scheduler, because the solver requires it.");
368 result.
schedulerHint = computeValidSchedulerHint<ValueType, SolutionType>(env, type, transitionMatrix, backwardTransitions, maybeStates, phiStates,
369 targetStates, selectedChoices);
395 STORM_LOG_TRACE(
"Warn A non-empty hint was provided, but its information will be disregarded.");
415template<
typename ValueType>
437template<
typename ValueType,
typename SolutionType>
442 std::vector<SolutionType> x =
444 : std::vector<SolutionType>(submatrix.getRowGroupCount(),
449 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType, SolutionType>> solver =
451 solver->setRequirementsChecked();
452 solver->setUncertaintyIsRobust(goal.isRobust());
467 solver->setTrackScheduler(produceScheduler);
470 solver->solveEquations(env, x, b);
475 uint64_t relevantState = solver->hasRelevantValues() ? solver->getRelevantValues().getNextSetIndex(0ull) : 0ull;
476 std::function<void()> getNextRelevantStateIndex;
477 if (solver->hasRelevantValues()) {
479 getNextRelevantStateIndex = [&relevantState, &relevantValues]() { relevantState = relevantValues.
getNextSetIndex(++relevantState); };
481 getNextRelevantStateIndex = [&relevantState]() { ++relevantState; };
483 for (; relevantState < solver->getUpperBounds().size(); getNextRelevantStateIndex()) {
485 solver->getUpperBounds().at(relevantState) + storm::utility::convertNumber<ValueType>(env.
solver().
minMax().
getPrecision()),
486 "Expecting result value for state " << relevantState <<
" to be <= " << solver->getUpperBounds().at(relevantState) <<
", but got "
487 << x.at(relevantState) <<
".");
496 if (produceScheduler) {
497 result.
scheduler = std::move(solver->getSchedulerChoices());
508template<
typename ValueType>
511 result.
maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
514 std::vector<ValueType>
const& resultsForNonMaybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getResultHint();
518 for (
auto state : nonMaybeStates) {
523 "Expected that the result hint specifies probabilities in {0,1} for non-maybe states");
531template<
typename ValueType,
typename SolutionType>
540 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01;
542 statesWithProbability01 =
545 statesWithProbability01 =
555template<
typename ValueType,
typename SolutionType>
562 return getQualitativeStateSetsUntilProbabilitiesFromHint<ValueType>(hint);
568template<
typename SolutionType,
bool subChoicesCoverOnlyMaybeStates = true>
571 if constexpr (subChoicesCoverOnlyMaybeStates) {
572 auto subChoiceIt = subChoices.begin();
573 for (
auto maybeState : maybeStates) {
574 scheduler.
setChoice(*subChoiceIt, maybeState);
577 assert(subChoiceIt == subChoices.end());
582 for (
auto maybeState : maybeStates) {
583 scheduler.
setChoice(subChoices[maybeState], maybeState);
588template<
typename ValueType,
typename SolutionType>
610template<
typename ValueType,
typename SolutionType>
615 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
642template<
typename ValueType,
typename SolutionType>
651 bool doDecomposition = !candidateStates.
empty();
654 if (doDecomposition) {
661 if (doDecomposition && !endComponentDecomposition.
empty()) {
665 submatrix, &b,
nullptr, produceScheduler);
675 if (!newRelevantValues.
empty()) {
689template<
typename ValueType,
typename SolutionType>
694 STORM_LOG_THROW(!qualitative || !produceScheduler, storm::exceptions::InvalidSettingsException,
695 "Cannot produce scheduler when performing qualitative model checking only.");
698 std::vector<SolutionType> result(transitionMatrix.
getRowGroupCount(), storm::utility::zero<SolutionType>());
710 storm::utility::vector::setVectorValues<SolutionType>(result, qualitativeStateSets.
statesWithProbability1, storm::utility::one<SolutionType>());
713 bool maybeStatesNotRelevant = goal.hasRelevantValues() && goal.relevantValues().isDisjointFrom(qualitativeStateSets.
maybeStates);
716 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
717 if (produceScheduler) {
718 scheduler = std::make_unique<storm::storage::Scheduler<SolutionType>>(transitionMatrix.
getRowGroupCount());
720 if (maybeStatesNotRelevant) {
721 for (
auto state : qualitativeStateSets.
maybeStates) {
722 scheduler->setDontCare(state);
728 if (qualitative || maybeStatesNotRelevant) {
730 storm::utility::vector::setVectorValues<SolutionType>(result, qualitativeStateSets.
maybeStates, storm::utility::convertNumber<SolutionType>(0.5));
742 std::vector<ValueType> b;
745 boost::optional<SparseMdpEndComponentInformation<ValueType>> ecInformation;
748 qualitativeStateSets, submatrix, b, produceScheduler);
759 if (ecInformation && ecInformation.get().getEliminatedEndComponents()) {
760 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
761 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support this end component with interval models.");
763 ecInformation.get().setValues(result, qualitativeStateSets.
maybeStates, resultForMaybeStates.
getValues());
764 if (produceScheduler) {
765 ecInformation.get().setScheduler(*scheduler, qualitativeStateSets.
maybeStates, transitionMatrix, backwardTransitions,
771 if constexpr (!std::is_same_v<ValueType, storm::Interval>) {
773 storm::utility::vector::setVectorValues<SolutionType>(result, qualitativeStateSets.
maybeStates, resultForMaybeStates.
getValues());
777 result = resultForMaybeStates.
getValues();
779 if (produceScheduler) {
780 extractSchedulerChoices<SolutionType, !std::is_same_v<ValueType, storm::Interval>>(*scheduler, resultForMaybeStates.
getScheduler(),
788 if (produceScheduler) {
789 extendScheduler(*scheduler, goal, qualitativeStateSets, transitionMatrix, backwardTransitions, phiStates, psiStates);
793 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
794 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler");
795 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler");
796 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler");
802template<
typename ValueType,
typename SolutionType>
806 bool useMecBasedTechnique) {
807 if (useMecBasedTechnique) {
811 for (
auto const& mec : mecDecomposition) {
812 for (
auto const& stateActionsPair : mec) {
813 statesInPsiMecs.
set(stateActionsPair.first,
true);
817 return computeUntilProbabilities(env, std::move(goal), transitionMatrix, backwardTransitions, psiStates, statesInPsiMecs, qualitative,
822 computeUntilProbabilities(env, std::move(goal), transitionMatrix, backwardTransitions,
824 for (
auto& element : result.values) {
825 element = storm::utility::one<SolutionType>() - element;
831template<
typename ValueType,
typename SolutionType>
832template<
typename RewardModelType>
835 RewardModelType
const& rewardModel, uint_fast64_t stepCount) {
836 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
837 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support instantenous rewards with interval models.");
840 STORM_LOG_THROW(rewardModel.hasStateRewards(), storm::exceptions::InvalidPropertyException,
841 "Computing instantaneous rewards for a reward model that does not define any state-rewards. The result is trivially 0.");
843 std::vector<SolutionType> result(rewardModel.getStateRewardVector());
846 multiplier->repeatedMultiplyAndReduce(env, goal.direction(), result,
nullptr, stepCount);
852template<
typename ValueType,
typename SolutionType>
853template<
typename RewardModelType>
856 RewardModelType
const& rewardModel, uint_fast64_t stepBound) {
857 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
858 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support cumulative rewards with interval models.");
861 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
864 std::vector<ValueType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
867 std::vector<SolutionType> result(transitionMatrix.
getRowGroupCount(), storm::utility::zero<SolutionType>());
870 multiplier->repeatedMultiplyAndReduce(env, goal.direction(), result, &totalRewardVector, stepBound);
876template<
typename ValueType,
typename SolutionType>
877template<
typename RewardModelType>
882 STORM_LOG_THROW(!rewardModel.hasNegativeRewards(), storm::exceptions::NotImplementedException,
883 "The reward model contains negative rewards. This is not implemented by the total rewards computation.");
885 if (goal.minimize()) {
889 for (uint64_t state = 0; state < transitionMatrix.
getRowGroupCount(); ++state) {
891 statesWithZeroRewardChoice.
set(state);
896 statesWithZeroRewardChoice, ~statesWithZeroRewardChoice,
false, 0, choicesWithoutReward);
898 auto result = computeReachabilityRewards(env, std::move(goal), transitionMatrix, backwardTransitions, rewardModel, rew0EStates, qualitative,
899 produceScheduler, hint);
900 if (result.scheduler) {
915 return computeReachabilityRewards(env, std::move(goal), transitionMatrix, backwardTransitions, rewardModel, rew0AStates, qualitative,
916 produceScheduler, hint);
919 STORM_LOG_ERROR_COND(!produceScheduler,
"Can not produce scheduler for this property (functionality not implemented");
924 for (
auto oldRew0AState : rew0AStates) {
925 newRew0AStates.
set(ecElimResult.oldToNewStateMapping[oldRew0AState]);
928 if (goal.hasRelevantValues()) {
930 for (
auto oldRelevantState : goal.relevantValues()) {
931 newRelevantValues.
set(ecElimResult.oldToNewStateMapping[oldRelevantState]);
933 goal.relevantValues() = std::move(newRelevantValues);
937 env, std::move(goal), ecElimResult.matrix, ecElimResult.matrix.transpose(
true),
939 std::vector<ValueType> result;
940 std::vector<ValueType> oldChoiceRewards = rewardModel.getTotalRewardVector(transitionMatrix);
941 result.reserve(rowCount);
942 for (uint64_t newState : maybeStates) {
943 for (auto newChoice : newTransitionMatrix.getRowGroupIndices(newState)) {
944 uint64_t oldChoice = ecElimResult.newToOldRowMapping[newChoice];
945 result.push_back(oldChoiceRewards[oldChoice]);
948 STORM_LOG_ASSERT(result.size() == rowCount,
"Unexpected size of reward vector.");
951 newRew0AStates, qualitative,
false,
954 for (
auto oldStateWithoutRew : statesWithoutReward) {
955 newStatesWithoutReward.
set(ecElimResult.oldToNewStateMapping[oldStateWithoutRew]);
957 return newStatesWithoutReward;
961 for (uint64_t newChoice = 0; newChoice < ecElimResult.matrix.getRowCount(); ++newChoice) {
962 if (choicesWithoutReward.get(ecElimResult.newToOldRowMapping[newChoice])) {
963 newChoicesWithoutReward.
set(newChoice);
966 return newChoicesWithoutReward;
969 std::vector<SolutionType> resultInEcQuotient = std::move(result.values);
970 result.values.resize(ecElimResult.oldToNewStateMapping.size());
977template<
typename ValueType,
typename SolutionType>
978template<
typename RewardModelType>
981 RewardModelType
const& rewardModel, uint_fast64_t stepBound, ValueType discountFactor) {
983 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
986 std::vector<SolutionType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
989 std::vector<SolutionType> result(transitionMatrix.
getRowGroupCount(), storm::utility::zero<ValueType>());
992 multiplier->repeatedMultiplyAndReduceWithFactor(env, goal.direction(), result, &totalRewardVector, stepBound, discountFactor);
997template<
typename ValueType,
typename SolutionType>
998template<
typename RewardModelType>
1005 "Exact solving of discounted total reward objectives is currently not supported.");
1007 std::vector<ValueType> b;
1009 std::vector<SolutionType> x = std::vector<SolutionType>(transitionMatrix.
getRowGroupCount(), storm::utility::zero<SolutionType>());
1010 b = rewardModel.getTotalRewardVector(transitionMatrix);
1015 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
1016 if (produceScheduler) {
1017 scheduler = std::make_unique<storm::storage::Scheduler<ValueType>>(discountingHelper.
computeScheduler());
1019 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
1020 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler");
1021 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler");
1022 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler");
1026template<
typename ValueType,
typename SolutionType>
1027template<
typename RewardModelType>
1033 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Reward model for formula is empty. Skipping formula.");
1034 return computeReachabilityRewardsHelper(
1035 env, std::move(goal), transitionMatrix, backwardTransitions,
1037 return rewardModel.getTotalRewardVector(rowCount, transitionMatrix, maybeStates);
1039 targetStates, qualitative, produceScheduler, [&]() {
return rewardModel.getStatesWithZeroReward(transitionMatrix); },
1040 [&]() {
return rewardModel.getChoicesWithZeroReward(transitionMatrix); }, hint);
1043template<
typename ValueType,
typename SolutionType>
1048 return computeReachabilityRewardsHelper(
1049 env, std::move(goal), transitionMatrix, backwardTransitions,
1051 return std::vector<ValueType>(rowCount, storm::utility::one<ValueType>());
1057template<
typename ValueType,
typename SolutionType>
1063 STORM_LOG_THROW(!intervalRewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
1064 return computeReachabilityRewardsHelper(
1065 env, std::move(goal), transitionMatrix, backwardTransitions,
1067 std::vector<ValueType> result;
1068 result.reserve(rowCount);
1069 std::vector<storm::Interval> subIntervalVector = intervalRewardModel.
getTotalRewardVector(rowCount, transitionMatrix, maybeStates);
1070 for (
auto const& interval : subIntervalVector) {
1071 result.push_back(lowerBoundOfIntervals ? interval.lower() : interval.upper());
1075 targetStates, qualitative,
false,
1092 STORM_LOG_THROW(
false, storm::exceptions::IllegalFunctionCallException,
"Computing reachability rewards is unsupported for this data type.");
1101template<
typename ValueType>
1105 result.
maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
1108 std::vector<ValueType>
const& resultsForNonMaybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getResultHint();
1112 for (
auto state : nonMaybeStates) {
1117 "Expected that the result hint specifies probabilities in {0,infinity} for non-maybe states");
1124template<
typename ValueType,
typename SolutionType>
1140 if (storm::settings::getModule<storm::settings::modules::ModelCheckerSettings>().isFilterRewZeroSet()) {
1143 trueStates, targetStates, zeroRewardChoicesGetter());
1146 zeroRewardStatesGetter(), targetStates);
1155template<
typename ValueType,
typename SolutionType>
1162 if (hint.
isExplicitModelCheckerHint() && hint.template asExplicitModelCheckerHint<ValueType>().getComputeOnlyMaybeStates()) {
1163 return getQualitativeStateSetsReachabilityRewardsFromHint<ValueType>(hint, targetStates);
1166 zeroRewardChoicesGetter);
1170template<
typename ValueType,
typename SolutionType>
1179 qualitativeStateSets.
rewardZeroStates, targetStates, scheduler, zeroRewardChoicesGetter());
1191template<
typename ValueType,
typename SolutionType>
1194 boost::optional<storm::storage::BitVector>
const& selectedChoices) {
1195 auto subChoiceIt = subChoices.begin();
1196 if (selectedChoices) {
1197 for (
auto maybeState : maybeStates) {
1200 uint_fast64_t selectedRowIndex = selectedChoices->getNextSetIndex(firstRowIndex);
1201 for (uint_fast64_t choice = 0; choice < *subChoiceIt; ++choice) {
1202 selectedRowIndex = selectedChoices->getNextSetIndex(selectedRowIndex + 1);
1204 scheduler.
setChoice(selectedRowIndex - firstRowIndex, maybeState);
1208 for (
auto maybeState : maybeStates) {
1209 scheduler.
setChoice(*subChoiceIt, maybeState);
1213 assert(subChoiceIt == subChoices.end());
1216template<
typename ValueType,
typename SolutionType>
1221 totalStateRewardVectorGetter,
1227 b = totalStateRewardVectorGetter(submatrix.
getRowCount(), transitionMatrix, qualitativeStateSets.
maybeStates);
1228 if (oneStepTargetProbabilities) {
1229 (*oneStepTargetProbabilities) =
1234 b = totalStateRewardVectorGetter(transitionMatrix.
getRowCount(), transitionMatrix,
1237 if (oneStepTargetProbabilities) {
1246template<
typename ValueType,
typename SolutionType>
1250 boost::optional<storm::storage::BitVector>
const& selectedChoices,
1252 totalStateRewardVectorGetter,
1254 bool produceScheduler) {
1259 std::vector<ValueType> rewardVector =
1263 for (
auto const& e : rewardVector) {
1265 zeroRewardChoices.
set(index);
1272 for (
auto state : qualitativeStateSets.
maybeStates) {
1273 bool keepState =
false;
1276 if (zeroRewardChoices.
get(row)) {
1283 candidateStates.
set(state,
false);
1291 bool doDecomposition = !candidateStates.
empty();
1294 if (doDecomposition) {
1296 endComponentDecomposition =
1302 if (doDecomposition && !endComponentDecomposition.
empty()) {
1305 endComponentDecomposition, transitionMatrix, qualitativeStateSets.
maybeStates,
1306 oneStepTargetProbabilities ? &qualitativeStateSets.
rewardZeroStates :
nullptr, selectedChoices ? &selectedChoices.get() :
nullptr, &rewardVector,
1307 submatrix, oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() :
nullptr, &b, produceScheduler);
1317 if (!newRelevantValues.
empty()) {
1326 oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() :
nullptr);
1331template<
typename ValueType,
typename SolutionType>
1334 std::vector<ValueType>
const& oneStepTargetProbabilities) {
1335 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
1336 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing upper reward bounds with interval models.");
1339 if (direction == storm::OptimizationDirection::Minimize) {
1349template<
typename ValueType,
typename SolutionType>
1350MDPSparseModelCheckingHelperReturnType<SolutionType> SparseMdpPrctlHelper<ValueType, SolutionType>::computeReachabilityRewardsHelper(
1354 totalStateRewardVectorGetter,
1359 std::vector<SolutionType> result(transitionMatrix.
getRowGroupCount(), storm::utility::zero<SolutionType>());
1362 QualitativeStateSetsReachabilityRewards qualitativeStateSets = getQualitativeStateSetsReachabilityRewards(
1363 goal, transitionMatrix, backwardTransitions, targetStates, hint, zeroRewardStatesGetter, zeroRewardChoicesGetter);
1365 STORM_LOG_INFO(
"Preprocessing: " << qualitativeStateSets.infinityStates.getNumberOfSetBits() <<
" states with reward infinity, "
1366 << qualitativeStateSets.rewardZeroStates.getNumberOfSetBits() <<
" states with reward zero ("
1367 << qualitativeStateSets.maybeStates.getNumberOfSetBits() <<
" states remaining).");
1372 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
1373 if (produceScheduler) {
1374 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
1375 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support producing schedulers in this function with interval models.");
1377 scheduler = std::make_unique<storm::storage::Scheduler<SolutionType>>(transitionMatrix.
getRowGroupCount());
1385 if (qualitative || maybeStatesNotRelevant) {
1386 STORM_LOG_INFO(
"The rewards for the initial states were determined in a preprocessing step. No exact rewards were computed.");
1389 storm::utility::vector::setVectorValues<SolutionType>(result, qualitativeStateSets.maybeStates, storm::utility::one<SolutionType>());
1391 if (!qualitativeStateSets.maybeStates.empty()) {
1395 boost::optional<storm::storage::BitVector> selectedChoices;
1396 if (!qualitativeStateSets.infinityStates.empty()) {
1397 selectedChoices = transitionMatrix.
getRowFilter(qualitativeStateSets.maybeStates, ~qualitativeStateSets.infinityStates);
1401 SparseMdpHintType<SolutionType> hintInformation = computeHints<ValueType, SolutionType>(
1402 env, SemanticSolutionType::ExpectedRewards, hint, goal.
direction(), transitionMatrix, backwardTransitions, qualitativeStateSets.maybeStates,
1403 ~qualitativeStateSets.rewardZeroStates, qualitativeStateSets.rewardZeroStates, produceScheduler, selectedChoices);
1407 std::vector<ValueType> b;
1411 boost::optional<std::vector<ValueType>> oneStepTargetProbabilities;
1412 if (hintInformation.getComputeUpperBounds()) {
1413 oneStepTargetProbabilities = std::vector<ValueType>();
1417 boost::optional<SparseMdpEndComponentInformation<ValueType>> ecInformation;
1418 if (hintInformation.getEliminateEndComponents()) {
1419 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
1420 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support eliminating end components with interval models.");
1423 goal, transitionMatrix, backwardTransitions, qualitativeStateSets, selectedChoices, totalStateRewardVectorGetter, submatrix, b,
1424 oneStepTargetProbabilities, produceScheduler);
1429 submatrix, b, oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() : nullptr);
1433 if (hintInformation.getComputeUpperBounds()) {
1434 STORM_LOG_ASSERT(oneStepTargetProbabilities,
"Expecting one step target probability vector to be available.");
1439 MaybeStateResult<SolutionType> resultForMaybeStates =
1443 if (ecInformation && ecInformation.get().getEliminatedEndComponents()) {
1444 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
1445 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support eliminating end components with interval models.");
1447 ecInformation.get().setValues(result, qualitativeStateSets.maybeStates, resultForMaybeStates.getValues());
1448 if (produceScheduler) {
1449 ecInformation.get().setScheduler(*scheduler, qualitativeStateSets.maybeStates, transitionMatrix, backwardTransitions,
1450 resultForMaybeStates.getScheduler());
1455 storm::utility::vector::setVectorValues<SolutionType>(result, qualitativeStateSets.maybeStates, resultForMaybeStates.getValues());
1456 if (produceScheduler) {
1457 extractSchedulerChoices(*scheduler, transitionMatrix, resultForMaybeStates.getScheduler(), qualitativeStateSets.maybeStates,
1465 if (produceScheduler) {
1466 extendScheduler(*scheduler, goal, qualitativeStateSets, transitionMatrix, backwardTransitions, targetStates, zeroRewardChoicesGetter);
1470 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
1471 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler");
1472 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler");
1473 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler");
1475 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
1476 return MDPSparseModelCheckingHelperReturnType<SolutionType>(std::move(result));
1478 return MDPSparseModelCheckingHelperReturnType<SolutionType>(std::move(result), std::move(scheduler));
1482template class SparseMdpPrctlHelper<double>;
1486 uint_fast64_t stepCount);
1490 uint_fast64_t stepBound);
1491template std::vector<double> SparseMdpPrctlHelper<double>::computeDiscountedCumulativeRewards(
1494template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeReachabilityRewards(
1498template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeTotalRewards(
1501 bool produceScheduler, ModelCheckerHint
const& hint);
1502template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeDiscountedTotalRewards(
1505 bool produceScheduler,
double discountFactor, ModelCheckerHint
const& hint);
1507template class SparseMdpPrctlHelper<storm::RationalNumber>;
1508template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeInstantaneousRewards(
1511template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeCumulativeRewards(
1514template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeDiscountedCumulativeRewards(
1517template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeReachabilityRewards(
1521 bool produceScheduler, ModelCheckerHint
const& hint);
1522template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeTotalRewards(
1526 ModelCheckerHint
const& hint);
1527template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeDiscountedTotalRewards(
1531 storm::RationalNumber discountFactor, ModelCheckerHint
const& hint);
1533template class SparseMdpPrctlHelper<storm::Interval, double>;
1534template std::vector<double> SparseMdpPrctlHelper<storm::Interval, double>::computeInstantaneousRewards(
1537template std::vector<double> SparseMdpPrctlHelper<storm::Interval, double>::computeCumulativeRewards(
1540template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<storm::Interval, double>::computeReachabilityRewards(
1544template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<storm::Interval, double>::computeTotalRewards(
1547 bool qualitative,
bool produceScheduler, ModelCheckerHint
const& hint);
SolverEnvironment & solver()
storm::RationalNumber const & getPrecision() const
void setPrecision(storm::RationalNumber value)
MinMaxSolverEnvironment & minMax()
bool isForceExact() const
This class contains information that might accelerate the model checking process.
virtual bool isExplicitModelCheckerHint() const
ExplicitModelCheckerHint< ValueType > & asExplicitModelCheckerHint()
virtual bool isEmpty() const
ValueType computeUpperBound()
Computes an upper bound on the expected rewards.
storm::storage::Scheduler< ValueType > computeScheduler() const
Retrieves the generated scheduler.
bool solveWithDiscountedValueIteration(Environment const &env, std::optional< OptimizationDirection > dir, std::vector< ValueType > &x, std::vector< ValueType > const &b) const
std::vector< ValueType > computeUpperBounds()
Computes upper bounds on the expected rewards.
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeGloballyProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &psiStates, bool qualitative, bool produceScheduler, bool useMecBasedTechnique=false)
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< SolutionType > computeCumulativeRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound)
static std::vector< SolutionType > computeInstantaneousRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepCount)
static std::map< storm::storage::sparse::state_type, SolutionType > computeRewardBoundedValues(Environment const &env, OptimizationDirection dir, rewardbounded::MultiDimensionalRewardUnfolding< ValueType, true > &rewardUnfolding, storm::storage::BitVector const &initialStates)
static std::vector< SolutionType > computeNextProbabilities(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
bool hasBottomDimension(Epoch const &epoch) const
uint64_t const & getDimensionCount() const
uint64_t getDimensionOfEpoch(Epoch const &epoch, uint64_t const &dimension) const
Epoch getStartEpoch(bool setUnknownDimsToBottom=false)
Retrieves the desired epoch that needs to be analyzed to compute the reward bounded values.
SolutionType getInitialStateResult(Epoch const &epoch)
Dimension< ValueType > const & getDimension(uint64_t dim) const
EpochManager const & getEpochManager() const
EpochModel< ValueType, SingleObjectiveMode > & setCurrentEpoch(Epoch const &epoch)
std::vector< Epoch > getEpochComputationOrder(Epoch const &startEpoch, bool stopAtComputedEpochs=false)
Computes a sequence of epochs that need to be analyzed to get a result at the start epoch.
ValueType getRequiredEpochModelPrecision(Epoch const &startEpoch, ValueType const &precision)
Returns the precision required for the analyzis of each epoch model in order to achieve the given ove...
boost::optional< ValueType > getLowerObjectiveBound(uint64_t objectiveIndex=0)
void setSolutionForCurrentEpoch(std::vector< SolutionType > &&inStateSolutions)
boost::optional< ValueType > getUpperObjectiveBound(uint64_t objectiveIndex=0)
Returns an upper/lower bound for the objective result in every state (if this bound could be computed...
bool empty() const
Retrieves whether the reward model is empty, i.e.
std::vector< ValueType > getTotalRewardVector(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
Creates a vector representing the complete reward vector based on the state-, state-action- and trans...
storm::storage::BitVector getChoicesWithFilter(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::function< bool(ValueType const &)> const &filter) const
Returns the set of choices for which all associated rewards (state, action or transition rewards) sat...
storm::storage::BitVector getStatesWithFilter(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::function< bool(ValueType const &)> const &filter) const
Returns the set of states for which all associated rewards (state, action or transition rewards) sati...
MinMaxLinearEquationSolverRequirements getRequirements(Environment const &env, bool hasUniqueSolution=false, bool hasNoEndComponents=false, boost::optional< storm::solver::OptimizationDirection > const &direction=boost::none, bool hasInitialScheduler=false, bool trackScheduler=false) const
Retrieves the requirements of the solver that would be created when calling create() right now.
SolverRequirement const & validInitialScheduler() const
void clearValidInitialScheduler()
void clearUniqueSolution()
bool hasEnabledRequirement() const
SolverRequirement const & uniqueSolution() const
bool hasEnabledCriticalRequirement() const
std::string getEnabledRequirementsAsString() const
Returns a string that enumerates the enabled requirements.
SolverRequirement const & upperBounds() const
std::unique_ptr< Multiplier< ValueType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
bool hasRelevantValues() const
void restrictRelevantValues(storm::storage::BitVector const &filter)
storm::storage::BitVector & relevantValues()
void setRelevantValues(storm::storage::BitVector &&values)
OptimizationDirection direction() const
A bit vector that is internally represented as a vector of 64-bit values.
void complement()
Negates all bits in the bit vector.
uint64_t getNextSetIndex(uint64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to true in the bit vector.
bool isDisjointFrom(BitVector const &other) const
Checks whether none of the bits that are set in the current bit vector are also set in the given bit ...
bool full() const
Retrieves whether all bits are set in this bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
size_t size() const
Retrieves the number of bits this bit vector can store.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
bool empty() const
Checks if the decomposition is empty.
std::size_t size() const
Retrieves the number of blocks of this decomposition.
This class represents the decomposition of a nondeterministic model into its maximal end components.
std::string statistics(uint64_t totalNumberOfStates) const
Returns a string containing statistics about the MEC decomposition, e.g., the number of (trivial/non-...
This class defines which action is chosen in a particular state of a non-deterministic model.
SchedulerChoice< ValueType > const & getChoice(uint_fast64_t modelState, uint_fast64_t memoryState=0) const
Gets the choice defined by the scheduler for the given model and memory state.
void setChoice(SchedulerChoice< ValueType > const &choice, uint_fast64_t modelState, uint_fast64_t memoryState=0)
Sets the choice defined by the scheduler for the given state.
A class that holds a possibly non-square matrix in the compressed row storage format.
SparseMatrix getSubmatrix(bool useGroups, storm::storage::BitVector const &rowConstraint, storm::storage::BitVector const &columnConstraint, bool insertDiagonalEntries=false, storm::storage::BitVector const &makeZeroColumns=storm::storage::BitVector()) const
Creates a submatrix of the current matrix by dropping all rows and columns whose bits are not set to ...
std::vector< value_type > getConstrainedRowSumVector(storm::storage::BitVector const &rowConstraint, storm::storage::BitVector const &columnConstraint) const
Computes a vector whose i-th entry is the sum of the entries in the i-th selected row where only thos...
SparseMatrix< ValueType > transposeSelectedRowsFromRowGroups(std::vector< uint64_t > const &rowGroupChoices, bool keepZeros=false) const
Transposes the matrix w.r.t.
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
index_type getColumnCount() const
Returns the number of columns of the matrix.
std::vector< index_type > const & getRowGroupIndices() const
Returns the grouping of rows of this matrix.
std::vector< value_type > getConstrainedRowGroupSumVector(storm::storage::BitVector const &rowGroupConstraint, storm::storage::BitVector const &columnConstraint) const
Computes a vector whose entries represent the sums of selected columns for all rows in selected row g...
index_type getRowCount() const
Returns the number of rows of the matrix.
storm::storage::BitVector getRowFilter(storm::storage::BitVector const &groupConstraint) const
Returns a bitvector representing the set of rows, with all indices set that correspond to one of the ...
SparseMatrix filterEntries(storm::storage::BitVector const &rowFilter) const
Returns a copy of this matrix that only considers entries in the selected rows.
A class that provides convenience operations to display run times.
bool updateProgress(uint64_t count)
Updates the progress to the current count and prints it if the delay passed.
void setMaxCount(uint64_t maxCount)
Sets the maximal possible count.
void startNewMeasurement(uint64_t startCount)
Starts a new measurement, dropping all progress information collected so far.
A class that provides convenience operations to display run times.
void start()
Start stopwatch (again) and start measuring time.
void stop()
Stop stopwatch and add measured time to total time.
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN(message)
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_ERROR_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
#define STORM_PRINT_AND_LOG(message)
void extractSchedulerChoices(storm::storage::Scheduler< SolutionType > &scheduler, std::vector< uint64_t > const &subChoices, storm::storage::BitVector const &maybeStates)
boost::optional< SparseMdpEndComponentInformation< ValueType > > computeFixedPointSystemUntilProbabilitiesEliminateEndComponents(storm::solver::SolveGoal< ValueType, SolutionType > &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, QualitativeStateSetsUntilProbabilities const &qualitativeStateSets, storm::storage::SparseMatrix< ValueType > &submatrix, std::vector< ValueType > &b, bool produceScheduler)
QualitativeStateSetsReachabilityRewards computeQualitativeStateSetsReachabilityRewards(storm::solver::SolveGoal< ValueType, SolutionType > const &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &targetStates, std::function< storm::storage::BitVector()> const &zeroRewardStatesGetter, std::function< storm::storage::BitVector()> const &zeroRewardChoicesGetter)
QualitativeStateSetsUntilProbabilities computeQualitativeStateSetsUntilProbabilities(storm::solver::SolveGoal< ValueType, SolutionType > const &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
void extractValueAndSchedulerHint(SparseMdpHintType< SolutionType > &hintStorage, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &maybeStates, boost::optional< storm::storage::BitVector > const &selectedChoices, ModelCheckerHint const &hint, bool skipECWithinMaybeStatesCheck)
std::vector< uint_fast64_t > computeValidSchedulerHint(Environment const &env, SemanticSolutionType const &type, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &maybeStates, storm::storage::BitVector const &filterStates, storm::storage::BitVector const &targetStates, boost::optional< storm::storage::BitVector > const &selectedChoices)
SparseMdpHintType< SolutionType > computeHints(Environment const &env, SemanticSolutionType const &type, ModelCheckerHint const &hint, storm::OptimizationDirection const &dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &maybeStates, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &targetStates, bool produceScheduler, boost::optional< storm::storage::BitVector > const &selectedChoices=boost::none)
QualitativeStateSetsUntilProbabilities getQualitativeStateSetsUntilProbabilitiesFromHint(ModelCheckerHint const &hint)
std::vector< ValueType > computeUpperRewardBounds(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &rewards, std::vector< ValueType > const &oneStepTargetProbabilities)
QualitativeStateSetsReachabilityRewards getQualitativeStateSetsReachabilityRewards(storm::solver::SolveGoal< ValueType, SolutionType > const &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &targetStates, ModelCheckerHint const &hint, std::function< storm::storage::BitVector()> const &zeroRewardStatesGetter, std::function< storm::storage::BitVector()> const &zeroRewardChoicesGetter)
void computeFixedPointSystemUntilProbabilities(storm::solver::SolveGoal< ValueType, SolutionType > &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, QualitativeStateSetsUntilProbabilities const &qualitativeStateSets, storm::storage::SparseMatrix< ValueType > &submatrix, std::vector< ValueType > &b)
MaybeStateResult< SolutionType > computeValuesForMaybeStates(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > &&submatrix, std::vector< ValueType > const &b, bool produceScheduler, SparseMdpHintType< SolutionType > &hint)
void extendScheduler(storm::storage::Scheduler< SolutionType > &scheduler, storm::solver::SolveGoal< ValueType, SolutionType > const &goal, QualitativeStateSetsUntilProbabilities const &qualitativeStateSets, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
QualitativeStateSetsReachabilityRewards getQualitativeStateSetsReachabilityRewardsFromHint(ModelCheckerHint const &hint, storm::storage::BitVector const &targetStates)
boost::optional< SparseMdpEndComponentInformation< ValueType > > computeFixedPointSystemReachabilityRewardsEliminateEndComponents(storm::solver::SolveGoal< ValueType, SolutionType > &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, QualitativeStateSetsReachabilityRewards const &qualitativeStateSets, boost::optional< storm::storage::BitVector > const &selectedChoices, std::function< std::vector< ValueType >(uint_fast64_t, storm::storage::SparseMatrix< ValueType > const &, storm::storage::BitVector const &)> const &totalStateRewardVectorGetter, storm::storage::SparseMatrix< ValueType > &submatrix, std::vector< ValueType > &b, boost::optional< std::vector< ValueType > > &oneStepTargetProbabilities, bool produceScheduler)
QualitativeStateSetsUntilProbabilities getQualitativeStateSetsUntilProbabilities(storm::solver::SolveGoal< ValueType, SolutionType > const &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, ModelCheckerHint const &hint)
void computeFixedPointSystemReachabilityRewards(storm::solver::SolveGoal< ValueType, SolutionType > &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, QualitativeStateSetsReachabilityRewards const &qualitativeStateSets, boost::optional< storm::storage::BitVector > const &selectedChoices, std::function< std::vector< ValueType >(uint_fast64_t, storm::storage::SparseMatrix< ValueType > const &, storm::storage::BitVector const &)> const &totalStateRewardVectorGetter, storm::storage::SparseMatrix< ValueType > &submatrix, std::vector< ValueType > &b, std::vector< ValueType > *oneStepTargetProbabilities=nullptr)
std::unique_ptr< storm::solver::MinMaxLinearEquationSolver< ValueType, SolutionType > > configureMinMaxLinearEquationSolver(Environment const &env, SolveGoal< ValueType, SolutionType > &&goal, storm::solver::MinMaxLinearEquationSolverFactory< ValueType, SolutionType > const &factory, MatrixType &&matrix)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01Max(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
void computeSchedulerStayingInStates(storm::storage::BitVector const &states, storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::Scheduler< SchedulerValueType > &scheduler, boost::optional< storm::storage::BitVector > const &rowFilter)
Computes a scheduler for the given states that chooses an action that stays completely in the very sa...
void computeSchedulerProbGreater0E(storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, storm::storage::Scheduler< SchedulerValueType > &scheduler, boost::optional< storm::storage::BitVector > const &rowFilter)
Computes a scheduler for the ProbGreater0E-States such that in the induced system the given psiStates...
storm::storage::BitVector performProbGreater0A(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under any pos...
void computeSchedulerProb1E(storm::storage::BitVector const &prob1EStates, storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, storm::storage::Scheduler< SchedulerValueType > &scheduler, boost::optional< storm::storage::BitVector > const &rowFilter)
Computes a scheduler for the given prob1EStates such that in the induced system the given psiStates a...
storm::storage::BitVector performProb1A(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 1 of satisfying phi until psi under all possible re...
storm::storage::BitVector performProbGreater0E(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under at leas...
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...
storm::storage::BitVector performProb0E(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 of satisfying phi until psi under at least one po...
void computeSchedulerProb0E(storm::storage::BitVector const &prob0EStates, storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::Scheduler< SchedulerValueType > &scheduler)
Computes a scheduler for the given states that have a scheduler that has a probability 0.
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01Min(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
storm::storage::BitVector performProb1E(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability 1 of satisfying phi until psi under at least one po...
void computeSchedulerRewInf(storm::storage::BitVector const &rewInfStates, storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::Scheduler< SchedulerValueType > &scheduler)
Computes a scheduler for the given states that have a scheduler that has a reward infinity.
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
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.
void setAllValues(std::vector< T > &vec, storm::storage::BitVector const &positions, T const &positiveValue=storm::utility::one< T >(), T const &negativeValue=storm::utility::zero< T >())
void selectVectorValues(std::vector< T > &vector, storm::storage::BitVector const &positions, std::vector< T > const &values)
Selects the elements from a vector at the specified positions and writes them consecutively into anot...
void filterVectorInPlace(std::vector< Type > &v, storm::storage::BitVector const &filter)
std::vector< Type > filterVector(std::vector< Type > const &in, storm::storage::BitVector const &filter)
bool isOne(ValueType const &a)
bool isZero(ValueType const &a)
bool isInfinity(ValueType const &a)
bool hasScheduler() const
boost::optional< std::vector< uint64_t > > scheduler
MaybeStateResult(std::vector< ValueType > &&values)
std::vector< uint64_t > const & getScheduler() const
std::vector< ValueType > values
std::vector< ValueType > const & getValues() const
storm::storage::BitVector rewardZeroStates
storm::storage::BitVector infinityStates
storm::storage::BitVector maybeStates
storm::storage::BitVector statesWithProbability0
storm::storage::BitVector statesWithProbability1
storm::storage::BitVector maybeStates
ValueType const & getUpperResultBound() const
boost::optional< std::vector< uint64_t > > schedulerHint
std::vector< ValueType > & getValueHint()
bool hasNoEndComponents() const
boost::optional< ValueType > lowerResultBound
ValueType const & getLowerResultBound() const
boost::optional< ValueType > upperResultBound
bool hasValueHint() const
std::vector< uint64_t > & getSchedulerHint()
bool hasUniqueSolution() const
bool getEliminateEndComponents() const
boost::optional< std::vector< ValueType > > valueHint
bool getComputeUpperBounds()
bool hasUpperResultBound() const
std::vector< ValueType > const & getUpperResultBounds() const
std::vector< ValueType > & getUpperResultBounds()
boost::optional< std::vector< ValueType > > upperResultBounds
bool hasSchedulerHint() const
bool hasLowerResultBound() const
bool eliminateEndComponents
bool hasUpperResultBounds() const