21template<
typename ValueType,
typename SolutionType>
28 return hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates() | psiStates;
35 psiStates,
true, upperBound);
44template<
typename ValueType,
typename SolutionType>
49template<
typename ValueType,
typename SolutionType>
53 uint64_t
const lowerBound, uint64_t
const upperBound,
ModelCheckerHint const& hint) {
58 return std::all_of(r.begin(), r.end(), [&numStates](
auto i) { return i == numStates; });
60 "Inconsistent input dimensions.");
62 "Got a nondeterministic transition matrix but solve goal does not specify a direction.");
64 "Interval transition matrix given, but no uncertainty resolution mode is specified.");
67 if (lowerBound > upperBound) {
77 STORM_LOG_INFO(
"Preprocessing step-bounded reachability probability computation: "
88 std::vector<SolutionType> result;
93 auto const firstPhaseMaybeStates = probGreater0States & ~psiStates;
101 if (upperBound > lowerBound && firstPhaseMaybeStates.getNumberOfSetBits() > 0) {
105 std::vector<ValueType> b;
110 multiplier->repeatedMultiplyAndReduce(env, optimizationDirection, result, &b, upperBound - lowerBound, goal.getUncertaintyResolutionMode());
117 if (upperBound > lowerBound && firstPhaseMaybeStates.getNumberOfSetBits() > 0) {
119 auto submatrix = transitionMatrix.
getSubmatrix(
true, firstPhaseMaybeStates, firstPhaseMaybeStates,
false);
124 multiplier->repeatedMultiplyAndReduce(env, optimizationDirection, result, &b, upperBound - lowerBound);
129 auto const secondPhaseMaybeStates = probGreater0States & phiStates;
130 if (lowerBound != 0 && !secondPhaseMaybeStates.empty()) {
139 multiplier->repeatedMultiplyAndReduce(env, optimizationDirection, result,
nullptr, lowerBound, goal.getUncertaintyResolutionMode());
145 auto firstPhaseFilter = firstPhaseMaybeStates % secondPhaseMaybeStates;
148 auto submatrix = transitionMatrix.
getSubmatrix(
true, secondPhaseMaybeStates, secondPhaseMaybeStates,
false);
151 uint64_t numIterations = lowerBound;
153 if (
auto const excludedPsiStates = psiStates & ~phiStates; !excludedPsiStates.
empty()) {
155 multiplier->multiplyAndReduce(env, optimizationDirection, result, &b, result);
158 multiplier->repeatedMultiplyAndReduce(env, optimizationDirection, result,
nullptr, numIterations);
This class contains information that might accelerate the model checking process.
virtual bool isExplicitModelCheckerHint() const
SparseStepBoundedHorizonHelper()
std::vector< SolutionType > computeStepBoundedUntilProbabilities(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, uint64_t const lowerBound, uint64_t const upperBound, ModelCheckerHint const &hint=ModelCheckerHint())
Computes the probability of staying in phiStates until reaching psiStates within [lowerBound,...
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 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.
size_t size() const
Retrieves the number of bits this bit vector can store.
A class that holds a possibly non-square matrix in the compressed row storage format.
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 ...
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
index_type getColumnCount() const
Returns the number of columns of the matrix.
bool hasTrivialRowGrouping() const
Retrieves whether the matrix has a trivial row grouping.
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.
storm::storage::BitVector getRowFilter(storm::storage::BitVector const &groupConstraint) const
Returns a bitvector representing the set of rows, with all indices set that correspond to one of the ...
SparseMatrix filterEntries(storm::storage::BitVector const &rowFilter) const
Returns a copy of this matrix that only considers entries in the selected rows.
#define STORM_LOG_INFO(message)
#define STORM_LOG_ASSERT(cond, message)
storm::storage::BitVector computeProbGreater0States(storm::solver::SolveGoal< ValueType, SolutionType > const &goal, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, uint64_t const upperBound, ModelCheckerHint const &hint)
bool isSet(OptimizationDirectionSetting s)
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Performs a backward depth-first search trough the underlying graph structure of the given model to de...
storm::storage::BitVector performProbGreater0A(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under any pos...
storm::storage::BitVector performProbGreater0E(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under at leas...
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.
void setAllValues(std::vector< T > &vec, storm::storage::BitVector const &positions, T const &positiveValue=storm::utility::one< T >(), T const &negativeValue=storm::utility::zero< T >())
void blowUpVectorInPlace(std::vector< T > &vector, storm::storage::BitVector const &positions, T const &defaultValue=storm::utility::zero< T >())
Gets as input a vector with size n and a BitVector with size m>=n and exactly n set bits.
constexpr bool IsIntervalType
Helper to check if a type is an interval.