32template<
typename ValueType>
35 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>>
solver;
44 solver->setHasUniqueSolution(
true);
45 solver->setHasNoEndComponents(
true);
48 solver->setCachingEnabled(
true);
49 solver->setRequirementsChecked(
true);
50 auto req =
solver->getRequirements(env, dir);
52 req.clearUniqueSolution();
56 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
57 "The solver requirement " << req.getEnabledRequirementsAsString() <<
" has not been checked.");
62template<
typename ValueType>
67 : transitionMatrix(transitionMatrix), exitRateVector(exitRateVector), markovianStates(markovianStates) {
73 std::optional<ValueType>
const& upperTimeBound,
74 boost::optional<storm::storage::BitVector>
const& relevantStates = boost::none) {
85 if (markovianMaybeStates.
empty() || !upperTimeBound) {
87 psiStates,
false,
false)
91 boost::optional<storm::storage::BitVector> relevantMaybeStates;
94 if (!relevantStates->isSubsetOf(markovianStates)) {
96 auto const enhancedRelevantStates =
98 relevantMaybeStates = enhancedRelevantStates % maybeStates;
100 relevantMaybeStates = relevantStates.get() % maybeStates;
102 relevantMarkovianMaybeStates = relevantMaybeStates.
get() & markovianStatesModMaybeStates;
104 relevantMarkovianMaybeStates = markovianStatesModMaybeStates;
107 std::vector<ValueType> bestKnownSolution;
108 if (relevantMaybeStates) {
109 bestKnownSolution.resize(relevantMaybeStates->getNumberOfSetBits());
123 ValueType lambda = *std::max_element(markovianExitRates.begin(), markovianExitRates.end());
128 std::vector<std::pair<uint64_t, ValueType>> markovianToPsiProbabilities = getSparseOneStepProbabilities(markovianMaybeStates, psiStates);
129 for (
auto& entry : markovianToPsiProbabilities) {
130 entry.second *= markovianExitRates[entry.first] / lambda;
134 getUniformizedMarkovianTransitions(markovianExitRates, lambda, maybeStates, markovianMaybeStates);
137 transitionMatrix.
getSubmatrix(
true, probabilisticMaybeStates, probabilisticMaybeStates,
false);
140 transitionMatrix.
getSubmatrix(
true, probabilisticMaybeStates, markovianMaybeStates,
false);
142 std::vector<std::pair<uint64_t, ValueType>> probabilisticToPsiProbabilities = getSparseOneStepProbabilities(probabilisticMaybeStates, psiStates);
153 std::vector<ValueType> nextMarkovianStateValues = std::move(
155 std::vector<ValueType> nextProbabilisticStateValues(probabilisticToProbabilisticTransitions.
getRowGroupCount());
156 std::vector<ValueType> eqSysRhs(probabilisticToProbabilisticTransitions.
getRowCount());
160 uint64_t iteration = 0;
162 bool converged =
false;
163 bool abortedInnerIterations =
false;
169 auto foxGlynnResult =
180 for (
bool computeLowerBound : {
false,
true}) {
181 auto& maybeStatesValues = computeLowerBound ? maybeStatesValuesLower : maybeStatesValuesWeightedUpper;
184 std::string(computeLowerBound ?
"lower" :
"upper") +
" bounds.");
187 bool firstIteration =
true;
190 for (--k; k >= 0; --k) {
192 if (computeLowerBound) {
194 if (
static_cast<uint64_t
>(k) > foxGlynnResult.right) {
199 uint64_t i = N - 1 - k;
200 if (i > foxGlynnResult.right) {
208 if (firstIteration) {
209 firstIteration =
false;
216 markovianToMaybeMultiplier->multiply(env, maybeStatesValues,
nullptr, nextMarkovianStateValues);
217 for (
auto const& oneStepProb : markovianToPsiProbabilities) {
218 nextMarkovianStateValues[oneStepProb.first] += oneStepProb.second * targetValue;
224 if (computeLowerBound &&
static_cast<uint64_t
>(k) >= foxGlynnResult.left) {
226 "K exceeds left bound.");
227 targetValue += foxGlynnResult.weights[k - foxGlynnResult.left];
231 probabilisticToMarkovianMultiplier->multiply(env, nextMarkovianStateValues,
nullptr, eqSysRhs);
232 for (
auto const& oneStepProb : probabilisticToPsiProbabilities) {
233 eqSysRhs[oneStepProb.first] += oneStepProb.second * targetValue;
236 solver->solveEquations(solverEnv, dir, nextProbabilisticStateValues, eqSysRhs);
246 if (!computeLowerBound) {
248 uint64_t i = N - 1 - k;
249 if (i >= foxGlynnResult.left) {
251 ValueType
const& weight = foxGlynnResult.weights[i - foxGlynnResult.left];
258 abortedInnerIterations =
true;
263 if (computeLowerBound) {
274 converged = checkConvergence(maybeStatesValuesLower, maybeStatesValuesUpper, relevantMarkovianMaybeStates, epsilon, relativePrecision, kappa);
280 if (relevantMaybeStates) {
281 auto currentSolIt = bestKnownSolution.begin();
282 for (uint64_t state : relevantMaybeStates.get()) {
284 *currentSolIt = (maybeStatesValuesLower[state] + maybeStatesValuesUpper[state]) / two;
294 ValueType oldLambda = lambda;
298 if (relativePrecision) {
301 if (relevantMaybeStates) {
304 minValue = *std::min_element(maybeStatesValuesUpper.begin(), maybeStatesValuesUpper.end());
307 kappa = std::min(kappa, minValue);
312 uniformize(markovianToMaybeTransitions, markovianToPsiProbabilities, oldLambda, lambda, markovianStatesModMaybeStates);
319 STORM_LOG_WARN(
"Aborted unif+ in iteration " << iteration <<
".");
329 if (abortedInnerIterations && iteration > 1 && relevantMaybeStates && relevantStates) {
335 "Unexpected number of Markovian maybe states.");
336 auto subStateIt = markovianStatesModMaybeStates.
begin();
337 for (uint64_t markovianState : markovianMaybeStates) {
338 result[markovianState] = (maybeStatesValuesLower[*subStateIt] + maybeStatesValuesUpper[*subStateIt]) / two;
343 uint64_t probSubState = 0;
344 for (uint64_t probabilisticState : probabilisticMaybeStates) {
345 for (
auto const probStateRow : transitionMatrix.getRowGroupIndices(probabilisticState)) {
346 eqSysRhs[probSubState] = transitionMatrix.multiplyRowWithVector(probStateRow, result);
351 solver->solveEquations(solverEnv, dir, nextProbabilisticStateValues, eqSysRhs);
362 bool checkConvergence(std::vector<ValueType>
const& lower, std::vector<ValueType>
const& upper,
storm::storage::BitVector const& relevantValues,
363 ValueType
const& epsilon,
bool relative, ValueType& kappa) {
368 ValueType truncationError = epsilon * kappa;
369 for (uint64_t
const i : relevantValues) {
370 if (lower[i] == upper[i]) {
373 if (lower[i] <= truncationError) {
376 ValueType absDiff = upper[i] - lower[i] + truncationError;
377 ValueType relDiff = absDiff / lower[i];
378 if (relDiff > epsilon) {
386 storm::storage::SparseMatrix<ValueType> getUniformizedMarkovianTransitions(std::vector<ValueType>
const& oldRates, ValueType uniformizationRate,
387 storm::storage::BitVector
const& maybeStates,
388 storm::storage::BitVector
const& markovianMaybeStates) {
393 auto submatrix = transitionMatrix.getSubmatrix(
true, markovianMaybeStates, maybeStates);
394 STORM_LOG_ASSERT(submatrix.getRowCount() == submatrix.getRowGroupCount(),
"Submatrix row count != row group count.");
397 storm::storage::SparseMatrixBuilder<ValueType> builder(submatrix.getRowCount(), submatrix.getColumnCount());
398 auto markovianStateColumns = markovianMaybeStates % maybeStates;
400 for (uint64_t selfloopColumn : markovianStateColumns) {
401 ValueType const& oldExitRate = oldRates[row];
402 bool foundSelfoop =
false;
403 for (
auto const& entry : submatrix.getRow(row)) {
404 if (entry.getColumn() == selfloopColumn) {
406 ValueType newSelfLoop = uniformizationRate - oldExitRate + entry.getValue() * oldExitRate;
407 builder.addNextValue(row, entry.getColumn(), newSelfLoop / uniformizationRate);
409 builder.addNextValue(row, entry.getColumn(), entry.getValue() * oldExitRate / uniformizationRate);
413 ValueType newSelfLoop = uniformizationRate - oldExitRate;
414 builder.addNextValue(row, selfloopColumn, newSelfLoop / uniformizationRate);
418 STORM_LOG_ASSERT(row == submatrix.getRowCount(),
"Row count mismatch for submatrix.");
420 return builder.build();
423 void uniformize(storm::storage::SparseMatrix<ValueType>& matrix, std::vector<std::pair<uint64_t, ValueType>>& oneSteps,
424 std::vector<ValueType>
const& oldRates, ValueType uniformizationRate, storm::storage::BitVector
const& selfloopColumns) {
426 for (uint64_t selfloopColumn : selfloopColumns) {
427 ValueType const& oldExitRate = oldRates[row];
428 if (oldExitRate == uniformizationRate) {
433 for (
auto& v : matrix.
getRow(row)) {
434 if (v.getColumn() == selfloopColumn) {
435 ValueType newSelfLoop = uniformizationRate - oldExitRate + v.getValue() * oldExitRate;
436 v.setValue(newSelfLoop / uniformizationRate);
438 v.setValue(v.getValue() * oldExitRate / uniformizationRate);
444 for (
auto& oneStep : oneSteps) {
445 oneStep.second *= oldRates[oneStep.first] / uniformizationRate;
451 void uniformize(storm::storage::SparseMatrix<ValueType>& matrix, std::vector<std::pair<uint64_t, ValueType>>& oneSteps, ValueType oldUniformizationRate,
452 ValueType newUniformizationRate, storm::storage::BitVector
const& selfloopColumns) {
453 if (oldUniformizationRate != newUniformizationRate) {
454 STORM_LOG_ASSERT(oldUniformizationRate < newUniformizationRate,
"Old uniformization rate must be less than new.");
455 ValueType rateDiff = newUniformizationRate - oldUniformizationRate;
456 ValueType rateFraction = oldUniformizationRate / newUniformizationRate;
458 for (uint64_t selfloopColumn : selfloopColumns) {
459 for (
auto& v : matrix.
getRow(row)) {
460 if (v.getColumn() == selfloopColumn) {
461 ValueType newSelfLoop = rateDiff + v.getValue() * oldUniformizationRate;
462 v.setValue(newSelfLoop / newUniformizationRate);
464 v.setValue(v.getValue() * rateFraction);
470 for (
auto& oneStep : oneSteps) {
471 oneStep.second *= rateFraction;
476 storm::storage::BitVector getProb0States(
OptimizationDirection dir, storm::storage::BitVector
const& phiStates,
477 storm::storage::BitVector
const& psiStates)
const {
478 if (dir == storm::solver::OptimizationDirection::Maximize) {
491 std::vector<std::pair<uint64_t, ValueType>> getSparseOneStepProbabilities(storm::storage::BitVector
const& sourceStateConstraint,
492 storm::storage::BitVector
const& targetStateConstraint)
const {
493 auto denseResult = transitionMatrix.getConstrainedRowGroupSumVector(sourceStateConstraint, targetStateConstraint);
494 std::vector<std::pair<uint64_t, ValueType>> sparseResult;
495 for (uint64_t i = 0;
i < denseResult.size(); ++
i) {
496 auto const& val = denseResult[
i];
498 sparseResult.emplace_back(i, val);
504 storm::storage::SparseMatrix<ValueType>
const& transitionMatrix;
505 std::vector<ValueType>
const& exitRateVector;
506 storm::storage::BitVector
const& markovianStates;
509template<
typename ValueType>
514 std::vector<ValueType>& probabilisticNonGoalValues, ValueType delta, uint64_t numberOfSteps) {
522 bool existProbabilisticStates = !probabilisticNonGoalStates.
empty();
526 if (existProbabilisticStates) {
527 aMarkovianToProbabilistic = transitionMatrix.
getSubmatrix(
true, markovianNonGoalStates, probabilisticNonGoalStates);
528 aProbabilistic = transitionMatrix.
getSubmatrix(
true, probabilisticNonGoalStates, probabilisticNonGoalStates);
529 aProbabilisticToMarkovian = transitionMatrix.
getSubmatrix(
true, probabilisticNonGoalStates, markovianNonGoalStates);
534 uint64_t rowIndex = 0;
535 for (uint64_t state : markovianNonGoalStates) {
536 for (
auto& element : aMarkovian.
getRow(rowIndex)) {
537 ValueType eTerm = std::exp(-exitRates[state] * delta);
538 if (element.getColumn() == rowIndex) {
548 if (existProbabilisticStates) {
550 for (uint64_t state : markovianNonGoalStates) {
551 for (
auto& element : aMarkovianToProbabilistic.
getRow(rowIndex)) {
552 element.setValue((1 - std::exp(-exitRates[state] * delta)) * element.getValue());
559 std::vector<ValueType> bProbabilistic(existProbabilisticStates ? aProbabilistic.
getRowCount() : 0);
563 std::vector<ValueType> bProbabilisticFixed;
564 if (existProbabilisticStates) {
567 std::vector<ValueType> bMarkovianFixed;
569 for (uint64_t state : markovianNonGoalStates) {
572 for (
auto& element : transitionMatrix.
getRowGroup(state)) {
573 if (goalStates.
get(element.getColumn())) {
574 bMarkovianFixed.back() += (1 - std::exp(-exitRates[state] * delta)) * element.getValue();
580 auto solverEnv = env;
590 std::vector<ValueType> markovianNonGoalValuesSwap(markovianNonGoalValues);
591 for (uint64_t currentStep = 0; currentStep < numberOfSteps; ++currentStep) {
592 if (existProbabilisticStates) {
599 solver->solveEquations(solverEnv, dir, probabilisticNonGoalValues, bProbabilistic);
610 std::swap(markovianNonGoalValues, markovianNonGoalValuesSwap);
611 if (existProbabilisticStates) {
621 if (existProbabilisticStates) {
626 solver->solveEquations(solverEnv, dir, probabilisticNonGoalValues, bProbabilistic);
633template<
typename ValueType>
638 std::pair<
double, std::optional<double>>
const& boundsPair) {
639 STORM_LOG_TRACE(
"Using IMCA's technique to compute bounded until probabilities.");
644 STORM_LOG_THROW(boundsPair.second.has_value(), storm::exceptions::NotSupportedException,
645 "IMCA's technique requires an upper time bound, but the given property has none.");
646 double lowerBound = boundsPair.first;
647 double upperBound = *boundsPair.second;
650 ValueType maxExitRate = 0;
651 for (
auto value : exitRateVector) {
652 maxExitRate = std::max(maxExitRate, value);
657 uint64_t numberOfSteps =
static_cast<uint64_t
>(std::ceil((upperBound - lowerBound) / delta));
658 STORM_LOG_INFO(
"Performing " << numberOfSteps <<
" iterations (delta=" << delta <<
") for interval [" << lowerBound <<
", " << upperBound <<
"].\n");
665 std::vector<ValueType> vProbabilistic(probabilisticNonGoalStates.
getNumberOfSetBits());
669 vMarkovian, vProbabilistic, delta, numberOfSteps);
673 std::vector<ValueType> vAllProbabilistic((~markovianStates).getNumberOfSetBits());
683 numberOfSteps =
static_cast<uint64_t
>(std::ceil(lowerBound / delta));
684 STORM_LOG_INFO(
"Performing " << numberOfSteps <<
" iterations (delta=" << delta <<
") for interval [0, " << lowerBound <<
"].\n");
688 ~markovianStates, vAllMarkovian, vAllProbabilistic, delta, numberOfSteps);
698 std::vector<ValueType> result(numberOfStates);
706template<typename ValueType, typename std::enable_if<storm::NumberTraits<ValueType>::SupportsExponential,
int>::type>
712 "Exact computations not possible for bounded until probabilities.");
716 if (method == storm::solver::MaBoundedReachabilityMethod::Imca) {
717 if (!phiStates.
full()) {
718 STORM_LOG_WARN(
"Using Unif+ method because IMCA method does not support (phi Until psi) for non-trivial phi");
719 method = storm::solver::MaBoundedReachabilityMethod::UnifPlus;
722 STORM_LOG_ASSERT(method == storm::solver::MaBoundedReachabilityMethod::UnifPlus,
"Unknown solution method.");
724 STORM_LOG_WARN(
"Using IMCA method because Unif+ does not support a lower bound > 0.");
725 method = storm::solver::MaBoundedReachabilityMethod::Imca;
729 if (method == storm::solver::MaBoundedReachabilityMethod::Imca) {
733 boost::optional<storm::storage::BitVector> relevantValues;
734 if (goal.hasRelevantValues()) {
735 relevantValues = std::move(goal.relevantValues());
737 return helper.computeBoundedUntilProbabilities(env, goal.direction(), phiStates, psiStates, boundsPair.second, relevantValues);
741template<typename ValueType, typename std::enable_if<!storm::NumberTraits<ValueType>::SupportsExponential,
int>::type>
746 std::pair<
double, std::optional<double>>
const&) {
747 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded until probabilities is unsupported for this value type.");
750template<
typename ValueType>
754 bool qualitative,
bool produceScheduler) {
756 psiStates, qualitative, produceScheduler);
759template<
typename ValueType,
typename RewardModelType>
766 for (uint64_t markovianState : markovianStates) {
769 std::vector<ValueType> totalRewardVector = rewardModel.getTotalActionRewardVector(transitionMatrix, stateRewardWeights);
770 RewardModelType scaledRewardModel(std::nullopt, std::move(totalRewardVector));
775template<
typename ValueType,
typename RewardModelType>
782 for (uint64_t markovianState : markovianStates) {
785 std::vector<ValueType> totalRewardVector = rewardModel.getTotalActionRewardVector(transitionMatrix, stateRewardWeights);
786 RewardModelType scaledRewardModel(std::nullopt, std::move(totalRewardVector));
792template<
typename ValueType>
799 for (uint64_t markovianState : markovianStates) {
816 bool qualitative,
bool produceScheduler);
854 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 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, std::optional< double > > const &boundsPair)
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 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, std::optional< 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, SolutionType > > 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.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
size_t size() const
Retrieves the number of bits this bit vector can store.
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 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 logs it (on the progress log channel) if the delay pass...
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, std::optional< double > > const &boundsPair)
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...
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)
TargetType convertNumber(SourceType const &number)
solver::OptimizationDirection OptimizationDirection