29namespace modelchecker {
32template<
typename ValueType>
38template<
typename ValueType>
40 std::vector<ValueType>
const& exitRates)
46template<
typename ValueType>
48 if (this->_longRunComponentDecomposition ==
nullptr) {
50 this->_computedLongRunComponentDecomposition = std::make_unique<storm::storage::StronglyConnectedComponentDecomposition<ValueType>>(
52 this->_longRunComponentDecomposition = this->_computedLongRunComponentDecomposition.get();
56template<
typename ValueType>
62 STORM_LOG_ASSERT(!this->isProduceSchedulerSet(),
"Scheduler production enabled for deterministic model.");
64 auto trivialResult = computeLraForTrivialBscc(env, stateValueGetter, actionValueGetter, component);
65 if (trivialResult.first) {
66 return trivialResult.second;
72 method == storm::solver::LraMethod::ValueIteration) {
73 method = storm::solver::LraMethod::GainBiasEquations;
75 <<
" as the solution technique for long-run properties to guarantee exact results. If you want to override this, please "
76 "explicitly specify a different LRA method.");
78 method = storm::solver::LraMethod::ValueIteration;
80 <<
" as the solution technique for long-run properties to guarantee sound results. If you want to override this, please "
81 "explicitly specify a different LRA method.");
84 if (method == storm::solver::LraMethod::ValueIteration) {
85 return computeLraForBsccVi(env, stateValueGetter, actionValueGetter, component);
86 }
else if (method == storm::solver::LraMethod::LraDistributionEquations) {
88 return computeLraForBsccSteadyStateDistr(env, stateValueGetter, actionValueGetter, component).first;
91 "Unsupported lra method selected. Defaulting to " <<
storm::solver::toString(storm::solver::LraMethod::GainBiasEquations) <<
".");
93 return computeLraForBsccGainBias(env, stateValueGetter, actionValueGetter, component).first;
96template<
typename ValueType>
103 ValueType val = storm::utility::zero<ValueType>();
104 for (
auto const& element : component) {
107 "Unexpected choice index at state " << state <<
" of deterministic model.");
109 stateValueGetter(state) + (this->isContinuousTime() ? (*this->_exitRates)[state] * actionValueGetter(state) : actionValueGetter(state));
113 }
else if (val != curr) {
114 return {
false, storm::utility::zero<ValueType>()};
125 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The requested Method for LRA computation is not supported for parametric models.");
127template<
typename ValueType>
135 if (this->isContinuousTime()) {
139 viHelper(bscc, this->_transitionMatrix, aperiodicFactor, this->_markovianStates, this->_exitRates);
140 return viHelper.performValueIteration(env, stateValueGetter, actionValueGetter, this->_exitRates);
145 viHelper(bscc, this->_transitionMatrix, aperiodicFactor);
146 return viHelper.performValueIteration(env, stateValueGetter, actionValueGetter);
150template<
typename ValueType>
167 std::unordered_map<uint64_t, uint64_t> toLocalIndexMap;
168 uint64_t localIndex = 0;
169 for (
auto const& globalIndex : bscc) {
170 toLocalIndexMap[globalIndex] = localIndex;
176 if (subEnv.solver().getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological) {
179 subEnv.solver().topological().isUnderlyingEquationSolverTypeSetFromDefault());
185 bool isEquationSystemFormat =
188 std::vector<ValueType> eqSysVector;
189 eqSysVector.reserve(bscc.
size());
192 ValueType entryValue;
193 for (
auto const& globalState : bscc) {
194 ValueType rateAtState = this->_exitRates ? (*this->_exitRates)[globalState] : storm::utility::one<ValueType>();
196 if (isEquationSystemFormat) {
198 builder.
addNextValue(row, 0, storm::utility::one<ValueType>());
199 }
else if (row > 0) {
201 builder.
addNextValue(row, 0, -storm::utility::one<ValueType>());
205 if (isEquationSystemFormat) {
208 builder.
addDiagonalEntry(row, storm::utility::one<ValueType>() - rateAtState);
211 for (
auto const& entry : this->_transitionMatrix.getRow(globalState)) {
212 uint64_t col = toLocalIndexMap[entry.getColumn()];
217 entryValue = entry.getValue() * rateAtState;
218 if (isEquationSystemFormat) {
219 entryValue = -entryValue;
223 eqSysVector.push_back(stateValuesGetter(globalState) + rateAtState * actionValuesGetter(globalState));
228 auto solver = linearEquationSolverFactory.
create(subEnv, builder.
build());
230 auto requirements = solver->getRequirements(subEnv);
231 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
232 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
235 std::vector<ValueType> eqSysSol(bscc.
size(), storm::utility::zero<ValueType>());
239 solver->solveEquations(subEnv, eqSysSol, eqSysVector);
241 ValueType gain = eqSysSol.front();
243 eqSysSol.front() = storm::utility::zero<ValueType>();
245 return std::pair<ValueType, std::vector<ValueType>>(std::move(gain), std::move(eqSysSol));
248template<
typename ValueType>
252 if (bscc.
size() == 1) {
253 return {storm::utility::one<ValueType>()};
268 return computeSteadyStateDistrForBsccEqSys(env, bscc);
271 "Unexpected algorithm for steady state distribution computation.");
272 return computeSteadyStateDistrForBsccEVTs(env, bscc);
276template<
typename ValueType>
281 bsccAsBitVector.
set(bscc.
begin(), bscc.
end(),
true);
284 uint64_t
const proxyState = *bsccAsBitVector.
rbegin();
285 bsccAsBitVector.
set(proxyState,
false);
288 this->createBackwardTransitions();
289 visittimesHelper.provideBackwardTransitions(*this->_backwardTransitions);
290 std::vector<ValueType> initialValues;
291 initialValues.reserve(bscc.
size() - 1);
292 auto row = this->_transitionMatrix.getRow(proxyState);
293 auto entryIt = row.begin();
294 auto const entryItEnd = row.end();
295 for (
auto state : bsccAsBitVector) {
296 if (entryIt != entryItEnd && state == entryIt->getColumn()) {
297 initialValues.push_back(entryIt->getValue());
300 initialValues.push_back(storm::utility::zero<ValueType>());
303 STORM_LOG_ASSERT(entryIt == entryItEnd || entryIt->getColumn() == proxyState,
"Unexpected matrix row.");
305 if (evtEnv.solver().isForceSoundness()) {
307 if (prec.first.is_initialized()) {
308 auto requiredPrecision = *prec.first;
319 storm::RationalNumber eps = requiredPrecision / (storm::utility::convertNumber<storm::RationalNumber, uint64_t>(2) + requiredPrecision);
320 evtEnv.solver().setLinearEquationSolverPrecision(eps, prec.second);
323 auto visitingTimes = visittimesHelper.computeExpectedVisitingTimes(evtEnv, bsccAsBitVector, initialValues);
324 visitingTimes.push_back(storm::utility::one<ValueType>());
325 bsccAsBitVector.
set(proxyState,
true);
327 ValueType sumOfVisitingTimes = storm::utility::zero<ValueType>();
328 if (this->isContinuousTime()) {
329 auto resultIt = visitingTimes.begin();
330 for (
auto state : bsccAsBitVector) {
331 *resultIt /= (*this->_exitRates)[state];
332 sumOfVisitingTimes += *resultIt;
336 sumOfVisitingTimes = std::accumulate(visitingTimes.begin(), visitingTimes.end(), storm::utility::zero<ValueType>());
339 return visitingTimes;
342template<
typename ValueType>
350 if (env.solver().getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological) {
353 env.solver().topological().isUnderlyingEquationSolverTypeSetFromDefault());
357 "Sound computations are not properly implemented for this computation. You might get incorrect results.");
365 std::unordered_map<uint64_t, uint64_t> toLocalIndexMap;
367 uint64_t localIndex = 0;
368 for (
auto const& globalIndex : bscc) {
369 bsccStates.
set(globalIndex,
true);
370 toLocalIndexMap[globalIndex] = localIndex;
375 auto auxMatrix = this->_transitionMatrix.getSubmatrix(
false, bsccStates, bsccStates,
true);
377 for (
auto const& globalIndex : bscc) {
378 ValueType rateAtState = this->_exitRates ? (*this->_exitRates)[globalIndex] : storm::utility::one<ValueType>();
379 for (
auto& entry : auxMatrix.getRow(row)) {
380 if (entry.getColumn() == row) {
382 entry.setValue(rateAtState * (entry.getValue() - storm::utility::one<ValueType>()));
383 }
else if (this->isContinuousTime()) {
384 entry.setValue(entry.getValue() * rateAtState);
389 assert(row == auxMatrix.getRowCount());
392 auxMatrix = auxMatrix.transpose();
397 if (isFixpointFormat) {
399 for (row = 0; row < auxMatrix.getRowCount(); ++row) {
400 for (
auto& entry : auxMatrix.getRow(row)) {
401 if (entry.getColumn() == row) {
402 entry.setValue(storm::utility::one<ValueType>() + entry.getValue());
412 uint64_t lastRow = auxMatrix.getRowCount() - 1;
413 for (
auto& entry : auxMatrix.getRow(lastRow)) {
414 entry.setColumn(col);
415 if (isFixpointFormat) {
416 if (col == lastRow) {
417 entry.setValue(storm::utility::zero<ValueType>());
419 entry.setValue(-storm::utility::one<ValueType>());
422 entry.setValue(storm::utility::one<ValueType>());
427 for (; col <= lastRow; ++col) {
428 if (isFixpointFormat) {
429 if (col != lastRow) {
430 builder.
addNextValue(lastRow, col, -storm::utility::one<ValueType>());
433 builder.
addNextValue(lastRow, col, storm::utility::one<ValueType>());
437 std::vector<ValueType> bsccEquationSystemRightSide(bscc.
size(), storm::utility::zero<ValueType>());
438 bsccEquationSystemRightSide.back() = storm::utility::one<ValueType>();
441 auto solver = linearEquationSolverFactory.
create(env, builder.
build());
442 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
444 auto requirements = solver->getRequirements(env);
445 requirements.clearLowerBounds();
446 requirements.clearUpperBounds();
447 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
448 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
450 std::vector<ValueType> steadyStateDistr(bscc.
size(), storm::utility::one<ValueType>() / storm::utility::convertNumber<ValueType, uint64_t>(bscc.
size()));
451 solver->solveEquations(env, steadyStateDistr, bsccEquationSystemRightSide);
455 if (!env.solver().isForceExact()) {
456 ValueType sum = std::accumulate(steadyStateDistr.begin(), steadyStateDistr.end(), storm::utility::zero<ValueType>());
457 storm::utility::vector::scaleVectorInPlace<ValueType, ValueType>(steadyStateDistr, storm::utility::one<ValueType>() / sum);
460 return steadyStateDistr;
463template<
typename ValueType>
468 auto steadyStateDistr = computeSteadyStateDistrForBscc(env, bscc);
471 ValueType result = storm::utility::zero<ValueType>();
472 auto solIt = steadyStateDistr.begin();
473 for (
auto const& globalState : bscc) {
474 if (this->isContinuousTime()) {
475 result += (*solIt) * (stateValuesGetter(globalState) + (*this->_exitRates)[globalState] * actionValuesGetter(globalState));
477 result += (*solIt) * (stateValuesGetter(globalState) + actionValuesGetter(globalState));
481 assert(solIt == steadyStateDistr.end());
483 return std::pair<ValueType, std::vector<ValueType>>(std::move(result), std::move(steadyStateDistr));
486template<
typename ValueType>
488 std::vector<ValueType>
const& bsccLraValues, std::vector<uint64_t>
const& inputStateToBsccIndexMap,
storm::storage::BitVector const& statesNotInComponent,
489 bool asEquationSystem) {
494 auto sspMatrix = this->_transitionMatrix.getSubmatrix(
false, statesNotInComponent, statesNotInComponent, asEquationSystem);
495 if (asEquationSystem) {
496 sspMatrix.convertToEquationSystem();
500 std::vector<ValueType> rhs;
501 rhs.reserve(sspMatrix.getRowCount());
502 for (
auto state : statesNotInComponent) {
503 ValueType stateValue = storm::utility::zero<ValueType>();
504 for (
auto const& transition : this->_transitionMatrix.getRow(state)) {
505 if (!statesNotInComponent.
get(transition.getColumn())) {
507 stateValue += transition.getValue() * bsccLraValues[inputStateToBsccIndexMap[transition.getColumn()]];
510 rhs.push_back(std::move(stateValue));
513 return std::make_pair(std::move(sspMatrix), std::move(rhs));
516template<
typename ValueType>
518 std::vector<ValueType>
const& componentLraValues) {
519 STORM_LOG_ASSERT(this->_longRunComponentDecomposition !=
nullptr,
"Decomposition not computed, yet.");
529 std::vector<uint64_t> stateIndexMap(this->_transitionMatrix.getRowGroupCount(), std::numeric_limits<uint64_t>::max());
530 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
531 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
533 statesInComponents.
set(state);
534 stateIndexMap[state] = currentComponentIndex;
538 uint64_t numberOfNonComponentStates = 0;
540 for (
auto nonComponentState : statesNotInComponent) {
541 stateIndexMap[nonComponentState] = numberOfNonComponentStates;
542 ++numberOfNonComponentStates;
546 std::vector<ValueType> sspValues;
547 if (numberOfNonComponentStates > 0) {
550 auto sspMatrixVector = buildSspMatrixVector(componentLraValues, stateIndexMap, statesNotInComponent, isEqSysFormat);
551 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver = linearEquationSolverFactory.
create(env, sspMatrixVector.first);
552 auto lowerUpperBounds = std::minmax_element(componentLraValues.begin(), componentLraValues.end());
553 solver->setBounds(*lowerUpperBounds.first, *lowerUpperBounds.second);
555 auto requirements = solver->getRequirements(env);
556 requirements.clearUpperBounds();
557 requirements.clearLowerBounds();
558 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
559 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
560 sspValues.assign(sspMatrixVector.first.getRowCount(),
561 (*lowerUpperBounds.first + *lowerUpperBounds.second) / storm::utility::convertNumber<ValueType, uint64_t>(2));
562 solver->solveEquations(env, sspValues, sspMatrixVector.second);
566 std::vector<ValueType> result(this->_transitionMatrix.getRowGroupCount());
567 for (uint64_t state = 0; state < stateIndexMap.size(); ++state) {
568 if (statesNotInComponent.
get(state)) {
569 result[state] = sspValues[stateIndexMap[state]];
571 result[state] = componentLraValues[stateIndexMap[state]];
577template<
typename ValueType>
579 createDecomposition();
580 STORM_LOG_THROW(this->_longRunComponentDecomposition->size() <= 1, storm::exceptions::InvalidOperationException,
"");
581 return computeLongRunAverageStateDistribution(env, [](uint64_t) {
return storm::utility::zero<ValueType>(); });
584template<
typename ValueType>
586 uint64_t
const& initialState) {
588 "Invlid initial state index: " << initialState <<
". Have only " << this->_transitionMatrix.getRowGroupCount() <<
" states.");
589 return computeLongRunAverageStateDistribution(env, [&initialState](uint64_t stateIndex) {
590 return initialState == stateIndex ? storm::utility::one<ValueType>() : storm::utility::zero<ValueType>();
594template<
typename ValueType>
597 createDecomposition();
604 if (prec.first.is_initialized()) {
605 auto requiredPrecision = *prec.first;
610 storm::RationalNumber eps = storm::utility::sqrt<RationalNumber>(storm::utility::one<storm::RationalNumber>() + requiredPrecision) -
611 storm::utility::one<storm::RationalNumber>();
613 STORM_LOG_INFO(
"Precision for BSCC reachability and BSCC steady state distribution analysis set to " << storm::utility::convertNumber<double>(eps)
618 auto bsccReachProbs = computeBsccReachabilityProbabilities(subEnv, initialDistributionGetter);
620 std::vector<ValueType> steadyStateDistr(this->_transitionMatrix.getRowGroupCount(), storm::utility::zero<ValueType>());
621 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
622 auto const& component = (*this->_longRunComponentDecomposition)[currentComponentIndex];
624 auto bsccDistr = this->computeSteadyStateDistrForBscc(subEnv, component);
626 auto const& scalingFactor = bsccReachProbs[currentComponentIndex];
631 auto bsccDistrIt = bsccDistr.begin();
632 for (
auto const& element : component) {
634 steadyStateDistr[state] = *bsccDistrIt;
637 STORM_LOG_ASSERT(bsccDistrIt == bsccDistr.end(),
"Unexpected number of entries in bscc distribution");
639 return steadyStateDistr;
642template<
typename ValueType>
644 std::vector<ValueType>
const& toBsccProbabilities) {
650 std::vector<storm::RationalFunction>
const& ) {
652 "Computing upper bounds for expected visiting times over rational functions is not supported.");
655template<
typename ValueType>
658 STORM_LOG_ASSERT(this->_longRunComponentDecomposition !=
nullptr,
"Decomposition not computed, yet.");
661 std::vector<ValueType> bsccReachProbs;
662 if (
auto numBSCCs = this->_longRunComponentDecomposition->size(); numBSCCs <= 1) {
663 STORM_LOG_ASSERT(numBSCCs == 1,
"Found 0 BSCCs in a Markov chain. This should not be possible.");
664 bsccReachProbs = std::vector<ValueType>({storm::utility::one<ValueType>()});
667 bsccReachProbs = computeBsccReachabilityProbabilitiesClassic(env, initialDistributionGetter);
669 bsccReachProbs = computeBsccReachabilityProbabilitiesEVTs(env, initialDistributionGetter);
676 ValueType sum = std::accumulate(bsccReachProbs.begin(), bsccReachProbs.end(), storm::utility::zero<ValueType>());
677 storm::utility::vector::scaleVectorInPlace<ValueType, ValueType>(bsccReachProbs, storm::utility::one<ValueType>() / sum);
679 return bsccReachProbs;
682template<
typename ValueType>
689 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
690 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
694 bool const hasNonBsccStates = !nonBsccStates.
empty();
697 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver;
698 if (hasNonBsccStates) {
700 bool isEquationSystemFormat =
702 auto subMatrix = this->_transitionMatrix.getSubmatrix(
false, nonBsccStates, nonBsccStates, isEquationSystemFormat);
703 if (isEquationSystemFormat) {
704 subMatrix.convertToEquationSystem();
706 solver = linearEquationSolverFactory.
create(env, std::move(subMatrix));
707 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
709 auto requirements = solver->getRequirements(env);
710 requirements.clearLowerBounds();
711 requirements.clearUpperBounds();
712 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
713 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
714 solver->setCachingEnabled(
true);
718 std::vector<ValueType> bsccReachProbs(this->_longRunComponentDecomposition->size(), storm::utility::zero<ValueType>());
719 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
720 auto const& bscc = (*this->_longRunComponentDecomposition)[currentComponentIndex];
721 auto& bsccVal = bsccReachProbs[currentComponentIndex];
723 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
725 bsccVal += initialDistributionGetter(state);
728 if (hasNonBsccStates) {
730 bsccAsBitVector.
set(bscc.begin(), bscc.end(),
true);
732 std::vector<ValueType> eqSysRhs;
734 for (
auto state : nonBsccStates) {
735 eqSysRhs.push_back(this->_transitionMatrix.getConstrainedRowSum(state, bsccAsBitVector));
737 std::vector<ValueType> eqSysSolution(eqSysRhs.size());
738 solver->solveEquations(env, eqSysSolution, eqSysRhs);
740 uint64_t subsysState = 0;
741 for (
auto globalState : nonBsccStates) {
742 bsccVal += initialDistributionGetter(globalState) * eqSysSolution[subsysState];
747 return bsccReachProbs;
750template<
typename ValueType>
758 this->createBackwardTransitions();
759 visittimesHelper.provideBackwardTransitions(*this->_backwardTransitions);
760 auto expVisitTimes = visittimesHelper.computeExpectedVisitingTimes(env, initialDistributionGetter);
763 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
764 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
768 std::vector<ValueType> bsccReachProbs(this->_longRunComponentDecomposition->size(), storm::utility::zero<ValueType>());
769 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
770 auto& bsccVal = bsccReachProbs[currentComponentIndex];
771 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
773 bsccVal += initialDistributionGetter(state);
774 for (
auto const& pred : this->_backwardTransitions->getRow(state)) {
775 if (nonBsccStates.
get(pred.getColumn())) {
776 bsccVal += pred.getValue() * expVisitTimes[pred.getColumn()];
781 return bsccReachProbs;
SolverEnvironment & solver()
ModelCheckerEnvironment & modelchecker()
storm::RationalNumber const & getAperiodicFactor() const
bool const & isDetLraMethodSetFromDefault() const
storm::RationalNumber const & getPrecision() const
bool const & getRelativeTerminationCriterion() const
storm::solver::LraMethod const & getDetLraMethod() const
SteadyStateDistributionAlgorithm getSteadyStateDistributionAlgorithm() const
void setLinearEquationSolverType(storm::solver::EquationSolverType const &value, bool isSetFromDefault=false)
storm::solver::EquationSolverType const & getLinearEquationSolverType() const
void setLinearEquationSolverPrecision(boost::optional< storm::RationalNumber > const &newPrecision, boost::optional< bool > const &relativePrecision=boost::none)
bool isForceExact() const
LongRunAverageSolverEnvironment & lra()
bool isForceSoundness() const
std::pair< boost::optional< storm::RationalNumber >, boost::optional< bool > > getPrecisionOfLinearEquationSolver(storm::solver::EquationSolverType const &solverType) const
static std::vector< ValueType > computeUpperBoundOnExpectedVisitingTimes(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &oneStepTargetProbabilities)
Computes for each state an upper bound for the maximal expected times each state is visited.
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
SparseDeterministicInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitionMatrix)
Initializes the helper for a discrete time model (i.e.
ValueType computeLraForBsccVi(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, storm::storage::StronglyConnectedComponent const &bscc)
As computeLraForComponent but uses value iteration as a solution method (independent of what is set i...
std::pair< ValueType, std::vector< ValueType > > computeLraForBsccGainBias(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, storm::storage::StronglyConnectedComponent const &bscc)
As computeLraForComponent but solves a linear equation system encoding gain and bias (independent of ...
virtual ValueType computeLraForComponent(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, storm::storage::StronglyConnectedComponent const &component) override
std::pair< ValueType, std::vector< ValueType > > computeLraForBsccSteadyStateDistr(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, storm::storage::StronglyConnectedComponent const &bscc)
As computeLraForComponent but does the computation by computing the long run average (steady state) d...
std::pair< storm::storage::SparseMatrix< ValueType >, std::vector< ValueType > > buildSspMatrixVector(std::vector< ValueType > const &bsccLraValues, std::vector< uint64_t > const &inputStateToBsccIndexMap, storm::storage::BitVector const &statesNotInComponent, bool asEquationSystem)
virtual void createDecomposition() override
std::pair< bool, ValueType > computeLraForTrivialBscc(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, storm::storage::StronglyConnectedComponent const &bscc)
SparseInfiniteHorizonHelper< ValueType, true >::ValueGetter ValueGetter
Function mapping from indices to values.
virtual std::vector< ValueType > buildAndSolveSsp(Environment const &env, std::vector< ValueType > const &mecLraValues) override
std::vector< ValueType > computeLongRunAverageStateDistribution(Environment const &env)
Computes the long run average state distribution, i.e., a vector that assigns for each state s the av...
std::vector< ValueType > computeSteadyStateDistrForBsccEVTs(Environment const &env, storm::storage::StronglyConnectedComponent const &bscc)
std::vector< ValueType > computeSteadyStateDistrForBscc(Environment const &env, storm::storage::StronglyConnectedComponent const &bscc)
Computes the long run average (steady state) distribution for the given BSCC.
std::vector< ValueType > computeBsccReachabilityProbabilitiesClassic(Environment const &env, ValueGetter const &initialDistributionGetter)
std::vector< ValueType > computeBsccReachabilityProbabilitiesEVTs(Environment const &env, ValueGetter const &initialDistributionGetter)
std::vector< ValueType > computeBsccReachabilityProbabilities(Environment const &env, ValueGetter const &initialDistributionGetter)
Computes for each BSCC the probability to reach that SCC assuming the given distribution over initial...
std::vector< ValueType > computeSteadyStateDistrForBsccEqSys(Environment const &env, storm::storage::StronglyConnectedComponent const &bscc)
Helper class for computing for each state the expected number of times to visit that state assuming a...
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
storm::storage::SparseMatrix< ValueType > const & _transitionMatrix
Helper class that performs iterations of the value iteration method.
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 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.
const_reverse_iterator rbegin() const
Returns a reverse iterator to the indices of the set bits in the bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
void set(uint_fast64_t index, bool value=true)
Sets the given truth value at the given index.
uint_fast64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
bool get(uint_fast64_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.
void addDiagonalEntry(index_type row, ValueType const &value)
Makes sure that a diagonal entry will be inserted at the given row.
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.
std::size_t size() const
Retrieves the number of states in this SCC.
iterator begin()
Returns an iterator to the states in this SCC.
iterator end()
Returns an iterator that points one past the end of the states in this SCC.
This class represents a strongly connected component, i.e., a set of states such that every state can...
#define STORM_LOG_INFO(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
uint64_t getComponentElementState(typename storm::storage::StronglyConnectedComponent::value_type const &element)
Auxiliary functions that deal with the different kinds of components (MECs on potentially nondetermin...
uint64_t const * getComponentElementChoicesBegin(typename storm::storage::StronglyConnectedComponent::value_type const &element)
std::vector< ValueType > computeUpperBoundsForExpectedVisitingTimes(storm::storage::SparseMatrix< ValueType > const &nonBsccMatrix, std::vector< ValueType > const &toBsccProbabilities)
std::string toString(GurobiSolverMethod const &method)
Yields a string representation of the GurobiSolverMethod.
void scaleVectorInPlace(std::vector< ValueType1 > &target, ValueType2 const &factor)
Multiplies each element of the given vector with the given factor and writes the result into the vect...
bool isOne(ValueType const &a)
StronglyConnectedComponentDecompositionOptions & onlyBottomSccs(bool value=true)
Sets if only bottom SCCs, i.e. SCCs in which all states have no way of leaving the SCC),...