40template<
typename ValueType,
typename SolutionType>
45 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing reward bounded values with interval models.");
58 std::vector<ValueType> x, b;
59 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> minMaxSolver;
67 std::vector<std::vector<ValueType>> cdfData;
72 uint64_t numCheckedEpochs = 0;
73 for (
auto const& epoch : epochOrder) {
78 rewardUnfolding.
setSolutionForCurrentEpoch(epochModel.analyzeSingleObjective(preciseEnv, dir, x, b, minMaxSolver, lowerBound, upperBound));
82 std::vector<ValueType> cdfEntry;
83 for (uint64_t i = 0; i < rewardUnfolding.
getEpochManager().getDimensionCount(); ++i) {
89 cdfData.push_back(std::move(cdfEntry));
98 std::map<storm::storage::sparse::state_type, ValueType> result;
99 for (uint64_t initState : initialStates) {
106 std::vector<std::string> headers;
107 for (uint64_t i = 0; i < rewardUnfolding.
getEpochManager().getDimensionCount(); ++i) {
108 headers.push_back(rewardUnfolding.
getDimension(i).formula->toString());
110 headers.push_back(
"Result");
128template<
typename ValueType,
typename SolutionType>
137 multiplier->multiplyAndReduce(env, dir, result,
nullptr, result, uncertaintyResolutionMode);
142template<
typename ValueType,
typename SolutionType = ValueType>
148 boost::optional<storm::storage::BitVector>
const& selectedChoices) {
156 validScheduler, selectedChoices);
162 std::vector<uint64_t> schedulerHint;
164 if (selectedChoices) {
166 for (uint64_t maybeState : maybeStates) {
167 auto choice = validScheduler.
getChoice(maybeState).getDeterministicChoice();
169 auto const origGlobalChoiceIndex = groupStart + choice;
170 STORM_LOG_ASSERT(selectedChoices->get(origGlobalChoiceIndex),
"The computed scheduler selects an illegal choice.");
172 for (
auto pos = selectedChoices->getNextUnsetIndex(groupStart); pos < origGlobalChoiceIndex; pos = selectedChoices->getNextUnsetIndex(pos + 1)) {
175 schedulerHint.push_back(choice);
178 for (uint64_t maybeState : maybeStates) {
179 schedulerHint.push_back(validScheduler.
getChoice(maybeState).getDeterministicChoice());
182 return schedulerHint;
185template<
typename ValueType>
262template<
typename ValueType,
typename SolutionType>
265 boost::optional<storm::storage::BitVector>
const& selectedChoices,
ModelCheckerHint const& hint,
266 bool skipECWithinMaybeStatesCheck) {
270 STORM_LOG_WARN(
"A scheduler hint was provided, but the solver requires a specific one. The provided scheduler hint will be ignored.");
272 auto const& schedulerHint = hint.template asExplicitModelCheckerHint<ValueType>().getSchedulerHint();
273 std::vector<uint64_t> hintChoices;
277 if (!skipECWithinMaybeStatesCheck) {
278 hintChoices.reserve(maybeStates.
size());
279 for (uint_fast64_t state = 0; state < maybeStates.
size(); ++state) {
280 hintChoices.push_back(schedulerHint.getChoice(state).getDeterministicChoice());
285 hintApplicable =
true;
288 if (hintApplicable) {
292 for (uint64_t state : maybeStates) {
293 uint_fast64_t hintChoice = schedulerHint.getChoice(state).getDeterministicChoice();
294 if (selectedChoices) {
296 uint_fast64_t lastChoice = firstChoice + hintChoice;
298 for (uint_fast64_t choice = selectedChoices->getNextSetIndex(firstChoice); choice < lastChoice;
299 choice = selectedChoices->getNextSetIndex(choice + 1)) {
303 hintChoices.push_back(hintChoice);
319template<
typename ValueType,
typename SolutionType>
324 boost::optional<storm::storage::BitVector>
const& selectedChoices = boost::none) {
338 bool hasSchedulerHint = hint.
isExplicitModelCheckerHint() && hint.template asExplicitModelCheckerHint<ValueType>().hasSchedulerHint();
346 "The solver requires to eliminate the end components although the solution is already assumed to be unique.");
347 STORM_LOG_DEBUG(
"Scheduling EC elimination, because the solver requires a unique solution.");
359 STORM_LOG_DEBUG(
"Computing valid scheduler, because the solver requires it.");
361 targetStates, selectedChoices);
387 STORM_LOG_TRACE(
"Warn A non-empty hint was provided, but its information will be disregarded.");
407template<
typename ValueType>
429template<
typename ValueType,
typename SolutionType>
434 std::vector<SolutionType> x =
436 : std::vector<SolutionType>(submatrix.getRowGroupCount(),
440 auto const uncertaintyResolutionMode = goal.getUncertaintyResolutionMode();
443 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType, SolutionType>>
solver =
445 solver->setRequirementsChecked();
446 solver->setUncertaintyResolutionMode(uncertaintyResolutionMode);
461 solver->setTrackScheduler(produceScheduler);
464 solver->solveEquations(env, x, b);
469 uint64_t relevantState =
solver->hasRelevantValues() ?
solver->getRelevantValues().getNextSetIndex(0ull) : 0ull;
470 std::function<void()> getNextRelevantStateIndex;
471 if (
solver->hasRelevantValues()) {
473 getNextRelevantStateIndex = [&relevantState, &relevantValues]() { relevantState = relevantValues.
getNextSetIndex(++relevantState); };
475 getNextRelevantStateIndex = [&relevantState]() { ++relevantState; };
477 for (; relevantState <
solver->getUpperBounds().size(); getNextRelevantStateIndex()) {
480 "Expecting result value for state " << relevantState <<
" to be <= " <<
solver->getUpperBounds().at(relevantState) <<
", but got "
481 << x.at(relevantState) <<
".");
490 if (produceScheduler) {
502template<
typename ValueType>
505 result.
maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
508 std::vector<ValueType>
const& resultsForNonMaybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getResultHint();
512 for (uint64_t state : nonMaybeStates) {
517 "Expected that the result hint specifies probabilities in {0,1} for non-maybe states.");
525template<
typename ValueType,
typename SolutionType>
534 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01;
536 statesWithProbability01 =
539 statesWithProbability01 =
549template<
typename ValueType,
typename SolutionType>
562template<
typename SolutionType,
bool subChoicesCoverOnlyMaybeStates = true>
565 if constexpr (subChoicesCoverOnlyMaybeStates) {
566 auto subChoiceIt = subChoices.begin();
567 for (uint64_t maybeState : maybeStates) {
568 scheduler.
setChoice(*subChoiceIt, maybeState);
571 STORM_LOG_ASSERT(subChoiceIt == subChoices.end(),
"Subchoice iterator not at end.");
576 for (uint64_t maybeState : maybeStates) {
577 scheduler.
setChoice(subChoices[maybeState], maybeState);
582template<
typename ValueType,
typename SolutionType>
603template<
typename ValueType,
typename SolutionType>
635template<
typename ValueType,
typename SolutionType>
644 bool doDecomposition = !candidateStates.
empty();
647 if (doDecomposition) {
654 if (doDecomposition && !endComponentDecomposition.
empty()) {
658 submatrix, &b,
nullptr, produceScheduler);
668 if (!newRelevantValues.
empty()) {
682template<
typename ValueType,
typename SolutionType>
687 STORM_LOG_THROW(!qualitative || !produceScheduler, storm::exceptions::InvalidSettingsException,
688 "Cannot produce scheduler when performing qualitative model checking only.");
706 bool maybeStatesNotRelevant = goal.hasRelevantValues() && goal.relevantValues().isDisjointFrom(qualitativeStateSets.
maybeStates);
709 bool const minimize = goal.minimize();
711 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
712 if (produceScheduler) {
713 scheduler = std::make_unique<storm::storage::Scheduler<SolutionType>>(transitionMatrix.
getRowGroupCount());
715 if (maybeStatesNotRelevant) {
716 for (uint64_t state : qualitativeStateSets.
maybeStates) {
717 scheduler->setDontCare(state);
723 if (qualitative || maybeStatesNotRelevant) {
737 std::vector<ValueType> b;
740 boost::optional<SparseMdpEndComponentInformation<ValueType>> ecInformation;
743 qualitativeStateSets, submatrix, b, produceScheduler);
754 if (ecInformation && ecInformation.get().getEliminatedEndComponents()) {
756 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support this end component with interval models.");
758 ecInformation.get().setValues(result, qualitativeStateSets.
maybeStates, resultForMaybeStates.
getValues());
759 if (produceScheduler) {
760 ecInformation.get().setScheduler(*scheduler, qualitativeStateSets.
maybeStates, transitionMatrix, backwardTransitions,
772 result = resultForMaybeStates.
getValues();
774 if (produceScheduler) {
783 if (produceScheduler) {
784 extendScheduler(*scheduler, minimize, qualitativeStateSets, transitionMatrix, backwardTransitions, phiStates, psiStates);
788 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
789 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler.");
790 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler.");
791 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler.");
797template<
typename ValueType,
typename SolutionType>
801 bool useMecBasedTechnique) {
802 if (useMecBasedTechnique) {
806 for (
auto const& mec : mecDecomposition) {
807 for (
auto const& stateActionsPair : mec) {
808 statesInPsiMecs.
set(stateActionsPair.first,
true);
812 return computeUntilProbabilities(env, std::move(goal), transitionMatrix, backwardTransitions, psiStates, statesInPsiMecs, qualitative,
819 for (
auto& element : result.values) {
826template<
typename ValueType,
typename SolutionType>
827template<
typename RewardModelType>
830 RewardModelType
const& rewardModel, uint_fast64_t stepCount) {
832 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support instantenous rewards with interval models.");
835 STORM_LOG_THROW(rewardModel.hasStateRewards(), storm::exceptions::InvalidPropertyException,
836 "Computing instantaneous rewards for a reward model that does not define any state-rewards. The result is trivially 0.");
838 std::vector<SolutionType> result(rewardModel.getStateRewardVector());
841 multiplier->repeatedMultiplyAndReduce(env, goal.direction(), result,
nullptr, stepCount, goal.getUncertaintyResolutionMode());
847template<
typename ValueType,
typename SolutionType>
848template<
typename RewardModelType>
851 RewardModelType
const& rewardModel, uint_fast64_t stepBound) {
853 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support cumulative rewards with interval models.");
856 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
859 std::vector<ValueType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
865 multiplier->repeatedMultiplyAndReduce(env, goal.direction(), result, &totalRewardVector, stepBound, goal.getUncertaintyResolutionMode());
871template<
typename ValueType,
typename SolutionType>
872template<
typename RewardModelType>
877 STORM_LOG_THROW(!rewardModel.hasNegativeRewards(), storm::exceptions::NotImplementedException,
878 "The reward model contains negative rewards. This is not implemented by the total rewards computation.");
880 if (goal.minimize()) {
884 for (uint64_t state = 0; state < transitionMatrix.
getRowGroupCount(); ++state) {
886 statesWithZeroRewardChoice.
set(state);
891 statesWithZeroRewardChoice, ~statesWithZeroRewardChoice,
false, 0, choicesWithoutReward);
893 auto result =
computeReachabilityRewards(env, std::move(goal), transitionMatrix, backwardTransitions, rewardModel, rew0EStates, qualitative,
894 produceScheduler, hint);
895 if (result.scheduler) {
910 return computeReachabilityRewards(env, std::move(goal), transitionMatrix, backwardTransitions, rewardModel, rew0AStates, qualitative,
911 produceScheduler, hint);
914 STORM_LOG_ERROR_COND(!produceScheduler,
"Can not produce scheduler for this property (functionality not implemented");
919 for (uint64_t oldRew0AState : rew0AStates) {
920 newRew0AStates.
set(ecElimResult.oldToNewStateMapping[oldRew0AState]);
923 if (goal.hasRelevantValues()) {
925 for (
auto oldRelevantState : goal.relevantValues()) {
926 newRelevantValues.
set(ecElimResult.oldToNewStateMapping[oldRelevantState]);
928 goal.relevantValues() = std::move(newRelevantValues);
932 env, std::move(goal), ecElimResult.matrix, ecElimResult.matrix.transpose(
true),
934 std::vector<ValueType> result;
935 std::vector<ValueType> oldChoiceRewards = rewardModel.getTotalRewardVector(transitionMatrix);
936 result.reserve(rowCount);
937 for (uint64_t newState : maybeStates) {
938 for (auto newChoice : newTransitionMatrix.getRowGroupIndices(newState)) {
939 uint64_t oldChoice = ecElimResult.newToOldRowMapping[newChoice];
940 result.push_back(oldChoiceRewards[oldChoice]);
943 STORM_LOG_ASSERT(result.size() == rowCount,
"Unexpected size of reward vector.");
946 newRew0AStates, qualitative,
false,
949 for (uint64_t oldStateWithoutRew : statesWithoutReward) {
950 newStatesWithoutReward.
set(ecElimResult.oldToNewStateMapping[oldStateWithoutRew]);
952 return newStatesWithoutReward;
956 for (uint64_t newChoice = 0; newChoice < ecElimResult.matrix.getRowCount(); ++newChoice) {
957 if (choicesWithoutReward.get(ecElimResult.newToOldRowMapping[newChoice])) {
958 newChoicesWithoutReward.
set(newChoice);
961 return newChoicesWithoutReward;
964 std::vector<SolutionType> resultInEcQuotient = std::move(result.values);
965 result.values.resize(ecElimResult.oldToNewStateMapping.size());
972template<
typename ValueType,
typename SolutionType>
973template<
typename RewardModelType>
976 RewardModelType
const& rewardModel, uint_fast64_t stepBound, ValueType discountFactor) {
978 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
981 std::vector<SolutionType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
987 multiplier->repeatedMultiplyAndReduceWithFactor(env, goal.direction(), result, &totalRewardVector, stepBound, discountFactor,
988 goal.getUncertaintyResolutionMode());
993template<
typename ValueType,
typename SolutionType>
994template<
typename RewardModelType>
1001 "Exact solving of discounted total reward objectives is currently not supported.");
1003 std::vector<ValueType> b;
1006 b = rewardModel.getTotalRewardVector(transitionMatrix);
1011 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
1012 if (produceScheduler) {
1013 scheduler = std::make_unique<storm::storage::Scheduler<ValueType>>(discountingHelper.
computeScheduler());
1015 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
1016 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler.");
1017 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler.");
1018 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler.");
1022template<
typename ValueType,
typename SolutionType>
1023template<
typename RewardModelType>
1029 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Reward model for formula is empty. Skipping formula.");
1030 return computeReachabilityRewardsHelper(
1031 env, std::move(goal), transitionMatrix, backwardTransitions,
1033 return rewardModel.getTotalRewardVector(rowCount, transMatrix, maybeStates);
1035 targetStates, qualitative, produceScheduler, [&]() {
return rewardModel.getStatesWithZeroReward(transitionMatrix); },
1036 [&]() {
return rewardModel.getChoicesWithZeroReward(transitionMatrix); }, hint);
1039template<
typename ValueType,
typename SolutionType>
1044 return computeReachabilityRewardsHelper(
1045 env, std::move(goal), transitionMatrix, backwardTransitions,
1053template<
typename ValueType,
typename SolutionType>
1054template<
typename IntervalRewardType>
1061 STORM_LOG_THROW(!intervalRewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
1063 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support a valuetype and reward type having different base types.");
1065 return computeReachabilityRewardsHelper(
1066 env, std::move(goal), transitionMatrix, backwardTransitions,
1068 std::vector<ValueType> result;
1069 result.reserve(rowCount);
1070 std::vector<IntervalRewardType> subIntervalVector = intervalRewardModel.
getTotalRewardVector(rowCount, transitionMatrix, maybeStates);
1071 for (
auto const& interval : subIntervalVector) {
1072 result.push_back(lowerBoundOfIntervals ? interval.lower() : interval.upper());
1076 targetStates, qualitative,
false,
1078 return intervalRewardModel.
getStatesWithFilter(transitionMatrix, [&](IntervalRewardType
const& i) {
1083 return intervalRewardModel.
getChoicesWithFilter(transitionMatrix, [&](IntervalRewardType
const& i) {
1097template<
typename ValueType>
1101 result.
maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
1104 std::vector<ValueType>
const& resultsForNonMaybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getResultHint();
1108 for (uint64_t state : nonMaybeStates) {
1113 "Expected that the result hint specifies probabilities in {0,infinity} for non-maybe states.");
1120template<
typename ValueType,
typename SolutionType>
1139 trueStates, targetStates, zeroRewardChoicesGetter());
1142 zeroRewardStatesGetter(), targetStates);
1151template<
typename ValueType,
typename SolutionType>
1158 if (hint.
isExplicitModelCheckerHint() && hint.template asExplicitModelCheckerHint<ValueType>().getComputeOnlyMaybeStates()) {
1162 zeroRewardChoicesGetter);
1166template<
typename ValueType,
typename SolutionType>
1174 qualitativeStateSets.
rewardZeroStates, targetStates, scheduler, zeroRewardChoicesGetter());
1186template<
typename ValueType,
typename SolutionType>
1189 boost::optional<storm::storage::BitVector>
const& selectedChoices) {
1190 auto subChoiceIt = subChoices.begin();
1191 if (selectedChoices) {
1192 for (uint64_t maybeState : maybeStates) {
1195 uint_fast64_t selectedRowIndex = selectedChoices->getNextSetIndex(firstRowIndex);
1196 for (uint_fast64_t choice = 0; choice < *subChoiceIt; ++choice) {
1197 selectedRowIndex = selectedChoices->getNextSetIndex(selectedRowIndex + 1);
1199 scheduler.
setChoice(selectedRowIndex - firstRowIndex, maybeState);
1203 for (uint64_t maybeState : maybeStates) {
1204 scheduler.
setChoice(*subChoiceIt, maybeState);
1208 STORM_LOG_ASSERT(subChoiceIt == subChoices.end(),
"Subchoice iterator not at end.");
1211template<
typename ValueType,
typename SolutionType>
1216 totalStateRewardVectorGetter,
1222 b = totalStateRewardVectorGetter(submatrix.
getRowCount(), transitionMatrix, qualitativeStateSets.
maybeStates);
1223 if (oneStepTargetProbabilities) {
1224 (*oneStepTargetProbabilities) =
1229 b = totalStateRewardVectorGetter(transitionMatrix.
getRowCount(), transitionMatrix,
1232 if (oneStepTargetProbabilities) {
1241template<
typename ValueType,
typename SolutionType>
1245 boost::optional<storm::storage::BitVector>
const& selectedChoices,
1247 totalStateRewardVectorGetter,
1249 bool produceScheduler) {
1254 std::vector<ValueType> rewardVector =
1258 for (
auto const& e : rewardVector) {
1260 zeroRewardChoices.
set(index);
1267 for (uint64_t state : qualitativeStateSets.
maybeStates) {
1268 bool keepState =
false;
1271 if (zeroRewardChoices.
get(row)) {
1278 candidateStates.
set(state,
false);
1286 bool doDecomposition = !candidateStates.
empty();
1289 if (doDecomposition) {
1291 endComponentDecomposition =
1297 if (doDecomposition && !endComponentDecomposition.
empty()) {
1300 endComponentDecomposition, transitionMatrix, qualitativeStateSets.
maybeStates,
1301 oneStepTargetProbabilities ? &qualitativeStateSets.
rewardZeroStates :
nullptr, selectedChoices ? &selectedChoices.
get() :
nullptr, &rewardVector,
1302 submatrix, oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() :
nullptr, &b, produceScheduler);
1312 if (!newRelevantValues.
empty()) {
1321 oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() :
nullptr);
1326template<
typename ValueType,
typename SolutionType>
1329 std::vector<ValueType>
const& oneStepTargetProbabilities) {
1331 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing upper reward bounds with interval models.");
1334 if (direction == storm::OptimizationDirection::Minimize) {
1344template<
typename ValueType,
typename SolutionType>
1345MDPSparseModelCheckingHelperReturnType<SolutionType> SparseMdpPrctlHelper<ValueType, SolutionType>::computeReachabilityRewardsHelper(
1349 totalStateRewardVectorGetter,
1357 QualitativeStateSetsReachabilityRewards qualitativeStateSets = getQualitativeStateSetsReachabilityRewards(
1358 goal, transitionMatrix, backwardTransitions, targetStates, hint, zeroRewardStatesGetter, zeroRewardChoicesGetter);
1360 STORM_LOG_INFO(
"Preprocessing: " << qualitativeStateSets.infinityStates.getNumberOfSetBits() <<
" states with reward infinity, "
1361 << qualitativeStateSets.rewardZeroStates.getNumberOfSetBits() <<
" states with reward zero ("
1362 << qualitativeStateSets.maybeStates.getNumberOfSetBits() <<
" states remaining).");
1367 std::unique_ptr<storm::storage::Scheduler<SolutionType>> scheduler;
1368 if (produceScheduler) {
1370 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support producing schedulers in this function with interval models.");
1372 scheduler = std::make_unique<storm::storage::Scheduler<SolutionType>>(transitionMatrix.
getRowGroupCount());
1382 if (qualitative || maybeStatesNotRelevant) {
1383 STORM_LOG_INFO(
"The rewards for the initial states were determined in a preprocessing step. No exact rewards were computed.");
1388 if (!qualitativeStateSets.maybeStates.empty()) {
1392 boost::optional<storm::storage::BitVector> selectedChoices;
1393 if (!qualitativeStateSets.infinityStates.empty()) {
1394 selectedChoices = transitionMatrix.
getRowFilter(qualitativeStateSets.maybeStates, ~qualitativeStateSets.infinityStates);
1398 SparseMdpHintType<SolutionType> hintInformation = computeHints<ValueType, SolutionType>(
1399 env, SemanticSolutionType::ExpectedRewards, hint, goal.
direction(), transitionMatrix, backwardTransitions, qualitativeStateSets.maybeStates,
1400 ~qualitativeStateSets.rewardZeroStates, qualitativeStateSets.rewardZeroStates, produceScheduler, selectedChoices);
1403 storm::storage::SparseMatrix<ValueType> submatrix;
1404 std::vector<ValueType> b;
1408 boost::optional<std::vector<ValueType>> oneStepTargetProbabilities;
1409 if (hintInformation.getComputeUpperBounds()) {
1410 oneStepTargetProbabilities = std::vector<ValueType>();
1414 boost::optional<SparseMdpEndComponentInformation<ValueType>> ecInformation;
1415 if (hintInformation.getEliminateEndComponents()) {
1417 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support eliminating end components with interval models.");
1420 goal, transitionMatrix, backwardTransitions, qualitativeStateSets, selectedChoices, totalStateRewardVectorGetter, submatrix, b,
1421 oneStepTargetProbabilities, produceScheduler);
1426 submatrix, b, oneStepTargetProbabilities ? &oneStepTargetProbabilities.get() :
nullptr);
1430 if (hintInformation.getComputeUpperBounds()) {
1431 STORM_LOG_ASSERT(oneStepTargetProbabilities,
"Expecting one step target probability vector to be available.");
1436 MaybeStateResult<SolutionType> resultForMaybeStates =
1440 if (ecInformation && ecInformation.get().getEliminatedEndComponents()) {
1442 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support eliminating end components with interval models.");
1444 ecInformation.get().setValues(result, qualitativeStateSets.maybeStates, resultForMaybeStates.getValues());
1445 if (produceScheduler) {
1446 ecInformation.get().setScheduler(*scheduler, qualitativeStateSets.maybeStates, transitionMatrix, backwardTransitions,
1447 resultForMaybeStates.getScheduler());
1453 if (produceScheduler) {
1454 extractSchedulerChoices(*scheduler, transitionMatrix, resultForMaybeStates.getScheduler(), qualitativeStateSets.maybeStates,
1462 if (produceScheduler) {
1463 extendScheduler(*scheduler, minimize, qualitativeStateSets, transitionMatrix, backwardTransitions, targetStates, zeroRewardChoicesGetter);
1467 STORM_LOG_ASSERT(!produceScheduler || scheduler,
"Expected that a scheduler was obtained.");
1468 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || !scheduler->isPartialScheduler(),
"Expected a fully defined scheduler.");
1469 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isDeterministicScheduler(),
"Expected a deterministic scheduler.");
1470 STORM_LOG_ASSERT((!produceScheduler && !scheduler) || scheduler->isMemorylessScheduler(),
"Expected a memoryless scheduler.");
1473 return MDPSparseModelCheckingHelperReturnType<SolutionType>(std::move(result));
1475 return MDPSparseModelCheckingHelperReturnType<SolutionType>(std::move(result), std::move(scheduler));
1479template class SparseMdpPrctlHelper<double>;
1480template std::vector<double> SparseMdpPrctlHelper<double>::computeInstantaneousRewards(Environment
const& env, storm::solver::SolveGoal<double>&& goal,
1481 storm::storage::SparseMatrix<double>
const& transitionMatrix,
1482 storm::models::sparse::StandardRewardModel<double>
const& rewardModel,
1483 uint_fast64_t stepCount);
1484template std::vector<double> SparseMdpPrctlHelper<double>::computeCumulativeRewards(Environment
const& env, storm::solver::SolveGoal<double>&& goal,
1485 storm::storage::SparseMatrix<double>
const& transitionMatrix,
1486 storm::models::sparse::StandardRewardModel<double>
const& rewardModel,
1487 uint_fast64_t stepBound);
1488template std::vector<double> SparseMdpPrctlHelper<double>::computeDiscountedCumulativeRewards(
1489 Environment
const& env, storm::solver::SolveGoal<double>&& goal, storm::storage::SparseMatrix<double>
const& transitionMatrix,
1490 storm::models::sparse::StandardRewardModel<double>
const& rewardModel, uint_fast64_t stepBound,
double discountFactor);
1491template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeReachabilityRewards(
1492 Environment
const& env, storm::solver::SolveGoal<double>&& goal, storm::storage::SparseMatrix<double>
const& transitionMatrix,
1493 storm::storage::SparseMatrix<double>
const& backwardTransitions, storm::models::sparse::StandardRewardModel<double>
const& rewardModel,
1494 storm::storage::BitVector
const& targetStates,
bool qualitative,
bool produceScheduler,
ModelCheckerHint const& hint);
1495template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeTotalRewards(
1496 Environment
const& env, storm::solver::SolveGoal<double>&& goal, storm::storage::SparseMatrix<double>
const& transitionMatrix,
1497 storm::storage::SparseMatrix<double>
const& backwardTransitions, storm::models::sparse::StandardRewardModel<double>
const& rewardModel,
bool qualitative,
1499template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<double>::computeDiscountedTotalRewards(
1500 Environment
const& env, storm::solver::SolveGoal<double>&& goal, storm::storage::SparseMatrix<double>
const& transitionMatrix,
1501 storm::storage::SparseMatrix<double>
const& backwardTransitions, storm::models::sparse::StandardRewardModel<double>
const& rewardModel,
bool qualitative,
1502 bool produceScheduler,
double discountFactor,
ModelCheckerHint const& hint);
1504template class SparseMdpPrctlHelper<storm::RationalNumber>;
1505template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeInstantaneousRewards(
1506 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1507 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel, uint_fast64_t stepCount);
1508template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeCumulativeRewards(
1509 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1510 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel, uint_fast64_t stepBound);
1511template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeDiscountedCumulativeRewards(
1512 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1513 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel, uint_fast64_t stepBound, storm::RationalNumber discountFactor);
1514template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeReachabilityRewards(
1515 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1516 storm::storage::SparseMatrix<storm::RationalNumber>
const& backwardTransitions,
1517 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel, storm::storage::BitVector
const& targetStates,
bool qualitative,
1519template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeTotalRewards(
1520 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1521 storm::storage::SparseMatrix<storm::RationalNumber>
const& backwardTransitions,
1522 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel,
bool qualitative,
bool produceScheduler,
1524template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalNumber>::computeDiscountedTotalRewards(
1525 Environment
const& env, storm::solver::SolveGoal<storm::RationalNumber>&& goal, storm::storage::SparseMatrix<storm::RationalNumber>
const& transitionMatrix,
1526 storm::storage::SparseMatrix<storm::RationalNumber>
const& backwardTransitions,
1527 storm::models::sparse::StandardRewardModel<storm::RationalNumber>
const& rewardModel,
bool qualitative,
bool produceScheduler,
1530template class SparseMdpPrctlHelper<storm::Interval, double>;
1531template std::vector<double> SparseMdpPrctlHelper<storm::Interval, double>::computeInstantaneousRewards(
1532 Environment
const& env, storm::solver::SolveGoal<storm::Interval, double>&& goal, storm::storage::SparseMatrix<storm::Interval>
const& transitionMatrix,
1533 storm::models::sparse::StandardRewardModel<storm::Interval>
const& rewardModel, uint_fast64_t stepCount);
1534template std::vector<double> SparseMdpPrctlHelper<storm::Interval, double>::computeCumulativeRewards(
1535 Environment
const& env, storm::solver::SolveGoal<storm::Interval, double>&& goal, storm::storage::SparseMatrix<storm::Interval>
const& transitionMatrix,
1536 storm::models::sparse::StandardRewardModel<storm::Interval>
const& rewardModel, uint_fast64_t stepBound);
1537template std::vector<double> SparseMdpPrctlHelper<storm::Interval, double>::computeReachabilityRewards<storm::Interval>(
1538 Environment
const& env, storm::solver::SolveGoal<storm::Interval, double>&& goal, storm::storage::SparseMatrix<storm::Interval>
const& transitionMatrix,
1539 storm::storage::SparseMatrix<storm::Interval>
const& backwardTransitions, storm::models::sparse::StandardRewardModel<storm::Interval>
const& rewardModel,
1540 bool lowerBoundOfIntervals, storm::storage::BitVector
const& targetStates,
bool qualitative);
1541template MDPSparseModelCheckingHelperReturnType<double> SparseMdpPrctlHelper<storm::Interval, double>::computeTotalRewards(
1542 Environment
const& env, storm::solver::SolveGoal<storm::Interval, double>&& goal, storm::storage::SparseMatrix<storm::Interval>
const& transitionMatrix,
1543 storm::storage::SparseMatrix<storm::Interval>
const& backwardTransitions, storm::models::sparse::StandardRewardModel<storm::Interval>
const& rewardModel,
1546template class SparseMdpPrctlHelper<storm::RationalInterval, storm::RationalNumber>;
1547template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalInterval, storm::RationalNumber>::computeInstantaneousRewards(
1548 Environment
const& env, storm::solver::SolveGoal<storm::RationalInterval, storm::RationalNumber>&& goal,
1549 storm::storage::SparseMatrix<storm::RationalInterval>
const& transitionMatrix,
1550 storm::models::sparse::StandardRewardModel<storm::RationalInterval>
const& rewardModel, uint_fast64_t stepCount);
1551template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalInterval, storm::RationalNumber>::computeCumulativeRewards(
1552 Environment
const& env, storm::solver::SolveGoal<storm::RationalInterval, storm::RationalNumber>&& goal,
1553 storm::storage::SparseMatrix<storm::RationalInterval>
const& transitionMatrix,
1554 storm::models::sparse::StandardRewardModel<storm::RationalInterval>
const& rewardModel, uint_fast64_t stepBound);
1555template std::vector<storm::RationalNumber> SparseMdpPrctlHelper<storm::RationalInterval, storm::RationalNumber>::computeReachabilityRewards<
1556 storm::RationalInterval>(Environment
const& env, storm::solver::SolveGoal<storm::RationalInterval, storm::RationalNumber>&& goal,
1557 storm::storage::SparseMatrix<storm::RationalInterval>
const& transitionMatrix,
1558 storm::storage::SparseMatrix<storm::RationalInterval>
const& backwardTransitions,
1559 storm::models::sparse::StandardRewardModel<storm::RationalInterval>
const& rewardModel,
bool lowerBoundOfIntervals,
1560 storm::storage::BitVector
const& targetStates,
bool qualitative);
1561template MDPSparseModelCheckingHelperReturnType<storm::RationalNumber>
1562SparseMdpPrctlHelper<storm::RationalInterval, storm::RationalNumber>::computeTotalRewards(
1563 Environment
const& env, storm::solver::SolveGoal<storm::RationalInterval, storm::RationalNumber>&& goal,
1564 storm::storage::SparseMatrix<storm::RationalInterval>
const& transitionMatrix,
1565 storm::storage::SparseMatrix<storm::RationalInterval>
const& backwardTransitions,
1566 storm::models::sparse::StandardRewardModel<storm::RationalInterval>
const& rewardModel,
bool qualitative,
bool produceScheduler,
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
virtual bool isEmpty() const
ExplicitModelCheckerHint< ValueType > & asExplicitModelCheckerHint()
Bounds computeTotalRewardBounds(std::vector< ValueType > const &rewards)
Computes a lower and an upper bound on the expected total 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 > 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 MDPSparseModelCheckingHelperReturnType< SolutionType > computeReachabilityTimes(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 &targetStates, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
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 std::vector< SolutionType > computeNextProbabilities(Environment const &env, OptimizationDirection dir, UncertaintyResolutionMode uncertaintyResolutionMode, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
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 > computeInstantaneousRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepCount)
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())
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeDiscountedTotalRewards(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, ValueType discountFactor, 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 > computeDiscountedCumulativeRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound, ValueType discountFactor)
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeReachabilityRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, storm::storage::BitVector const &targetStates, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
bool hasBottomDimension(Epoch const &epoch) 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, SolutionType > > 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 logs it (on the progress log channel) if the delay pass...
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_STATISTICS(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)
void exportDataToCSVFile(std::string filepath, std::vector< std::vector< DataType > > const &data, boost::optional< std::vector< Header1Type > > const &header1=boost::none, boost::optional< std::vector< Header2Type > > const &header2=boost::none)
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)
void extendScheduler(storm::storage::Scheduler< SolutionType > &scheduler, bool minimize, 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)
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)
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)
SettingsType const & getModule()
Get module.
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, OptimizationDirectionSetting optimizationDirectionSetting=OptimizationDirectionSetting::Unset)
bool constexpr minimize(OptimizationDirection d)
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)
TargetType convertNumber(SourceType const &number)
carl::Interval< storm::RationalNumber > RationalInterval
solver::UncertaintyResolutionMode UncertaintyResolutionMode
solver::OptimizationDirection OptimizationDirection
constexpr bool IsIntervalType
Helper to check if a type is an interval.
typename detail::IntervalMetaProgrammingHelper< ValueType >::BaseType IntervalBaseType
Helper to access the type in which interval boundaries are stored.
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