29template<
typename ModelType>
32 : model(model), objective(objective) {
36template<
typename ModelType>
39 auto checkResult = mc.
check(formula);
40 STORM_LOG_THROW(checkResult && checkResult->isExplicitQualitativeCheckResult(), storm::exceptions::UnexpectedException,
41 "Unexpected type of check result for subformula " << formula <<
".");
42 return checkResult->asExplicitQualitativeCheckResult().getTruthValuesVector();
45template<
typename ValueType>
53 std::vector<ValueType> stateRewardWeights(model.
getNumberOfStates(), storm::utility::zero<ValueType>());
55 stateRewardWeights[markovianState] = storm::utility::one<ValueType>() / model.
getExitRate(markovianState);
60 std::vector<ValueType> result(model.
getNumberOfChoices(), storm::utility::zero<ValueType>());
63 result[choice] = storm::utility::one<ValueType>() / model.
getExitRate(markovianState);
70template<
typename ValueType>
79 return std::vector<ValueType>(model.
getNumberOfChoices(), storm::utility::one<ValueType>());
83template<
typename ModelType>
84void DeterministicSchedsObjectiveHelper<ModelType>::initialize() {
85 STORM_LOG_ASSERT(model.getInitialStates().getNumberOfSetBits() == 1,
"Expected a single initial state.");
86 uint64_t initialState = *model.getInitialStates().begin();
88 auto const& formula = *objective.formula;
89 if (formula.isProbabilityOperatorFormula() && formula.getSubformula().isUntilFormula()) {
92 auto backwardTransitions = model.getBackwardTransitions();
94 phiStates, psiStates);
96 if (prob0States.get(initialState)) {
97 constantInitialStateValue = storm::utility::zero<ValueType>();
98 }
else if (prob1States.get(initialState)) {
99 constantInitialStateValue = storm::utility::one<ValueType>();
101 maybeStates = ~(prob0States | prob1States);
104 for (
auto const& state : maybeStates) {
105 for (
auto const& choice : model.getTransitionMatrix().getRowGroupIndices(state)) {
106 auto rowSum = model.getTransitionMatrix().getConstrainedRowSum(choice, prob1States);
108 relevantZeroRewardChoices.set(choice);
110 choiceRewards.emplace(choice, rowSum);
114 }
else if (formula.getSubformula().isEventuallyFormula() && (formula.isRewardOperatorFormula() || formula.isTimeOperatorFormula())) {
116 if (formula.isRewardOperatorFormula()) {
117 auto const& baseRewardModel = formula.asRewardOperatorFormula().hasRewardModelName()
118 ? model.getRewardModel(formula.asRewardOperatorFormula().getRewardModelName())
119 : model.getUniqueRewardModel();
124 model.getBackwardTransitions(), statesWithoutReward, rew0States);
126 if (rew0States.
get(initialState)) {
127 constantInitialStateValue = storm::utility::zero<ValueType>();
129 maybeStates = ~rew0States;
133 for (
auto const& state : maybeStates) {
134 for (
auto const& choice : model.getTransitionMatrix().getRowGroupIndices(state)) {
135 auto const& value = choiceBasedRewards[choice];
137 relevantZeroRewardChoices.set(choice);
139 choiceRewards.emplace(choice, value);
143 }
else if (formula.isRewardOperatorFormula() && formula.getSubformula().isTotalRewardFormula()) {
144 auto const& baseRewardModel = formula.asRewardOperatorFormula().hasRewardModelName()
145 ? model.getRewardModel(formula.asRewardOperatorFormula().getRewardModelName())
146 : model.getUniqueRewardModel();
153 if (rew0States.
get(initialState)) {
154 constantInitialStateValue = storm::utility::zero<ValueType>();
156 maybeStates = ~rew0States;
160 for (
auto const& state : maybeStates) {
161 for (
auto const& choice : model.getTransitionMatrix().getRowGroupIndices(state)) {
162 auto const& value = choiceBasedRewards[choice];
164 relevantZeroRewardChoices.set(choice);
166 choiceRewards.emplace(choice, value);
171 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The given formula " << formula <<
" is not supported.");
176 for (
auto& entry : choiceRewards) {
177 entry.second *= -storm::utility::one<ValueType>();
184 for (
auto const& rew : getChoiceRewards()) {
185 if (rew.second > storm::utility::zero<ValueType>()) {
186 positiveRewardChoices.set(rew.first,
true);
188 assert(rew.second < storm::utility::zero<ValueType>());
189 negativeRewardChoices.set(rew.first,
true);
192 auto backwardTransitions = model.getBackwardTransitions();
197 STORM_LOG_THROW(!(hasNegativeEC && hasPositiveEc), storm::exceptions::NotSupportedException,
198 "Objective is not convergent: Infinite positive and infinite negative reward is possible.");
199 infinityCase = hasNegativeEC ? InfinityCase::HasNegativeInfinite : (hasPositiveEc ? InfinityCase::HasPositiveInfinite : InfinityCase::AlwaysFinite);
201 if (infinityCase == InfinityCase::HasNegativeInfinite) {
204 for (
auto const& mec : mecs) {
205 if (std::any_of(mec.begin(), mec.end(), [&negativeRewardChoices](
auto const& sc) {
206 return std::any_of(sc.second.begin(), sc.second.end(), [&negativeRewardChoices](auto const& c) { return negativeRewardChoices.get(c); });
208 for (
auto const& sc : mec) {
209 negativeEcStates.set(sc.first);
215 STORM_LOG_ASSERT(model.getInitialStates().isSubsetOf(rewMinusInfEStates),
"Initial state does not reach all maybestates");
219template<
typename ModelType>
224template<
typename ModelType>
226 STORM_LOG_ASSERT(getInfinityCase() == InfinityCase::HasNegativeInfinite,
"Tried to get -inf states, but there are none");
227 return rewMinusInfEStates;
230template<
typename ModelType>
232 return constantInitialStateValue.has_value();
235template<
typename ModelType>
237 assert(hasConstantInitialStateValue());
238 return *constantInitialStateValue;
241template<
typename ModelType>
243 return choiceRewards;
246template<
typename ModelType>
248 return relevantZeroRewardChoices;
251template<
typename ModelType>
254 STORM_LOG_ASSERT(upperResultBounds.has_value(),
"requested upper value bounds but they were not computed.");
255 return upperResultBounds->at(state);
258template<
typename ModelType>
261 STORM_LOG_ASSERT(lowerResultBounds.has_value(),
"requested lower value bounds but they were not computed.");
262 return lowerResultBounds->at(state);
265template<
typename ModelType>
270template<
typename ModelType>
272 return objective.formula->isRewardOperatorFormula() && objective.formula->getSubformula().isTotalRewardFormula();
275template<
typename ModelType>
277 return objective.formula->hasBound();
280template<
typename ModelType>
282 STORM_LOG_ASSERT(hasThreshold(),
"Trying to get a threshold but there is none");
284 "Objective " << *objective.originalFormula <<
": Strict objective thresholds are not supported.");
285 ValueType threshold = objective.formula->template getThresholdAs<ValueType>();
287 threshold *= -storm::utility::one<ValueType>();
289 "Objective " << *objective.originalFormula <<
": Minimizing objective should specify an upper bound.");
292 "Objective " << *objective.originalFormula <<
": Maximizing objective should specify a lower bound.");
297template<
typename ModelType>
302template<
typename ValueType>
304 std::vector<ValueType>
const& rewards, std::vector<ValueType>
const& exitProbabilities,
305 std::optional<storm::OptimizationDirection> dir,
bool reqLower,
bool reqUpper) {
306 if (!reqLower && !reqUpper) {
311 auto [minIt, maxIt] = std::minmax_element(rewards.begin(), rewards.end());
312 bool const hasNegativeValues = *minIt < storm::utility::zero<ValueType>();
313 bool const hasPositiveValues = *maxIt > storm::utility::zero<ValueType>();
315 std::optional<ValueType> lowerBound, upperBound;
318 if (!hasNegativeValues) {
319 lowerBound = storm::utility::zero<ValueType>();
321 if (!hasPositiveValues) {
322 upperBound = storm::utility::zero<ValueType>();
326 std::vector<ValueType> tmpRewards;
327 if (reqUpper && !upperBound.has_value()) {
328 if (hasNegativeValues) {
329 tmpRewards.resize(rewards.size());
332 if (dir.has_value() && maximize(*dir)) {
335 .computeUpperBound());
339 .computeUpperBounds());
342 if (reqLower && !upperBound.has_value()) {
345 tmpRewards.resize(rewards.size());
347 [](ValueType
const& v) {
return std::max<ValueType>(storm::utility::zero<ValueType>(), -v); });
348 if (dir.has_value() && minimize(*dir)) {
360template<
typename ValueType>
362 std::vector<ValueType>
const& exitProbs, std::vector<ValueType>
const& rewards,
365 minMaxSolver->setHasUniqueSolution(
true);
366 minMaxSolver->setOptimizationDirection(dir);
367 auto req = minMaxSolver->getRequirements(env, dir);
370 if (req.validInitialScheduler()) {
372 auto backwardsTransitions = submatrix.
transpose(
true);
375 std::vector<uint64_t> stack;
376 for (uint64_t state = 0; state < initSched.size(); ++state) {
377 if (foundStates.
get(state)) {
383 statesWithChoice.
set(state);
384 foundStates.
set(state);
385 for (
auto const& predecessor : backwardsTransitions.getRow(state)) {
386 if (!foundStates.
get(predecessor.getColumn())) {
387 stack.push_back(predecessor.getColumn());
388 foundStates.
set(predecessor.getColumn());
395 while (!stack.empty()) {
396 auto state = stack.back();
399 auto row = submatrix.
getRow(choice);
400 if (std::any_of(row.begin(), row.end(), [&statesWithChoice](
auto const& entry) {
401 return !storm::utility::isZero(entry.getValue()) && statesWithChoice.get(entry.getColumn());
404 statesWithChoice.
set(state);
408 assert(statesWithChoice.
get(state));
409 for (
auto const& predecessor : backwardsTransitions.getRow(state)) {
410 if (!foundStates.
get(predecessor.getColumn())) {
411 stack.push_back(predecessor.getColumn());
412 foundStates.
set(predecessor.getColumn());
416 assert(statesWithChoice.
full());
417 minMaxSolver->setInitialScheduler(std::move(initSched));
418 req.clearValidInitialScheduler();
420 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
421 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
422 minMaxSolver->setRequirementsChecked(
true);
425 minMaxSolver->solveEquations(env, result, rewards);
430template<
typename ValueType>
435 value += value * eps;
442template<
typename ValueType>
447 value -= value * eps;
454template<storm::OptimizationDirection Dir,
typename ValueType>
456 auto sum = storm::utility::zero<ValueType>();
457 for (
auto const& stateChoices : mec) {
459 for (
auto const& choice : stateChoices.second) {
460 optimalStateValue &= rewards.at(choice);
462 sum += *optimalStateValue;
467template<
typename ValueType>
471 initialAsBitVector.
set(init,
true);
473 targetAsBitVector.
set(target,
true);
475 auto product = storm::utility::one<ValueType>();
476 for (
auto state : relevantStates) {
477 if (state == target) {
481 for (
auto const& entry : transitions.
getRowGroup(state)) {
482 if (relevantStates.get(entry.getColumn())) {
483 minProb &= entry.getValue();
491template<
typename ModelType>
493 assert(!upperResultBounds.has_value() && !lowerResultBounds.has_value());
494 auto backwardTransitions = model.getBackwardTransitions();
495 auto nonMaybeStates = ~maybeStates;
498 getRelevantZeroRewardChoices());
500 auto backwardTransitions1 = quotient1.matrix.transpose(
true);
501 std::vector<ValueType> rewards1(quotient1.matrix.getRowCount(), storm::utility::zero<ValueType>());
502 std::vector<ValueType> exitProbs1(quotient1.matrix.getRowCount(), storm::utility::zero<ValueType>());
505 for (uint64_t choice = 0; choice < quotient1.matrix.getRowCount(); ++choice) {
506 auto const& oldChoice = quotient1.newToOldRowMapping[choice];
507 if (
auto findRes = choiceRewards.find(oldChoice); findRes != choiceRewards.end()) {
508 rewards1[choice] = findRes->second;
510 if (quotient1.sinkRows.get(choice)) {
511 subsystemChoices1.
set(choice,
false);
512 exitProbs1[choice] = storm::utility::one<ValueType>();
513 }
else if (
auto prob = model.getTransitionMatrix().getConstrainedRowSum(oldChoice, nonMaybeStates); !
storm::utility::isZero(prob)) {
514 exitProbs1[choice] = prob;
515 subsystemChoices1.
set(choice,
false);
519 auto exitStates1 = quotient1.matrix.getRowGroupFilter(~subsystemChoices1,
false);
521 storm::exceptions::InvalidOperationException,
"Objective " << *objective.originalFormula <<
" does not induce finite value.");
524 if (getInfinityCase() != InfinityCase::HasNegativeInfinite) {
526 lowerResultBounds = std::vector<ValueType>(model.getNumberOfStates(), storm::utility::zero<ValueType>());
527 for (
auto const& state : maybeStates) {
528 ValueType val = result1.at(quotient1.oldToNewStateMapping.at(state));
530 (*lowerResultBounds)[state] = val;
533 if (getInfinityCase() != InfinityCase::HasPositiveInfinite) {
535 upperResultBounds = std::vector<ValueType>(model.getNumberOfStates(), storm::utility::zero<ValueType>());
536 for (
auto const& state : maybeStates) {
537 ValueType val = result1.at(quotient1.oldToNewStateMapping.at(state));
539 if (infinityCase == InfinityCase::HasNegativeInfinite) {
540 val = std::max(val, storm::utility::zero<ValueType>());
542 (*upperResultBounds)[state] = val;
545 if (getInfinityCase() != InfinityCase::AlwaysFinite) {
546 assert(getInfinityCase() == InfinityCase::HasPositiveInfinite || getInfinityCase() == InfinityCase::HasNegativeInfinite);
548 hasThreshold() || getInfinityCase() == InfinityCase::HasNegativeInfinite, storm::exceptions::NotSupportedException,
549 "The upper bound for objective " << *objective.originalFormula <<
" is infinity at some state. This is only supported for thresholded objectives");
556 std::vector<ValueType> rewards2(quotient2.matrix.getRowCount(), storm::utility::zero<ValueType>());
557 std::vector<ValueType> exitProbs2(quotient2.matrix.getRowCount(), storm::utility::zero<ValueType>());
558 for (uint64_t choice = 0; choice < quotient2.matrix.getRowCount(); ++choice) {
559 auto const& oldChoice = quotient2.newToOldRowMapping[choice];
560 if (quotient2.sinkRows.get(choice)) {
561 exitProbs2[choice] = storm::utility::one<ValueType>();
563 rewards2[choice] = rewards1[oldChoice];
564 exitProbs2[choice] = exitProbs1[oldChoice];
569 auto initialState2 = quotient2.oldToNewStateMapping.at(quotient1.oldToNewStateMapping.at(*model.getInitialStates().begin()));
571 if (getInfinityCase() == InfinityCase::HasPositiveInfinite) {
572 rewardValueForPosInfCase = getThreshold();
575 std::vector<ValueType> rewards2Negative;
576 rewards2Negative.reserve(rewards2.size());
577 for (
auto const& rew : rewards2) {
578 rewards2Negative.push_back(std::min(rew, storm::utility::zero<ValueType>()));
580 auto lower2 =
computeValuesOfReducedSystem(env, quotient2.matrix, exitProbs2, rewards2Negative, storm::OptimizationDirection::Minimize);
581 rewardValueForPosInfCase -= lower2.at(initialState2);
583 for (
auto const& mec : remainingMecs) {
584 auto mecState2 = quotient2.oldToNewStateMapping[mec.begin()->first];
585 ValueType mecReward = getInfinityCase() == InfinityCase::HasPositiveInfinite
586 ? sumOfMecRewards<storm::OptimizationDirection::Maximize>(mec, rewards1)
587 : sumOfMecRewards<storm::OptimizationDirection::Minimize>(mec, rewards1);
589 auto groupIndices = quotient2.matrix.getRowGroupIndices(mecState2);
590 for (
auto const choice2 : groupIndices) {
591 rewards2[choice2] += mecReward;
593 if (getInfinityCase() == InfinityCase::HasPositiveInfinite) {
594 auto sinkChoice = quotient2.sinkRows.getNextSetIndex(*groupIndices.begin());
595 STORM_LOG_ASSERT(sinkChoice < quotient2.matrix.getRowGroupIndices()[mecState2 + 1],
"EC state in quotient has no sink row.");
601 if (getInfinityCase() == InfinityCase::HasNegativeInfinite) {
603 lowerResultBounds = std::vector<ValueType>(model.getNumberOfStates(), storm::utility::zero<ValueType>());
604 for (
auto const& state : maybeStates) {
605 ValueType val = result2.at(quotient2.oldToNewStateMapping.at(quotient1.oldToNewStateMapping.at(state)));
607 (*lowerResultBounds)[state] = val;
610 assert(getInfinityCase() == InfinityCase::HasPositiveInfinite);
612 upperResultBounds = std::vector<ValueType>(model.getNumberOfStates(), storm::utility::zero<ValueType>());
613 for (
auto const& state : maybeStates) {
614 ValueType val = result2.at(quotient2.oldToNewStateMapping.at(quotient1.oldToNewStateMapping.at(state)));
616 (*upperResultBounds)[state] = val;
621 std::all_of(maybeStates.begin(), maybeStates.end(), [
this](
auto const& s) { return this->lowerResultBounds->at(s) <= this->upperResultBounds->at(s); }),
622 storm::exceptions::UnexpectedException,
"Pre-computed lower bound exceeds upper bound.");
625template<
typename ModelType>
628 STORM_LOG_ASSERT(model.getInitialStates().getNumberOfSetBits() == 1u,
"Expected a single initial state.");
629 STORM_LOG_ASSERT(model.getInitialStates().isSubsetOf(getMaybeStates()),
"Expected initial state to be maybestate.");
632 auto selectedMatrix = model.getTransitionMatrix().getSubmatrix(
false, selectedChoices, allStates);
633 assert(selectedMatrix.getRowCount() == selectedMatrix.getRowGroupCount());
634 selectedMatrix.makeRowGroupingTrivial();
635 auto subMaybeStates =
638 bsccCandidates.complement();
639 if (!bsccCandidates.empty()) {
643 for (
auto const& bscc : bsccs) {
644 for (
auto const& s : bscc) {
645 subMaybeStates.set(s,
false);
650 if (subMaybeStates.get(*model.getInitialStates().begin())) {
653 auto eqSysMatrix = selectedMatrix.getSubmatrix(
true, subMaybeStates, subMaybeStates, useEqSysFormat);
654 assert(eqSysMatrix.getRowCount() == eqSysMatrix.getRowGroupCount());
655 auto exitProbs = selectedMatrix.getConstrainedRowSumVector(subMaybeStates, ~subMaybeStates);
656 std::vector<ValueType> rewards;
657 rewards.reserve(exitProbs.size());
658 auto const& allRewards = getChoiceRewards();
659 for (
auto const& state : getMaybeStates()) {
660 auto choice = selectedChoices.
getNextSetIndex(model.getTransitionMatrix().getRowGroupIndices()[state]);
661 STORM_LOG_ASSERT(choice < model.getTransitionMatrix().getRowGroupIndices()[state + 1],
" no choice selected at state" << state);
662 if (subMaybeStates.get(state)) {
663 if (
auto findRes = allRewards.find(choice); findRes != allRewards.end()) {
664 rewards.push_back(findRes->second);
666 rewards.push_back(storm::utility::zero<ValueType>());
669 STORM_LOG_ASSERT(!bsccCandidates.get(state) || allRewards.count(choice) == 0,
"Strategy selected a bscc with rewards");
672 if (useEqSysFormat) {
673 eqSysMatrix.convertToEquationSystem();
675 auto solver = factory.
create(env, eqSysMatrix);
678 auto const initState = *init.
begin();
679 solver->setRelevantValues(std::move(init));
680 auto req = solver->getRequirements(env);
681 if (!useEqSysFormat) {
683 req.clearUpperBounds();
684 req.clearLowerBounds();
686 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
687 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
688 std::vector<ValueType> x(rewards.size());
689 solver->solveEquations(env, x, rewards);
694 return storm::utility::zero<ValueType>();
SolverEnvironment & solver()
storm::RationalNumber const & getPrecision() const
bool const & getRelativeTerminationCriterion() const
MinMaxSolverEnvironment & minMax()
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
ValueType computeUpperBound()
Computes an upper bound on the expected rewards.
std::vector< ValueType > computeUpperBounds()
Computes upper bounds on the expected rewards.
ModelType::ValueType ValueType
DeterministicSchedsObjectiveHelper(ModelType const &model, Objective< ValueType > const &objective)
Provides helper functions for computing bounds on the expected visiting times.
This class represents a Markov automaton.
storm::storage::BitVector const & getMarkovianStates() const
Retrieves the set of Markovian states of the model.
ValueType const & getExitRate(storm::storage::sparse::state_type state) const
Retrieves the exit rate of the given state.
This class represents a (discrete-time) Markov decision process.
RewardModelType const & getUniqueRewardModel() const
Retrieves the unique reward model, if there exists exactly one.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
RewardModelType const & getRewardModel(std::string const &rewardModelName) const
Retrieves the reward model with the given name, if one exists.
uint_fast64_t getNumberOfChoices(uint_fast64_t state) const
std::vector< ValueType > getTotalActionRewardVector(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::vector< MatrixValueType > const &stateRewardWeights) const
Creates a vector representing the complete action-based rewards, i.e., state-action- and transition-b...
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...
void setUpperBound(ValueType const &value)
Sets an upper bound for the solution that can potentially be used by the solver.
void setLowerBound(ValueType const &value)
Sets a lower bound for the solution that can potentially be used by the solver.
void setUpperBounds(std::vector< ValueType > const &values)
Sets upper bounds for the solution that can potentially be used by the solver.
void setLowerBounds(std::vector< ValueType > const &values)
Sets lower bounds for the solution that can potentially be used by the solver.
virtual std::unique_ptr< LinearEquationSolver< ValueType > > create(Environment const &env) const override
Creates an equation solver with the current settings, but without a matrix.
virtual std::unique_ptr< MinMaxLinearEquationSolver< ValueType, SolutionType > > create(Environment const &env) const override
virtual LinearEquationSolverProblemFormat getEquationProblemFormat(Environment const &env) const
Retrieves the problem format that the solver expects if it was created with the current settings.
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 full() const
Retrieves whether all bits are set 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.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
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.
This class represents the decomposition of a nondeterministic model into its maximal end components.
This class represents a maximal end-component of a nondeterministic model.
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRow(index_type row) const
Returns an object representing the given row.
const_rows getRowGroup(index_type rowGroup) const
Returns an object representing the given row group.
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
std::vector< index_type > const & getRowGroupIndices() const
Returns the grouping of rows of this matrix.
storm::storage::SparseMatrix< value_type > transpose(bool joinGroups=false, bool keepZeros=false) const
Transposes the matrix.
This class represents the decomposition of a graph-like structure into its strongly connected compone...
Stores and manages an extremal (maximal or minimal) value.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
bool isLowerBound(ComparisonType t)
bool isStrict(ComparisonType t)
std::vector< ValueType > getTotalRewardVector(storm::models::sparse::MarkovAutomaton< ValueType > const &model, storm::logic::Formula const &formula)
storm::storage::BitVector evaluatePropositionalFormula(ModelType const &model, storm::logic::Formula const &formula)
void minusMinMaxSolverPrecision(Environment const &env, ValueType &value)
ValueType sumOfMecRewards(storm::storage::MaximalEndComponent const &mec, std::vector< ValueType > const &rewards)
void plusMinMaxSolverPrecision(Environment const &env, ValueType &value)
ValueType getLowerBoundForNonZeroReachProb(storm::storage::SparseMatrix< ValueType > const &transitions, uint64_t init, uint64_t target)
std::vector< ValueType > computeValuesOfReducedSystem(Environment const &env, storm::storage::SparseMatrix< ValueType > const &submatrix, std::vector< ValueType > const &exitProbs, std::vector< ValueType > const &rewards, storm::OptimizationDirection const &dir)
void setLowerUpperTotalRewardBoundsToSolver(storm::solver::AbstractEquationSolver< ValueType > &solver, storm::storage::SparseMatrix< ValueType > const &matrix, std::vector< ValueType > const &rewards, std::vector< ValueType > const &exitProbabilities, std::optional< storm::OptimizationDirection > dir, bool reqLower, bool reqUpper)
bool constexpr minimize(OptimizationDirection d)
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 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 performProb0A(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
bool checkIfECWithChoiceExists(storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &subsystem, storm::storage::BitVector const &choices)
Checks whether there is an End Component that.
void applyPointwise(std::vector< InValueType1 > const &firstOperand, std::vector< InValueType2 > const &secondOperand, std::vector< OutValueType > &target, Operation f=Operation())
Applies the given operation pointwise on the two given vectors and writes the result to the third vec...
FilteredRewardModel< RewardModelType > createFilteredRewardModel(RewardModelType const &baseRewardModel, storm::logic::RewardAccumulation const &acc, bool isDiscreteTimeModel)
bool isZero(ValueType const &a)
StronglyConnectedComponentDecompositionOptions & subsystem(storm::storage::BitVector const &subsystem)
Sets a bit vector indicating which subsystem to consider for the decomposition into SCCs.
StronglyConnectedComponentDecompositionOptions & onlyBottomSccs(bool value=true)
Sets if only bottom SCCs, i.e. SCCs in which all states have no way of leaving the SCC),...