33namespace modelchecker {
39 std::shared_ptr<storm::logic::OperatorFormula const> ) {
40 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The specified property is not supported by this value type.");
41 return std::map<storm::storage::sparse::state_type, storm::RationalFunction>();
44template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
47 if constexpr (storm::IsIntervalType<ValueType>) {
48 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing reward bounded values with interval models.");
63 std::vector<ValueType> x, b;
64 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> linEqSolver;
68 initEpoch, storm::utility::convertNumber<ValueType>(storm::settings::getModule<storm::settings::modules::GeneralSettings>().getPrecision()));
72 std::vector<std::vector<ValueType>> cdfData;
81 uint64_t numCheckedEpochs = 0;
82 for (
auto const& epoch : epochOrder) {
87 rewardUnfolding.
setSolutionForCurrentEpoch(epochModel.analyzeSingleObjective(preciseEnv, x, b, linEqSolver, lowerBound, upperBound));
89 if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet() &&
91 std::vector<ValueType> cdfEntry;
98 cdfData.push_back(std::move(cdfEntry));
107 std::map<storm::storage::sparse::state_type, ValueType> result;
114 if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet()) {
115 std::vector<std::string> headers;
117 headers.push_back(rewardUnfolding.
getDimension(i).formula->toString());
119 headers.push_back(
"Result");
120 storm::io::exportDataToCSVFile<ValueType, std::string, std::string>(
121 storm::settings::getModule<storm::settings::modules::IOSettings>().getExportCdfDirectory() +
"cdf.csv", cdfData, headers);
124 if (storm::settings::getModule<storm::settings::modules::CoreSettings>().isShowStatisticsSet()) {
139template<
typename ValueType,
typename SolutionType>
142 bool computeReward) {
144 std::vector<SolutionType> x = std::vector<SolutionType>(submatrix.getRowGroupCount(), storm::utility::zero<SolutionType>());
149 env, std::move(goal), minMaxLinearEquationSolverFactory, std::move(submatrix),
150 convert(OptimizationDirection::Maximize));
151 solver->setUncertaintyResolutionMode(goal.getUncertaintyResolutionMode());
152 solver->setHasUniqueSolution(computeReward);
153 solver->setHasNoEndComponents(
false);
156 auto req = solver->getRequirements(env);
157 if (!computeReward) {
158 solver->setLowerBound(storm::utility::zero<SolutionType>());
159 solver->setUpperBound(storm::utility::one<SolutionType>());
162 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
163 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
165 solver->setRequirementsChecked();
168 solver->solveEquations(env, x, b);
173template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
178 std::vector<SolutionType> result(transitionMatrix.
getRowCount(), storm::utility::zero<SolutionType>());
185 maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
188 std::vector<SolutionType>
const& resultsForNonMaybeStates = hint.template asExplicitModelCheckerHint<SolutionType>().getResultHint();
191 for (
auto state : nonMaybeStates) {
193 statesWithProbability1.
set(state,
true);
194 result[state] = storm::utility::one<SolutionType>();
197 "Expected that the result hint specifies probabilities in {0,1} for non-maybe states");
202 <<
" states remaining).");
205 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
208 statesWithProbability1 = std::move(statesWithProbability01.second);
209 maybeStates = ~(statesWithProbability0 | statesWithProbability1);
213 <<
" states remaining).");
216 storm::utility::vector::setVectorValues<SolutionType>(result, statesWithProbability0, storm::utility::zero<SolutionType>());
217 storm::utility::vector::setVectorValues<SolutionType>(result, statesWithProbability1, storm::utility::one<SolutionType>());
221 bool maybeStatesNotRelevant = goal.hasRelevantValues() && goal.relevantValues().isDisjointFrom(maybeStates);
224 if (qualitative || maybeStatesNotRelevant) {
226 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, storm::utility::convertNumber<SolutionType>(0.5));
228 if (!maybeStates.
empty()) {
230 if constexpr (storm::IsIntervalType<ValueType>) {
233 std::vector<ValueType> b;
244 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, x);
248 bool convertToEquationSystem =
253 if (convertToEquationSystem) {
262 std::vector<SolutionType> x;
266 x = std::vector<SolutionType>(maybeStates.
getNumberOfSetBits(), storm::utility::convertNumber<SolutionType>(0.5));
274 goal.restrictRelevantValues(maybeStates);
275 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver =
277 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
278 solver->solveEquations(env, x, b);
281 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, x);
288template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
292 if constexpr (storm::IsIntervalType<ValueType>) {
293 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing all until probabilities with interval models.");
295 uint_fast64_t numberOfStates = transitionMatrix.
getRowCount();
296 std::vector<SolutionType> result(numberOfStates, storm::utility::zero<SolutionType>());
302 if (!relevantStates.
empty()) {
305 bool convertToEquationSystem =
316 submatrix = submatrix.
getSubmatrix(
true, relevantStates, relevantStates, convertToEquationSystem);
318 if (convertToEquationSystem) {
327 std::vector<SolutionType> x = std::vector<SolutionType>(relevantStates.
getNumberOfSetBits(), storm::utility::convertNumber<SolutionType>(0.5));
330 std::vector<SolutionType> b(relevantStates.
getNumberOfSetBits(), storm::utility::zero<SolutionType>());
333 ValueType initDist = storm::utility::one<ValueType>() / storm::utility::convertNumber<ValueType>(initialStates.
getNumberOfSetBits());
334 for (
auto state : relevantStates) {
335 if (initialStates.
get(state)) {
342 goal.restrictRelevantValues(relevantStates);
343 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver =
345 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
346 solver->solveEquations(env, x, b);
349 storm::utility::vector::setVectorValues<SolutionType>(result, relevantStates, x);
355template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
359 if constexpr (storm::IsIntervalType<ValueType>) {
360 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing globally probabilities with interval models.");
363 std::vector<SolutionType> result = computeUntilProbabilities(env, std::move(goal), transitionMatrix, backwardTransitions,
365 for (
auto& entry : result) {
366 entry = storm::utility::one<SolutionType>() - entry;
372template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
375 if constexpr (storm::IsIntervalType<ValueType>) {
376 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support next probabilities with interval models.");
379 std::vector<ValueType> result(transitionMatrix.
getRowCount());
384 multiplier->multiply(env, result,
nullptr, result);
389template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
392 RewardModelType
const& rewardModel, uint_fast64_t stepBound) {
393 if constexpr (storm::IsIntervalType<ValueType>) {
394 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support cumulative rewards with interval models.");
397 std::vector<ValueType> result(transitionMatrix.
getRowCount());
400 std::vector<ValueType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
404 multiplier->repeatedMultiply(env, result, &totalRewardVector, stepBound);
410template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
413 RewardModelType
const& rewardModel, uint_fast64_t stepCount) {
414 if constexpr (storm::IsIntervalType<ValueType>) {
415 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support instantaneous rewards with interval models.");
418 STORM_LOG_THROW(rewardModel.hasStateRewards(), storm::exceptions::InvalidPropertyException,
419 "Computing instantaneous rewards for a reward model that does not define any state-rewards. The result is trivially 0.");
422 std::vector<ValueType> result = rewardModel.getStateRewardVector();
426 multiplier->repeatedMultiply(env, result,
nullptr, stepCount);
432template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
436 if constexpr (storm::IsIntervalType<ValueType>) {
437 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing total rewards with interval models.");
444 return computeReachabilityRewards(env, std::move(goal), transitionMatrix, backwardTransitions, rewardModel, rew0States, qualitative, hint);
453 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The specified property is not supported by this value type.");
457template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
460 RewardModelType
const& rewardModel, uint_fast64_t stepBound, ValueType discountFactor) {
461 if constexpr (storm::IsIntervalType<ValueType>) {
462 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support discounted cumulative rewards with interval models.");
465 STORM_LOG_THROW(!rewardModel.empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
468 std::vector<ValueType> totalRewardVector = rewardModel.getTotalRewardVector(transitionMatrix);
471 std::vector<SolutionType> result(transitionMatrix.
getRowGroupCount(), storm::utility::zero<SolutionType>());
474 multiplier->repeatedMultiplyWithFactor(env, result, &totalRewardVector, stepBound, discountFactor);
487 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The specified property is not supported by this value type.");
491template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
496 if constexpr (storm::IsIntervalType<ValueType>) {
497 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support discounted total rewards with interval models.");
501 "Exact solving of discounted total reward objectives is currently not supported.");
504 std::vector<ValueType> b;
506 std::vector<ValueType> x = std::vector<ValueType>(transitionMatrix.
getRowGroupCount(), storm::utility::zero<ValueType>());
507 b = rewardModel.getTotalRewardVector(transitionMatrix);
510 return std::vector<SolutionType>(std::move(x));
514template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
519 return computeReachabilityRewards(
520 env, std::move(goal), transitionMatrix, backwardTransitions,
522 return rewardModel.getTotalRewardVector(numberOfRows, transitionMatrix, maybeStates);
524 targetStates, qualitative, [&]() {
return rewardModel.getStatesWithZeroReward(transitionMatrix); }, hint);
527template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
532 return computeReachabilityRewards(
533 env, std::move(goal), transitionMatrix, backwardTransitions,
535 std::vector<ValueType> result(numberOfRows, storm::utility::zero<ValueType>());
542template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
547 if constexpr (storm::IsIntervalType<ValueType>) {
548 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing reachability times with interval models.");
550 return computeReachabilityRewards(
551 env, std::move(goal), transitionMatrix, backwardTransitions,
553 return std::vector<ValueType>(numberOfRows, storm::utility::one<ValueType>());
560template<
typename ValueType,
typename SolutionType>
562 std::vector<SolutionType>
const& oneStepTargetProbabilities) {
563 if constexpr (storm::IsIntervalType<ValueType>) {
564 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing upper reward bounds with interval models.");
574 std::vector<storm::RationalFunction>
const& ,
575 std::vector<storm::RationalFunction>
const& ) {
576 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Computing upper reward bounds is not supported for rational functions.");
579template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
584 totalStateRewardVectorGetter,
587 std::vector<SolutionType> result(transitionMatrix.
getRowCount(), storm::utility::zero<SolutionType>());
591 if (storm::settings::getModule<storm::settings::modules::ModelCheckerSettings>().isFilterRewZeroSet()) {
594 rew0States = targetStates;
600 maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
604 <<
" states remaining).");
609 maybeStates = ~(rew0States | infinityStates);
612 <<
" states with reward zero (" << maybeStates.
getNumberOfSetBits() <<
" states remaining).");
618 bool maybeStatesNotRelevant = goal.hasRelevantValues() && goal.relevantValues().isDisjointFrom(maybeStates);
621 if (qualitative || maybeStatesNotRelevant) {
624 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, storm::utility::one<SolutionType>());
626 if (!maybeStates.
empty()) {
627 if constexpr (storm::IsIntervalType<ValueType>) {
633 std::vector<ValueType> b = totalStateRewardVectorGetter(submatrix.
getRowCount(), transitionMatrix, maybeStates);
639 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, x);
643 bool convertToEquationSystem =
652 std::vector<ValueType> x;
656 x = std::vector<ValueType>(submatrix.
getColumnCount(), storm::utility::one<ValueType>());
660 std::vector<ValueType> b = totalStateRewardVectorGetter(submatrix.
getRowCount(), transitionMatrix, maybeStates);
663 boost::optional<std::vector<ValueType>> upperRewardBounds;
673 if (convertToEquationSystem) {
679 goal.restrictRelevantValues(maybeStates);
680 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver =
682 solver->setLowerBound(storm::utility::zero<ValueType>());
683 if (upperRewardBounds) {
684 solver->setUpperBounds(std::move(upperRewardBounds.get()));
688 solver->solveEquations(env, x, b);
691 storm::utility::vector::setVectorValues<SolutionType>(result, maybeStates, x);
698template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
699typename SparseDtmcPrctlHelper<ValueType, RewardModelType, SolutionType>::BaierTransformedModel
700SparseDtmcPrctlHelper<ValueType, RewardModelType, SolutionType>::computeBaierTransformation(Environment
const& env,
705 boost::optional<std::vector<ValueType>>
const& stateRewards) {
706 if constexpr (storm::IsIntervalType<ValueType>) {
707 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support baier transformation with interval models.");
709 BaierTransformedModel result;
712 std::vector<ValueType> probabilitiesToReachConditionStates =
717 uint_fast64_t state = 0;
718 uint_fast64_t beforeStateIndex = 0;
719 for (
auto const& value : probabilitiesToReachConditionStates) {
720 if (value == storm::utility::zero<ValueType>()) {
721 result.beforeStates.set(state,
false);
723 probabilitiesToReachConditionStates[beforeStateIndex] = value;
728 probabilitiesToReachConditionStates.resize(beforeStateIndex);
730 if (targetStates.
empty()) {
731 result.noTargetStates =
true;
733 }
else if (!result.beforeStates.empty()) {
740 std::vector<uint_fast64_t> numberOfBeforeStatesUpToState = result.beforeStates.getNumberOfSetBitsBeforeIndices();
743 uint_fast64_t normalStatesOffset = result.beforeStates.getNumberOfSetBits();
747 bool addDeadlockState =
false;
748 uint_fast64_t deadlockState = normalStatesOffset + statesWithProbabilityGreater0.
getNumberOfSetBits();
754 uint_fast64_t currentRow = 0;
755 for (
auto beforeState : result.beforeStates) {
756 if (conditionStates.
get(beforeState)) {
758 ValueType zeroProbability = storm::utility::zero<ValueType>();
759 for (
auto const& successorEntry : transitionMatrix.getRow(beforeState)) {
760 if (statesWithProbabilityGreater0.
get(successorEntry.getColumn())) {
761 builder.
addNextValue(currentRow, normalStatesOffset + numberOfNormalStatesUpToState[successorEntry.getColumn()],
762 successorEntry.getValue());
764 zeroProbability += successorEntry.getValue();
768 builder.
addNextValue(currentRow, deadlockState, zeroProbability);
772 for (
auto const& successorEntry : transitionMatrix.getRow(beforeState)) {
773 if (result.beforeStates.get(successorEntry.getColumn())) {
774 builder.
addNextValue(currentRow, numberOfBeforeStatesUpToState[successorEntry.getColumn()],
775 successorEntry.getValue() *
776 probabilitiesToReachConditionStates[numberOfBeforeStatesUpToState[successorEntry.getColumn()]] /
777 probabilitiesToReachConditionStates[currentRow]);
785 for (
auto state : statesWithProbabilityGreater0) {
786 ValueType zeroProbability = storm::utility::zero<ValueType>();
787 for (
auto const& successorEntry : transitionMatrix.getRow(state)) {
788 if (statesWithProbabilityGreater0.
get(successorEntry.getColumn())) {
789 builder.
addNextValue(currentRow, normalStatesOffset + numberOfNormalStatesUpToState[successorEntry.getColumn()],
790 successorEntry.getValue());
792 zeroProbability += successorEntry.getValue();
796 addDeadlockState =
true;
797 builder.
addNextValue(currentRow, deadlockState, zeroProbability);
801 if (addDeadlockState) {
802 builder.
addNextValue(deadlockState, deadlockState, storm::utility::one<ValueType>());
806 result.transitionMatrix = builder.
build(addDeadlockState ? (deadlockState + 1) : deadlockState);
808 newTargetStates.
resize(result.transitionMatrix.get().getRowCount());
809 for (
auto state : targetStates % statesWithProbabilityGreater0) {
810 newTargetStates.
set(normalStatesOffset + state,
true);
812 result.targetStates = std::move(newTargetStates);
816 std::vector<ValueType> newStateRewards(result.beforeStates.getNumberOfSetBits());
819 newStateRewards.reserve(result.transitionMatrix.get().getRowCount());
820 for (
auto state : statesWithProbabilityGreater0) {
821 newStateRewards.push_back(stateRewards.get()[state]);
824 if (addDeadlockState) {
825 newStateRewards.push_back(storm::utility::zero<ValueType>());
827 result.stateRewards = std::move(newStateRewards);
835template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
836storm::storage::BitVector SparseDtmcPrctlHelper<ValueType, RewardModelType, SolutionType>::BaierTransformedModel::getNewRelevantStates()
const {
838 for (uint64_t i = 0;
i < this->beforeStates.getNumberOfSetBits(); ++
i) {
839 newRelevantStates.set(i);
841 return newRelevantStates;
844template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
845storm::storage::BitVector SparseDtmcPrctlHelper<ValueType, RewardModelType, SolutionType>::BaierTransformedModel::getNewRelevantStates(
852template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
857 if constexpr (storm::IsIntervalType<ValueType>) {
858 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing conditional probabilities with interval models.");
861 std::vector<ValueType> result(transitionMatrix.
getRowCount(), storm::utility::infinity<ValueType>());
863 if (!conditionStates.
empty()) {
864 BaierTransformedModel transformedModel =
865 computeBaierTransformation(env, transitionMatrix, backwardTransitions, targetStates, conditionStates, boost::none);
867 if (transformedModel.noTargetStates) {
877 if (goal.hasRelevantValues()) {
878 newRelevantValues = transformedModel.getNewRelevantStates(goal.relevantValues());
880 newRelevantValues = transformedModel.getNewRelevantStates();
882 goal.setRelevantValues(std::move(newRelevantValues));
883 std::vector<ValueType> conditionalProbabilities = computeUntilProbabilities(
884 env, std::move(goal), newTransitionMatrix, newTransitionMatrix.
transpose(),
895template<
typename ValueType,
typename RewardModelType,
typename SolutionType>
900 if constexpr (storm::IsIntervalType<ValueType>) {
901 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"We do not support computing conditional rewards with interval models.");
904 std::vector<ValueType> result(transitionMatrix.
getRowCount(), storm::utility::infinity<ValueType>());
906 if (!conditionStates.
empty()) {
907 BaierTransformedModel transformedModel = computeBaierTransformation(env, transitionMatrix, backwardTransitions, targetStates, conditionStates,
908 rewardModel.getTotalRewardVector(transitionMatrix));
910 if (transformedModel.noTargetStates) {
920 if (goal.hasRelevantValues()) {
921 newRelevantValues = transformedModel.getNewRelevantStates(goal.relevantValues());
923 newRelevantValues = transformedModel.getNewRelevantStates();
925 goal.setRelevantValues(std::move(newRelevantValues));
926 std::vector<ValueType> conditionalRewards =
927 computeReachabilityRewards(env, std::move(goal), newTransitionMatrix, newTransitionMatrix.
transpose(), transformedModel.stateRewards.get(),
928 transformedModel.targetStates.get(), qualitative);
SolverEnvironment & solver()
void setLinearEquationSolverPrecision(boost::optional< storm::RationalNumber > const &newPrecision, boost::optional< bool > const &relativePrecision=boost::none)
bool isForceExact() const
This class contains information that might accelerate the model checking process.
virtual bool isExplicitModelCheckerHint() const
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 std::vector< 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, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< SolutionType > computeConditionalProbabilities(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, storm::storage::BitVector const &conditionStates, bool qualitative)
static std::vector< 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, ModelCheckerHint const &hint=ModelCheckerHint())
static std::vector< 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, ModelCheckerHint const &hint=ModelCheckerHint())
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 std::vector< SolutionType > computeConditionalRewards(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, storm::storage::BitVector const &conditionStates, bool qualitative)
static std::vector< 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, ValueType discountFactor, ModelCheckerHint const &hint=ModelCheckerHint())
static std::map< storm::storage::sparse::state_type, SolutionType > computeRewardBoundedValues(Environment const &env, storm::models::sparse::Dtmc< ValueType > const &model, std::shared_ptr< storm::logic::OperatorFormula const > rewardBoundedFormula)
static std::vector< SolutionType > computeAllUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &initialStates, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
static std::vector< 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)
static std::vector< 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, 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::vector< SolutionType > computeNextProbabilities(Environment const &env, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &nextStates)
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...
void setEquationSystemFormatForEpochModel(storm::solver::LinearEquationSolverProblemFormat eqSysFormat)
This class represents a discrete-time Markov chain.
storm::storage::BitVector const & getInitialStates() const
Retrieves the initial states of the model.
LinearEquationSolverRequirements getRequirements(Environment const &env) const
Retrieves the requirements of the solver if it was created with the current settings.
virtual LinearEquationSolverProblemFormat getEquationProblemFormat(Environment const &env) const
Retrieves the problem format that the solver expects if it was created with the current settings.
SolverRequirement const & upperBounds() const
std::string getEnabledRequirementsAsString() const
Checks whether there are no critical requirements left.
bool hasEnabledCriticalRequirement() const
std::unique_ptr< Multiplier< ValueType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
A bit vector that is internally represented as a vector of 64-bit values.
void complement()
Negates all bits in the bit vector.
std::vector< uint64_t > getNumberOfSetBitsBeforeIndices() const
Retrieves a vector that holds at position i the number of bits set before index i.
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.
void resize(uint64_t newLength, bool init=false)
Resizes the bit vector to hold the given new number of bits.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
A class that can be used to build a sparse matrix by adding value by value.
void addNextValue(index_type row, index_type column, value_type const &value)
Sets the matrix entry at the given row and column to the given value.
SparseMatrix< value_type > build(index_type overriddenRowCount=0, index_type overriddenColumnCount=0, index_type overriddenRowGroupCount=0)
A class that holds a possibly non-square matrix in the compressed row storage format.
void convertToEquationSystem()
Transforms the matrix into an equation system.
void makeRowsAbsorbing(storm::storage::BitVector const &rows, bool dropZeroEntries=false)
This function makes the given rows absorbing.
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...
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.
void deleteDiagonalEntries(bool dropZeroEntries=false)
Sets all diagonal elements to zero.
storm::storage::SparseMatrix< value_type > transpose(bool joinGroups=false, bool keepZeros=false) const
Transposes the matrix.
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_THROW(cond, exception, message)
#define STORM_PRINT_AND_LOG(message)
SFTBDDChecker::ValueType ValueType
std::vector< SolutionType > computeRobustValuesForMaybeStates(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > &&submatrix, std::vector< ValueType > const &b, bool computeReward)
std::vector< ValueType > computeUpperRewardBounds(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &rewards, std::vector< ValueType > const &oneStepTargetProbabilities)
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)
std::unique_ptr< storm::solver::LinearEquationSolver< ValueType > > configureLinearEquationSolver(Environment const &env, SolveGoal< ValueType, SolutionType > &&goal, storm::solver::LinearEquationSolverFactory< ValueType > const &factory, MatrixType &&matrix)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01(storm::models::sparse::DeterministicModel< T > const &model, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 or 1, respectively, of satisfying phi until psi i...
storm::storage::BitVector getReachableStates(storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::BitVector const &initialStates, storm::storage::BitVector const &constraintStates, storm::storage::BitVector const &targetStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceFilter)
Performs a forward depth-first search through the underlying graph structure to identify the states t...
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Performs a backward depth-first search trough the underlying graph structure of the given model to de...
storm::storage::BitVector performProb1(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &, storm::storage::BitVector const &psiStates, storm::storage::BitVector const &statesWithProbabilityGreater0)
Computes the set of states of the given model for which all paths lead to the given set of target sta...
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...
storm::storage::BitVector filterZero(std::vector< T > const &values)
Retrieves a bit vector containing all the indices for which the value at this position is equal to ze...
std::vector< Type > filterVector(std::vector< Type > const &in, storm::storage::BitVector const &filter)
bool isOne(ValueType const &a)
bool isZero(ValueType const &a)