28namespace modelchecker {
31template<
typename ValueType>
34 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver;
42 solver = factory.
create(env, transitions);
43 solver->setHasUniqueSolution(
true);
44 solver->setHasNoEndComponents(
true);
45 solver->setLowerBound(storm::utility::zero<ValueType>());
46 solver->setUpperBound(storm::utility::one<ValueType>());
47 solver->setCachingEnabled(
true);
48 solver->setRequirementsChecked(
true);
49 auto req = solver->getRequirements(env, dir);
51 req.clearUniqueSolution();
55 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
56 "The solver requirement " << req.getEnabledRequirementsAsString() <<
" has not been checked.");
61template<
typename ValueType>
66 : transitionMatrix(transitionMatrix), exitRateVector(exitRateVector), markovianStates(markovianStates) {
72 ValueType
const& upperTimeBound,
73 boost::optional<storm::storage::BitVector>
const& relevantStates = boost::none) {
85 return SparseMarkovAutomatonCslHelper::computeUntilProbabilities<ValueType>(env, dir, transitionMatrix, transitionMatrix.transpose(
true), phiStates,
86 psiStates,
false,
false)
90 boost::optional<storm::storage::BitVector> relevantMaybeStates;
92 relevantMaybeStates = relevantStates.
get() % maybeStates;
95 std::vector<ValueType> bestKnownSolution;
96 if (relevantMaybeStates) {
97 bestKnownSolution.
resize(relevantStates->size());
104 auto two = storm::utility::convertNumber<ValueType>(2.0);
111 ValueType lambda = *std::max_element(markovianExitRates.begin(), markovianExitRates.end());
116 std::vector<std::pair<uint64_t, ValueType>> markovianToPsiProbabilities = getSparseOneStepProbabilities(markovianMaybeStates, psiStates);
117 for (
auto& entry : markovianToPsiProbabilities) {
118 entry.second *= markovianExitRates[entry.first] / lambda;
122 getUniformizedMarkovianTransitions(markovianExitRates, lambda, maybeStates, markovianMaybeStates);
125 transitionMatrix.getSubmatrix(
true, probabilisticMaybeStates, probabilisticMaybeStates,
false);
128 transitionMatrix.getSubmatrix(
true, probabilisticMaybeStates, markovianMaybeStates,
false);
130 std::vector<std::pair<uint64_t, ValueType>> probabilisticToPsiProbabilities = getSparseOneStepProbabilities(probabilisticMaybeStates, psiStates);
138 std::vector<ValueType> maybeStatesValuesLower(maybeStates.
getNumberOfSetBits(), storm::utility::zero<ValueType>());
139 std::vector<ValueType> maybeStatesValuesWeightedUpper(maybeStates.
getNumberOfSetBits(), storm::utility::zero<ValueType>());
140 std::vector<ValueType> maybeStatesValuesUpper(maybeStates.
getNumberOfSetBits(), storm::utility::zero<ValueType>());
141 std::vector<ValueType> nextMarkovianStateValues = std::move(
143 std::vector<ValueType> nextProbabilisticStateValues(probabilisticToProbabilisticTransitions.
getRowGroupCount());
144 std::vector<ValueType> eqSysRhs(probabilisticToProbabilisticTransitions.
getRowCount());
148 uint64_t iteration = 0;
150 bool converged =
false;
151 bool abortedInnerIterations =
false;
167 for (
bool computeLowerBound : {
false,
true}) {
168 auto& maybeStatesValues = computeLowerBound ? maybeStatesValuesLower : maybeStatesValuesWeightedUpper;
169 ValueType targetValue = computeLowerBound ? storm::utility::zero<ValueType>() : storm::utility::one<ValueType>();
171 std::string(computeLowerBound ?
"lower" :
"upper") +
" bounds.");
174 bool firstIteration =
true;
177 for (--k; k >= 0; --k) {
179 if (computeLowerBound) {
181 if (
static_cast<uint64_t
>(k) > foxGlynnResult.right) {
186 uint64_t i = N - 1 - k;
187 if (i > foxGlynnResult.right) {
195 if (firstIteration) {
196 firstIteration =
false;
200 std::fill(nextMarkovianStateValues.begin(), nextMarkovianStateValues.end(), storm::utility::zero<ValueType>());
203 markovianToMaybeMultiplier->multiply(env, maybeStatesValues,
nullptr, nextMarkovianStateValues);
204 for (
auto const& oneStepProb : markovianToPsiProbabilities) {
205 nextMarkovianStateValues[oneStepProb.first] += oneStepProb.second * targetValue;
211 if (computeLowerBound &&
static_cast<uint64_t
>(k) >= foxGlynnResult.left) {
212 assert(
static_cast<uint64_t
>(k) <= foxGlynnResult.right);
213 targetValue += foxGlynnResult.weights[k - foxGlynnResult.left];
217 probabilisticToMarkovianMultiplier->multiply(env, nextMarkovianStateValues,
nullptr, eqSysRhs);
218 for (
auto const& oneStepProb : probabilisticToPsiProbabilities) {
219 eqSysRhs[oneStepProb.first] += oneStepProb.second * targetValue;
222 solver->solveEquations(solverEnv, dir, nextProbabilisticStateValues, eqSysRhs);
232 if (!computeLowerBound) {
234 uint64_t i = N - 1 - k;
235 if (i >= foxGlynnResult.left) {
236 assert(i <= foxGlynnResult.right);
237 ValueType
const& weight = foxGlynnResult.weights[i - foxGlynnResult.left];
244 abortedInnerIterations =
true;
249 if (computeLowerBound) {
260 converged = checkConvergence(maybeStatesValuesLower, maybeStatesValuesUpper, relevantMaybeStates, epsilon, relativePrecision, kappa);
266 if (relevantMaybeStates) {
267 auto currentSolIt = bestKnownSolution.begin();
268 for (
auto state : relevantMaybeStates.get()) {
270 *currentSolIt = (maybeStatesValuesLower[state] + maybeStatesValuesUpper[state]) / two;
280 ValueType oldLambda = lambda;
284 if (relativePrecision) {
287 if (relevantMaybeStates) {
290 minValue = *std::min_element(maybeStatesValuesUpper.begin(), maybeStatesValuesUpper.end());
293 kappa = std::min(kappa, minValue);
298 uniformize(markovianToMaybeTransitions, markovianToPsiProbabilities, oldLambda, lambda, markovianStatesModMaybeStates);
301 std::fill(maybeStatesValuesUpper.begin(), maybeStatesValuesUpper.end(), storm::utility::zero<ValueType>());
305 STORM_LOG_WARN(
"Aborted unif+ in iteration " << iteration <<
".");
311 std::vector<ValueType> result(transitionMatrix.getRowGroupCount(), storm::utility::zero<ValueType>());
314 if (abortedInnerIterations && iteration > 1 && relevantMaybeStates && relevantStates) {
319 storm::utility::vector::applyPointwise<ValueType, ValueType, ValueType>(
320 maybeStatesValuesLower, maybeStatesValuesUpper, maybeStatesValuesLower,
321 [&two](ValueType
const& a, ValueType
const& b) -> ValueType {
return (a + b) / two; });
329 bool checkConvergence(std::vector<ValueType>
const& lower, std::vector<ValueType>
const& upper,
330 boost::optional<storm::storage::BitVector>
const& relevantValues, ValueType
const& epsilon,
bool relative, ValueType& kappa) {
331 STORM_LOG_ASSERT(!relevantValues.is_initialized() || relevantValues->size() == lower.size(),
"Relevant values size mismatch.");
333 if (relevantValues) {
340 ValueType truncationError = epsilon * kappa;
341 for (uint64_t i = 0; i < lower.size(); ++i) {
342 if (relevantValues) {
343 i = relevantValues->getNextSetIndex(i);
344 if (i == lower.size()) {
348 if (lower[i] == upper[i]) {
351 if (lower[i] <= truncationError) {
354 ValueType absDiff = upper[
i] - lower[
i] + truncationError;
356 if (relDiff > epsilon) {
359 STORM_LOG_ASSERT(absDiff > storm::utility::zero<ValueType>(),
"Upper bound " << upper[i] <<
" is smaller than lower bound " << lower[i] <<
".");
371 auto submatrix = transitionMatrix.getSubmatrix(
true, markovianMaybeStates, maybeStates);
372 assert(submatrix.getRowCount() == submatrix.getRowGroupCount());
376 auto markovianStateColumns = markovianMaybeStates % maybeStates;
378 for (
auto selfloopColumn : markovianStateColumns) {
379 ValueType const& oldExitRate = oldRates[row];
380 bool foundSelfoop =
false;
381 for (
auto const& entry : submatrix.getRow(row)) {
382 if (entry.getColumn() == selfloopColumn) {
384 ValueType newSelfLoop = uniformizationRate - oldExitRate + entry.getValue() * oldExitRate;
385 builder.addNextValue(row, entry.getColumn(), newSelfLoop / uniformizationRate);
387 builder.addNextValue(row, entry.getColumn(), entry.getValue() * oldExitRate / uniformizationRate);
391 ValueType newSelfLoop = uniformizationRate - oldExitRate;
392 builder.addNextValue(row, selfloopColumn, newSelfLoop / uniformizationRate);
396 assert(row == submatrix.getRowCount());
398 return builder.build();
402 std::vector<ValueType>
const& oldRates, ValueType uniformizationRate,
storm::storage::BitVector const& selfloopColumns) {
404 for (
auto selfloopColumn : selfloopColumns) {
405 ValueType const& oldExitRate = oldRates[row];
406 if (oldExitRate == uniformizationRate) {
411 for (
auto& v : matrix.getRow(row)) {
412 if (v.getColumn() == selfloopColumn) {
413 ValueType newSelfLoop = uniformizationRate - oldExitRate + v.getValue() * oldExitRate;
414 v.setValue(newSelfLoop / uniformizationRate);
416 v.setValue(v.getValue() * oldExitRate / uniformizationRate);
422 for (
auto& oneStep : oneSteps) {
423 oneStep.second *= oldRates[oneStep.first] / uniformizationRate;
431 if (oldUniformizationRate != newUniformizationRate) {
432 assert(oldUniformizationRate < newUniformizationRate);
433 ValueType rateDiff = newUniformizationRate - oldUniformizationRate;
434 ValueType rateFraction = oldUniformizationRate / newUniformizationRate;
436 for (
auto selfloopColumn : selfloopColumns) {
437 for (
auto& v : matrix.getRow(row)) {
438 if (v.getColumn() == selfloopColumn) {
439 ValueType newSelfLoop = rateDiff + v.getValue() * oldUniformizationRate;
440 v.setValue(newSelfLoop / newUniformizationRate);
442 v.setValue(v.getValue() * rateFraction);
448 for (
auto& oneStep : oneSteps) {
449 oneStep.second *= rateFraction;
456 if (dir == storm::solver::OptimizationDirection::Maximize) {
469 std::vector<std::pair<uint64_t, ValueType>> getSparseOneStepProbabilities(
storm::storage::BitVector const& sourceStateConstraint,
471 auto denseResult = transitionMatrix.getConstrainedRowGroupSumVector(sourceStateConstraint, targetStateConstraint);
472 std::vector<std::pair<uint64_t, ValueType>> sparseResult;
473 for (uint64_t i = 0;
i < denseResult.size(); ++
i) {
474 auto const& val = denseResult[
i];
476 sparseResult.emplace_back(i, val);
483 std::vector<ValueType>
const& exitRateVector;
487template<
typename ValueType>
492 std::vector<ValueType>& probabilisticNonGoalValues, ValueType delta, uint64_t numberOfSteps) {
500 bool existProbabilisticStates = !probabilisticNonGoalStates.
empty();
504 if (existProbabilisticStates) {
505 aMarkovianToProbabilistic = transitionMatrix.
getSubmatrix(
true, markovianNonGoalStates, probabilisticNonGoalStates);
506 aProbabilistic = transitionMatrix.
getSubmatrix(
true, probabilisticNonGoalStates, probabilisticNonGoalStates);
507 aProbabilisticToMarkovian = transitionMatrix.
getSubmatrix(
true, probabilisticNonGoalStates, markovianNonGoalStates);
512 uint64_t rowIndex = 0;
513 for (
auto state : markovianNonGoalStates) {
514 for (
auto& element : aMarkovian.
getRow(rowIndex)) {
515 ValueType eTerm = std::exp(-exitRates[state] * delta);
516 if (element.getColumn() == rowIndex) {
517 element.setValue((storm::utility::one<ValueType>() - eTerm) * element.getValue() + eTerm);
519 element.setValue((storm::utility::one<ValueType>() - eTerm) * element.getValue());
526 if (existProbabilisticStates) {
528 for (
auto state : markovianNonGoalStates) {
529 for (
auto& element : aMarkovianToProbabilistic.
getRow(rowIndex)) {
530 element.setValue((1 - std::exp(-exitRates[state] * delta)) * element.getValue());
537 std::vector<ValueType> bProbabilistic(existProbabilisticStates ? aProbabilistic.
getRowCount() : 0);
541 std::vector<ValueType> bProbabilisticFixed;
542 if (existProbabilisticStates) {
545 std::vector<ValueType> bMarkovianFixed;
547 for (
auto state : markovianNonGoalStates) {
548 bMarkovianFixed.push_back(storm::utility::zero<ValueType>());
550 for (
auto& element : transitionMatrix.
getRowGroup(state)) {
551 if (goalStates.
get(element.getColumn())) {
552 bMarkovianFixed.back() += (1 - std::exp(-exitRates[state] * delta)) * element.getValue();
558 auto solverEnv = env;
568 std::vector<ValueType> markovianNonGoalValuesSwap(markovianNonGoalValues);
569 for (uint64_t currentStep = 0; currentStep < numberOfSteps; ++currentStep) {
570 if (existProbabilisticStates) {
577 solver->solveEquations(solverEnv, dir, probabilisticNonGoalValues, bProbabilistic);
588 std::swap(markovianNonGoalValues, markovianNonGoalValuesSwap);
589 if (existProbabilisticStates) {
599 if (existProbabilisticStates) {
604 solver->solveEquations(solverEnv, dir, probabilisticNonGoalValues, bProbabilistic);
611template<
typename ValueType>
616 STORM_LOG_TRACE(
"Using IMCA's technique to compute bounded until probabilities.");
621 double lowerBound = boundsPair.first;
622 double upperBound = boundsPair.second;
625 ValueType maxExitRate = 0;
626 for (
auto value : exitRateVector) {
627 maxExitRate = std::max(maxExitRate, value);
629 ValueType delta = (2.0 * storm::utility::convertNumber<ValueType>(env.
solver().
timeBounded().
getPrecision())) / (upperBound * maxExitRate * maxExitRate);
632 uint64_t numberOfSteps =
static_cast<uint64_t
>(std::ceil((upperBound - lowerBound) / delta));
633 STORM_LOG_INFO(
"Performing " << numberOfSteps <<
" iterations (delta=" << delta <<
") for interval [" << lowerBound <<
", " << upperBound <<
"].\n");
640 std::vector<ValueType> vProbabilistic(probabilisticNonGoalStates.
getNumberOfSetBits());
644 vMarkovian, vProbabilistic, delta, numberOfSteps);
647 if (lowerBound != storm::utility::zero<ValueType>()) {
648 std::vector<ValueType> vAllProbabilistic((~markovianStates).getNumberOfSetBits());
652 storm::utility::vector::setVectorValues<ValueType>(vAllProbabilistic, psiStates % ~markovianStates, storm::utility::one<ValueType>());
653 storm::utility::vector::setVectorValues<ValueType>(vAllProbabilistic, ~psiStates % ~markovianStates, vProbabilistic);
654 storm::utility::vector::setVectorValues<ValueType>(vAllMarkovian, psiStates % markovianStates, storm::utility::one<ValueType>());
655 storm::utility::vector::setVectorValues<ValueType>(vAllMarkovian, ~psiStates % markovianStates, vMarkovian);
658 numberOfSteps =
static_cast<uint64_t
>(std::ceil(lowerBound / delta));
659 STORM_LOG_INFO(
"Performing " << numberOfSteps <<
" iterations (delta=" << delta <<
") for interval [0, " << lowerBound <<
"].\n");
663 ~markovianStates, vAllMarkovian, vAllProbabilistic, delta, numberOfSteps);
666 std::vector<ValueType> result(numberOfStates, storm::utility::zero<ValueType>());
673 std::vector<ValueType> result(numberOfStates);
674 storm::utility::vector::setVectorValues<ValueType>(result, psiStates, storm::utility::one<ValueType>());
681template<typename ValueType, typename std::enable_if<storm::NumberTraits<ValueType>::SupportsExponential,
int>::type>
687 "Exact computations not possible for bounded until probabilities.");
691 if (method == storm::solver::MaBoundedReachabilityMethod::Imca) {
692 if (!phiStates.
full()) {
693 STORM_LOG_WARN(
"Using Unif+ method because IMCA method does not support (phi Until psi) for non-trivial phi");
694 method = storm::solver::MaBoundedReachabilityMethod::UnifPlus;
697 STORM_LOG_ASSERT(method == storm::solver::MaBoundedReachabilityMethod::UnifPlus,
"Unknown solution method.");
699 STORM_LOG_WARN(
"Using IMCA method because Unif+ does not support a lower bound > 0.");
700 method = storm::solver::MaBoundedReachabilityMethod::Imca;
704 if (method == storm::solver::MaBoundedReachabilityMethod::Imca) {
708 boost::optional<storm::storage::BitVector> relevantValues;
709 if (goal.hasRelevantValues()) {
710 relevantValues = std::move(goal.relevantValues());
716template<typename ValueType, typename std::enable_if<!storm::NumberTraits<ValueType>::SupportsExponential,
int>::type>
721 std::pair<double, double>
const&) {
722 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded until probabilities is unsupported for this value type.");
725template<
typename ValueType>
729 bool qualitative,
bool produceScheduler) {
731 psiStates, qualitative, produceScheduler);
734template<
typename ValueType,
typename RewardModelType>
740 std::vector<ValueType> stateRewardWeights(transitionMatrix.
getRowGroupCount(), storm::utility::zero<ValueType>());
741 for (
auto const markovianState : markovianStates) {
742 stateRewardWeights[markovianState] = storm::utility::one<ValueType>() / exitRateVector[markovianState];
744 std::vector<ValueType> totalRewardVector = rewardModel.getTotalActionRewardVector(transitionMatrix, stateRewardWeights);
745 RewardModelType scaledRewardModel(std::nullopt, std::move(totalRewardVector));
750template<
typename ValueType,
typename RewardModelType>
756 std::vector<ValueType> stateRewardWeights(transitionMatrix.
getRowGroupCount(), storm::utility::zero<ValueType>());
757 for (
auto const markovianState : markovianStates) {
758 stateRewardWeights[markovianState] = storm::utility::one<ValueType>() / exitRateVector[markovianState];
760 std::vector<ValueType> totalRewardVector = rewardModel.getTotalActionRewardVector(transitionMatrix, stateRewardWeights);
761 RewardModelType scaledRewardModel(std::nullopt, std::move(totalRewardVector));
767template<
typename ValueType>
773 std::vector<ValueType> rewardValues(transitionMatrix.
getRowCount(), storm::utility::zero<ValueType>());
774 for (
auto const markovianState : markovianStates) {
775 rewardValues[transitionMatrix.
getRowGroupIndices()[markovianState]] = storm::utility::one<ValueType>() / exitRateVector[markovianState];
791 bool qualitative,
bool produceScheduler);
829 bool produceScheduler);
SolverEnvironment & solver()
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
bool isForceExact() const
TimeBoundedSolverEnvironment & timeBounded()
void setForceExact(bool value)
bool const & getRelativeTerminationCriterion() const
storm::RationalNumber const & getPrecision() const
storm::RationalNumber const & getUnifPlusKappa() const
storm::solver::MaBoundedReachabilityMethod const & getMaMethod() const
static MDPSparseModelCheckingHelperReturnType< ValueType > computeTotalRewards(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, RewardModelType const &rewardModel, bool produceScheduler)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeReachabilityRewards(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, RewardModelType const &rewardModel, storm::storage::BitVector const &psiStates, bool produceScheduler)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeUntilProbabilities(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool qualitative, bool produceScheduler)
static MDPSparseModelCheckingHelperReturnType< ValueType > computeReachabilityTimes(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, storm::storage::BitVector const &psiStates, bool produceScheduler)
static std::vector< ValueType > computeBoundedUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, std::pair< double, double > const &boundsPair)
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeTotalRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeUntilProbabilities(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
static MDPSparseModelCheckingHelperReturnType< SolutionType > computeReachabilityRewards(Environment const &env, storm::solver::SolveGoal< ValueType, SolutionType > &&goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, RewardModelType const &rewardModel, storm::storage::BitVector const &targetStates, bool qualitative, bool produceScheduler, ModelCheckerHint const &hint=ModelCheckerHint())
std::vector< ValueType > computeBoundedUntilProbabilities(storm::Environment const &env, OptimizationDirection dir, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, ValueType const &upperTimeBound, boost::optional< storm::storage::BitVector > const &relevantStates=boost::none)
UnifPlusHelper(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates)
virtual std::unique_ptr< MinMaxLinearEquationSolver< ValueType, SolutionType > > create(Environment const &env) const override
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.
bool full() const
Retrieves whether all bits are set in this bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
void resize(uint_fast64_t newLength, bool init=false)
Resizes the bit vector to hold the given new number of bits.
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.
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.
void multiplyWithVector(std::vector< value_type > const &vector, std::vector< value_type > &result, std::vector< value_type > const *summand=nullptr) const
Multiplies the matrix with the given vector and writes the result to the given result vector.
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 ...
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.
std::vector< value_type > getConstrainedRowGroupSumVector(storm::storage::BitVector const &rowGroupConstraint, storm::storage::BitVector const &columnConstraint) const
Computes a vector whose entries represent the sums of selected columns for all rows in selected row g...
index_type getRowCount() const
Returns the number of rows of the matrix.
index_type getNonzeroEntryCount() const
Returns the cached number of nonzero entries in the matrix.
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.
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN(message)
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
SFTBDDChecker::ValueType ValueType
void computeBoundedReachabilityProbabilitiesImca(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &exitRates, storm::storage::BitVector const &goalStates, storm::storage::BitVector const &markovianNonGoalStates, storm::storage::BitVector const &probabilisticNonGoalStates, std::vector< ValueType > &markovianNonGoalValues, std::vector< ValueType > &probabilisticNonGoalValues, ValueType delta, uint64_t numberOfSteps)
std::unique_ptr< storm::solver::MinMaxLinearEquationSolver< ValueType > > setUpProbabilisticStatesSolver(storm::Environment &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitions)
std::vector< ValueType > computeBoundedUntilProbabilitiesImca(Environment const &env, OptimizationDirection dir, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, std::vector< ValueType > const &exitRateVector, storm::storage::BitVector const &markovianStates, storm::storage::BitVector const &psiStates, std::pair< double, double > const &boundsPair)
bool hasCycle(storm::storage::SparseMatrix< T > const &transitionMatrix, boost::optional< storm::storage::BitVector > const &subsystem)
Returns true if the graph represented by the given matrix has a cycle.
storm::storage::BitVector performProb0A(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
storm::storage::BitVector performProb0E(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 of satisfying phi until psi under at least one po...
FoxGlynnResult< ValueType > foxGlynn(ValueType lambda, ValueType epsilon)
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
VT min_if(std::vector< VT > const &values, storm::storage::BitVector const &filter)
Computes the minimum of the entries from the values that are selected by the (non-empty) filter.
void addVectors(std::vector< InValueType1 > const &firstOperand, std::vector< InValueType2 > const &secondOperand, std::vector< OutValueType > &target)
Adds the two given vectors and writes the result to the target vector.
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.
bool equalModuloPrecision(T const &val1, T const &val2, T const &precision, bool relativeError=true)
Compares the given elements and determines whether they are equal modulo the given precision.
void reduceVectorMinOrMax(storm::solver::OptimizationDirection dir, std::vector< T > const &source, std::vector< T > &target, std::vector< uint_fast64_t > const &rowGrouping, std::vector< uint_fast64_t > *choices=nullptr)
Reduces the given source vector by selecting either the smallest or the largest out of each row group...
void addScaledVector(std::vector< InValueType1 > &firstOperand, std::vector< InValueType2 > const &secondOperand, InValueType3 const &factor)
Computes x:= x + a*y, i.e., adds each element of the first vector and (the corresponding element of t...
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 hasNonZeroEntry(std::vector< T > const &v)
std::vector< Type > filterVector(std::vector< Type > const &in, storm::storage::BitVector const &filter)
bool isZero(ValueType const &a)
ValueType ceil(ValueType const &number)
ValueType log(ValueType const &number)
bool isInfinity(ValueType const &a)
solver::OptimizationDirection OptimizationDirection