29namespace modelchecker {
32template<
typename ValueType>
38template<
typename ValueType>
40 std::vector<ValueType>
const& exitRates)
43template<
typename ValueType>
45 if (this->_longRunComponentDecomposition ==
nullptr) {
47 this->_computedLongRunComponentDecomposition = std::make_unique<storm::storage::StronglyConnectedComponentDecomposition<ValueType>>(
49 this->_longRunComponentDecomposition = this->_computedLongRunComponentDecomposition.get();
53template<
typename ValueType>
59 STORM_LOG_ASSERT(!this->isProduceSchedulerSet(),
"Scheduler production enabled for deterministic model.");
61 auto trivialResult = computeLraForTrivialBscc(env, stateValueGetter, actionValueGetter, component);
62 if (trivialResult.first) {
63 return trivialResult.second;
69 method == storm::solver::LraMethod::ValueIteration) {
70 method = storm::solver::LraMethod::GainBiasEquations;
72 <<
" as the solution technique for long-run properties to guarantee exact results. If you want to override this, please "
73 "explicitly specify a different LRA method.");
75 method = storm::solver::LraMethod::ValueIteration;
77 <<
" as the solution technique for long-run properties to guarantee sound results. If you want to override this, please "
78 "explicitly specify a different LRA method.");
81 if (method == storm::solver::LraMethod::ValueIteration) {
82 return computeLraForBsccVi(env, stateValueGetter, actionValueGetter, component);
83 }
else if (method == storm::solver::LraMethod::LraDistributionEquations) {
85 return computeLraForBsccSteadyStateDistr(env, stateValueGetter, actionValueGetter, component).first;
88 "Unsupported lra method selected. Defaulting to " <<
storm::solver::toString(storm::solver::LraMethod::GainBiasEquations) <<
".");
90 return computeLraForBsccGainBias(env, stateValueGetter, actionValueGetter, component).first;
93template<
typename ValueType>
100 ValueType val = storm::utility::zero<ValueType>();
101 for (
auto const& element : component) {
104 "Unexpected choice index at state " << state <<
" of deterministic model.");
106 stateValueGetter(state) + (this->isContinuousTime() ? (*this->_exitRates)[state] * actionValueGetter(state) : actionValueGetter(state));
110 }
else if (val != curr) {
111 return {
false, storm::utility::zero<ValueType>()};
122 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"The requested Method for LRA computation is not supported for parametric models.");
124template<
typename ValueType>
132 if (this->isContinuousTime()) {
136 viHelper(bscc, this->_transitionMatrix, aperiodicFactor, this->_markovianStates, this->_exitRates);
137 return viHelper.performValueIteration(env, stateValueGetter, actionValueGetter, this->_exitRates);
142 viHelper(bscc, this->_transitionMatrix, aperiodicFactor);
143 return viHelper.performValueIteration(env, stateValueGetter, actionValueGetter);
147template<
typename ValueType>
164 std::unordered_map<uint64_t, uint64_t> toLocalIndexMap;
165 uint64_t localIndex = 0;
166 for (
auto const& globalIndex : bscc) {
167 toLocalIndexMap[globalIndex] = localIndex;
173 if (subEnv.solver().getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological) {
176 subEnv.solver().topological().isUnderlyingEquationSolverTypeSetFromDefault());
182 bool isEquationSystemFormat =
185 std::vector<ValueType> eqSysVector;
186 eqSysVector.reserve(bscc.
size());
189 ValueType entryValue;
190 for (
auto const& globalState : bscc) {
191 ValueType rateAtState = this->_exitRates ? (*this->_exitRates)[globalState] : storm::utility::one<ValueType>();
193 if (isEquationSystemFormat) {
195 builder.
addNextValue(row, 0, storm::utility::one<ValueType>());
196 }
else if (row > 0) {
198 builder.
addNextValue(row, 0, -storm::utility::one<ValueType>());
202 if (isEquationSystemFormat) {
205 builder.
addDiagonalEntry(row, storm::utility::one<ValueType>() - rateAtState);
208 for (
auto const& entry : this->_transitionMatrix.getRow(globalState)) {
209 uint64_t col = toLocalIndexMap[entry.getColumn()];
214 entryValue = entry.getValue() * rateAtState;
215 if (isEquationSystemFormat) {
216 entryValue = -entryValue;
220 eqSysVector.push_back(stateValuesGetter(globalState) + rateAtState * actionValuesGetter(globalState));
225 auto solver = linearEquationSolverFactory.
create(subEnv, builder.
build());
227 auto requirements = solver->getRequirements(subEnv);
228 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
229 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
232 std::vector<ValueType> eqSysSol(bscc.
size(), storm::utility::zero<ValueType>());
236 solver->solveEquations(subEnv, eqSysSol, eqSysVector);
238 ValueType gain = eqSysSol.front();
240 eqSysSol.front() = storm::utility::zero<ValueType>();
242 return std::pair<ValueType, std::vector<ValueType>>(std::move(gain), std::move(eqSysSol));
245template<
typename ValueType>
249 if (bscc.
size() == 1) {
250 return {storm::utility::one<ValueType>()};
265 return computeSteadyStateDistrForBsccEqSys(env, bscc);
268 "Unexpected algorithm for steady state distribution computation.");
269 return computeSteadyStateDistrForBsccEVTs(env, bscc);
273template<
typename ValueType>
278 bsccAsBitVector.
set(bscc.
begin(), bscc.
end(),
true);
281 uint64_t
const proxyState = *bsccAsBitVector.
rbegin();
282 bsccAsBitVector.
set(proxyState,
false);
285 this->createBackwardTransitions();
286 visittimesHelper.provideBackwardTransitions(*this->_backwardTransitions);
287 std::vector<ValueType> initialValues;
288 initialValues.reserve(bscc.
size() - 1);
289 auto row = this->_transitionMatrix.getRow(proxyState);
290 auto entryIt = row.begin();
291 auto const entryItEnd = row.end();
292 for (
auto state : bsccAsBitVector) {
293 if (entryIt != entryItEnd && state == entryIt->getColumn()) {
294 initialValues.push_back(entryIt->getValue());
297 initialValues.push_back(storm::utility::zero<ValueType>());
300 STORM_LOG_ASSERT(entryIt == entryItEnd || entryIt->getColumn() == proxyState,
"Unexpected matrix row.");
302 if (evtEnv.solver().isForceSoundness()) {
304 if (prec.first.is_initialized()) {
305 auto requiredPrecision = *prec.first;
316 storm::RationalNumber eps = requiredPrecision / (storm::utility::convertNumber<storm::RationalNumber, uint64_t>(2) + requiredPrecision);
317 evtEnv.solver().setLinearEquationSolverPrecision(eps, prec.second);
320 auto visitingTimes = visittimesHelper.computeExpectedVisitingTimes(evtEnv, bsccAsBitVector, initialValues);
321 visitingTimes.push_back(storm::utility::one<ValueType>());
322 bsccAsBitVector.
set(proxyState,
true);
324 ValueType sumOfVisitingTimes = storm::utility::zero<ValueType>();
325 if (this->isContinuousTime()) {
326 auto resultIt = visitingTimes.begin();
327 for (
auto state : bsccAsBitVector) {
328 *resultIt /= (*this->_exitRates)[state];
329 sumOfVisitingTimes += *resultIt;
333 sumOfVisitingTimes = std::accumulate(visitingTimes.begin(), visitingTimes.end(), storm::utility::zero<ValueType>());
336 return visitingTimes;
339template<
typename ValueType>
347 if (env.solver().getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological) {
350 env.solver().topological().isUnderlyingEquationSolverTypeSetFromDefault());
354 "Sound computations are not properly implemented for this computation. You might get incorrect results.");
362 std::unordered_map<uint64_t, uint64_t> toLocalIndexMap;
364 uint64_t localIndex = 0;
365 for (
auto const& globalIndex : bscc) {
366 bsccStates.
set(globalIndex,
true);
367 toLocalIndexMap[globalIndex] = localIndex;
372 auto auxMatrix = this->_transitionMatrix.getSubmatrix(
false, bsccStates, bsccStates,
true);
374 for (
auto const& globalIndex : bscc) {
375 ValueType rateAtState = this->_exitRates ? (*this->_exitRates)[globalIndex] : storm::utility::one<ValueType>();
376 for (
auto& entry : auxMatrix.getRow(row)) {
377 if (entry.getColumn() == row) {
379 entry.setValue(rateAtState * (entry.getValue() - storm::utility::one<ValueType>()));
380 }
else if (this->isContinuousTime()) {
381 entry.setValue(entry.getValue() * rateAtState);
386 assert(row == auxMatrix.getRowCount());
389 auxMatrix = auxMatrix.transpose();
394 if (isFixpointFormat) {
396 for (row = 0; row < auxMatrix.getRowCount(); ++row) {
397 for (
auto& entry : auxMatrix.getRow(row)) {
398 if (entry.getColumn() == row) {
399 entry.setValue(storm::utility::one<ValueType>() + entry.getValue());
409 uint64_t lastRow = auxMatrix.getRowCount() - 1;
410 for (
auto& entry : auxMatrix.getRow(lastRow)) {
411 entry.setColumn(col);
412 if (isFixpointFormat) {
413 if (col == lastRow) {
414 entry.setValue(storm::utility::zero<ValueType>());
416 entry.setValue(-storm::utility::one<ValueType>());
419 entry.setValue(storm::utility::one<ValueType>());
424 for (; col <= lastRow; ++col) {
425 if (isFixpointFormat) {
426 if (col != lastRow) {
427 builder.
addNextValue(lastRow, col, -storm::utility::one<ValueType>());
430 builder.
addNextValue(lastRow, col, storm::utility::one<ValueType>());
434 std::vector<ValueType> bsccEquationSystemRightSide(bscc.
size(), storm::utility::zero<ValueType>());
435 bsccEquationSystemRightSide.back() = storm::utility::one<ValueType>();
438 auto solver = linearEquationSolverFactory.
create(env, builder.
build());
439 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
441 auto requirements = solver->getRequirements(env);
442 requirements.clearLowerBounds();
443 requirements.clearUpperBounds();
444 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
445 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
447 std::vector<ValueType> steadyStateDistr(bscc.
size(), storm::utility::one<ValueType>() / storm::utility::convertNumber<ValueType, uint64_t>(bscc.
size()));
448 solver->solveEquations(env, steadyStateDistr, bsccEquationSystemRightSide);
452 if (!env.solver().isForceExact()) {
453 ValueType sum = std::accumulate(steadyStateDistr.begin(), steadyStateDistr.end(), storm::utility::zero<ValueType>());
454 storm::utility::vector::scaleVectorInPlace<ValueType, ValueType>(steadyStateDistr, storm::utility::one<ValueType>() / sum);
457 return steadyStateDistr;
460template<
typename ValueType>
465 auto steadyStateDistr = computeSteadyStateDistrForBscc(env, bscc);
468 ValueType result = storm::utility::zero<ValueType>();
469 auto solIt = steadyStateDistr.begin();
470 for (
auto const& globalState : bscc) {
471 if (this->isContinuousTime()) {
472 result += (*solIt) * (stateValuesGetter(globalState) + (*this->_exitRates)[globalState] * actionValuesGetter(globalState));
474 result += (*solIt) * (stateValuesGetter(globalState) + actionValuesGetter(globalState));
478 assert(solIt == steadyStateDistr.end());
480 return std::pair<ValueType, std::vector<ValueType>>(std::move(result), std::move(steadyStateDistr));
483template<
typename ValueType>
485 std::vector<ValueType>
const& bsccLraValues, std::vector<uint64_t>
const& inputStateToBsccIndexMap,
storm::storage::BitVector const& statesNotInComponent,
486 bool asEquationSystem) {
491 auto sspMatrix = this->_transitionMatrix.getSubmatrix(
false, statesNotInComponent, statesNotInComponent, asEquationSystem);
492 if (asEquationSystem) {
493 sspMatrix.convertToEquationSystem();
497 std::vector<ValueType> rhs;
498 rhs.reserve(sspMatrix.getRowCount());
499 for (
auto state : statesNotInComponent) {
500 ValueType stateValue = storm::utility::zero<ValueType>();
501 for (
auto const& transition : this->_transitionMatrix.getRow(state)) {
502 if (!statesNotInComponent.
get(transition.getColumn())) {
504 stateValue += transition.getValue() * bsccLraValues[inputStateToBsccIndexMap[transition.getColumn()]];
507 rhs.push_back(std::move(stateValue));
510 return std::make_pair(std::move(sspMatrix), std::move(rhs));
513template<
typename ValueType>
515 std::vector<ValueType>
const& componentLraValues) {
516 STORM_LOG_ASSERT(this->_longRunComponentDecomposition !=
nullptr,
"Decomposition not computed, yet.");
526 std::vector<uint64_t> stateIndexMap(this->_transitionMatrix.getRowGroupCount(), std::numeric_limits<uint64_t>::max());
527 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
528 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
530 statesInComponents.
set(state);
531 stateIndexMap[state] = currentComponentIndex;
535 uint64_t numberOfNonComponentStates = 0;
537 for (
auto nonComponentState : statesNotInComponent) {
538 stateIndexMap[nonComponentState] = numberOfNonComponentStates;
539 ++numberOfNonComponentStates;
543 std::vector<ValueType> sspValues;
544 if (numberOfNonComponentStates > 0) {
547 auto sspMatrixVector = buildSspMatrixVector(componentLraValues, stateIndexMap, statesNotInComponent, isEqSysFormat);
548 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver = linearEquationSolverFactory.
create(env, sspMatrixVector.first);
549 auto lowerUpperBounds = std::minmax_element(componentLraValues.begin(), componentLraValues.end());
550 solver->setBounds(*lowerUpperBounds.first, *lowerUpperBounds.second);
552 auto requirements = solver->getRequirements(env);
553 requirements.clearUpperBounds();
554 requirements.clearLowerBounds();
555 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
556 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
557 sspValues.assign(sspMatrixVector.first.getRowCount(),
558 (*lowerUpperBounds.first + *lowerUpperBounds.second) / storm::utility::convertNumber<ValueType, uint64_t>(2));
559 solver->solveEquations(env, sspValues, sspMatrixVector.second);
563 std::vector<ValueType> result(this->_transitionMatrix.getRowGroupCount());
564 for (uint64_t state = 0; state < stateIndexMap.size(); ++state) {
565 if (statesNotInComponent.
get(state)) {
566 result[state] = sspValues[stateIndexMap[state]];
568 result[state] = componentLraValues[stateIndexMap[state]];
574template<
typename ValueType>
576 createDecomposition();
577 STORM_LOG_THROW(this->_longRunComponentDecomposition->size() <= 1, storm::exceptions::InvalidOperationException,
"");
578 return computeLongRunAverageStateDistribution(env, [](uint64_t) {
return storm::utility::zero<ValueType>(); });
581template<
typename ValueType>
583 uint64_t
const& initialState) {
585 "Invlid initial state index: " << initialState <<
". Have only " << this->_transitionMatrix.getRowGroupCount() <<
" states.");
586 return computeLongRunAverageStateDistribution(env, [&initialState](uint64_t stateIndex) {
587 return initialState == stateIndex ? storm::utility::one<ValueType>() : storm::utility::zero<ValueType>();
591template<
typename ValueType>
594 createDecomposition();
601 if (prec.first.is_initialized()) {
602 auto requiredPrecision = *prec.first;
607 storm::RationalNumber eps = storm::utility::sqrt<RationalNumber>(storm::utility::one<storm::RationalNumber>() + requiredPrecision) -
608 storm::utility::one<storm::RationalNumber>();
610 STORM_LOG_INFO(
"Precision for BSCC reachability and BSCC steady state distribution analysis set to " << storm::utility::convertNumber<double>(eps)
615 auto bsccReachProbs = computeBsccReachabilityProbabilities(subEnv, initialDistributionGetter);
617 std::vector<ValueType> steadyStateDistr(this->_transitionMatrix.getRowGroupCount(), storm::utility::zero<ValueType>());
618 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
619 auto const& component = (*this->_longRunComponentDecomposition)[currentComponentIndex];
621 auto bsccDistr = this->computeSteadyStateDistrForBscc(subEnv, component);
623 auto const& scalingFactor = bsccReachProbs[currentComponentIndex];
628 auto bsccDistrIt = bsccDistr.begin();
629 for (
auto const& element : component) {
631 steadyStateDistr[state] = *bsccDistrIt;
634 STORM_LOG_ASSERT(bsccDistrIt == bsccDistr.end(),
"Unexpected number of entries in bscc distribution");
636 return steadyStateDistr;
639template<
typename ValueType>
641 std::vector<ValueType>
const& toBsccProbabilities) {
647 std::vector<storm::RationalFunction>
const& ) {
649 "Computing upper bounds for expected visiting times over rational functions is not supported.");
652template<
typename ValueType>
655 STORM_LOG_ASSERT(this->_longRunComponentDecomposition !=
nullptr,
"Decomposition not computed, yet.");
658 std::vector<ValueType> bsccReachProbs;
659 if (
auto numBSCCs = this->_longRunComponentDecomposition->size(); numBSCCs <= 1) {
660 STORM_LOG_ASSERT(numBSCCs == 1,
"Found 0 BSCCs in a Markov chain. This should not be possible.");
661 bsccReachProbs = std::vector<ValueType>({storm::utility::one<ValueType>()});
664 bsccReachProbs = computeBsccReachabilityProbabilitiesClassic(env, initialDistributionGetter);
666 bsccReachProbs = computeBsccReachabilityProbabilitiesEVTs(env, initialDistributionGetter);
673 ValueType sum = std::accumulate(bsccReachProbs.begin(), bsccReachProbs.end(), storm::utility::zero<ValueType>());
674 storm::utility::vector::scaleVectorInPlace<ValueType, ValueType>(bsccReachProbs, storm::utility::one<ValueType>() / sum);
676 return bsccReachProbs;
679template<
typename ValueType>
686 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
687 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
691 bool const hasNonBsccStates = !nonBsccStates.
empty();
694 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver;
695 if (hasNonBsccStates) {
697 bool isEquationSystemFormat =
699 auto subMatrix = this->_transitionMatrix.getSubmatrix(
false, nonBsccStates, nonBsccStates, isEquationSystemFormat);
700 if (isEquationSystemFormat) {
701 subMatrix.convertToEquationSystem();
703 solver = linearEquationSolverFactory.
create(env, std::move(subMatrix));
704 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
706 auto requirements = solver->getRequirements(env);
707 requirements.clearLowerBounds();
708 requirements.clearUpperBounds();
709 STORM_LOG_THROW(!requirements.hasEnabledCriticalRequirement(), storm::exceptions::UnmetRequirementException,
710 "Solver requirements " + requirements.getEnabledRequirementsAsString() +
" not checked.");
711 solver->setCachingEnabled(
true);
715 std::vector<ValueType> bsccReachProbs(this->_longRunComponentDecomposition->size(), storm::utility::zero<ValueType>());
716 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
717 auto const& bscc = (*this->_longRunComponentDecomposition)[currentComponentIndex];
718 auto& bsccVal = bsccReachProbs[currentComponentIndex];
720 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
722 bsccVal += initialDistributionGetter(state);
725 if (hasNonBsccStates) {
727 bsccAsBitVector.
set(bscc.begin(), bscc.end(),
true);
729 std::vector<ValueType> eqSysRhs;
731 for (
auto state : nonBsccStates) {
732 eqSysRhs.push_back(this->_transitionMatrix.getConstrainedRowSum(state, bsccAsBitVector));
734 std::vector<ValueType> eqSysSolution(eqSysRhs.size());
735 solver->solveEquations(env, eqSysSolution, eqSysRhs);
737 uint64_t subsysState = 0;
738 for (
auto globalState : nonBsccStates) {
739 bsccVal += initialDistributionGetter(globalState) * eqSysSolution[subsysState];
744 return bsccReachProbs;
747template<
typename ValueType>
755 this->createBackwardTransitions();
756 visittimesHelper.provideBackwardTransitions(*this->_backwardTransitions);
757 auto expVisitTimes = visittimesHelper.computeExpectedVisitingTimes(env, initialDistributionGetter);
760 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
761 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
765 std::vector<ValueType> bsccReachProbs(this->_longRunComponentDecomposition->size(), storm::utility::zero<ValueType>());
766 for (uint64_t currentComponentIndex = 0; currentComponentIndex < this->_longRunComponentDecomposition->size(); ++currentComponentIndex) {
767 auto& bsccVal = bsccReachProbs[currentComponentIndex];
768 for (
auto const& element : (*this->_longRunComponentDecomposition)[currentComponentIndex]) {
770 bsccVal += initialDistributionGetter(state);
771 for (
auto const& pred : this->_backwardTransitions->getRow(state)) {
772 if (nonBsccStates.
get(pred.getColumn())) {
773 bsccVal += pred.getValue() * expVisitTimes[pred.getColumn()];
778 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...
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.
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.
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.
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),...