18namespace modelchecker {
21template<storm::dd::DdType DdType,
typename ValueType>
33 STORM_LOG_INFO(
"Preprocessing: " << statesWithProbability01.first.getNonZeroCount() <<
" states with probability 0, "
34 << statesWithProbability01.second.getNonZeroCount() <<
" with probability 1 (" << maybeStates.
getNonZeroCount()
35 <<
" states remaining).");
40 return statesWithProbability01.second.template toAdd<ValueType>() +
41 maybeStates.template toAdd<ValueType>() * model.
getManager().getConstant(storm::utility::convertNumber<ValueType>(0.5));
44 if (!maybeStates.
isZero()) {
45 return computeUntilProbabilities(env, model, transitionMatrix, maybeStates, statesWithProbability01.second,
46 startValues ? maybeStates.
ite(startValues.get(), model.
getManager().template getAddZero<ValueType>())
47 : model.
getManager().template getAddZero<ValueType>());
49 return statesWithProbability01.second.template toAdd<ValueType>();
54template<storm::dd::DdType DdType,
typename ValueType>
82 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
84 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
87 return statesWithProbability1.template toAdd<ValueType>() + result;
90template<storm::dd::DdType DdType,
typename ValueType>
96 result = result.
getDdManager().template getAddOne<ValueType>() - result;
100template<storm::dd::DdType DdType,
typename ValueType>
108template<storm::dd::DdType DdType,
typename ValueType>
119 if (!maybeStates.
isZero()) {
137 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
141 return psiStates.template toAdd<ValueType>() + result;
143 return psiStates.template toAdd<ValueType>();
147template<storm::dd::DdType DdType,
typename ValueType>
152 STORM_LOG_THROW(!rewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
159 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
161 return solver->multiply(model.
getManager().template getAddZero<ValueType>(), &totalRewardVector, stepBound);
164template<storm::dd::DdType DdType,
typename ValueType>
170 "Computing instantaneous rewards for a reward model that does not define any state-rewards. The result is trivially 0.");
174 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
179template<storm::dd::DdType DdType,
typename ValueType>
185 STORM_LOG_THROW(!rewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
193 <<
" target states (" << maybeStates.
getNonZeroCount() <<
" states remaining).");
199 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()), model.
getManager().template getAddZero<ValueType>()) +
200 maybeStates.template toAdd<ValueType>() * model.
getManager().getConstant(storm::utility::one<ValueType>());
203 if (!maybeStates.
isZero()) {
204 return computeReachabilityRewards(env, model, transitionMatrix, rewardModel, maybeStates, targetStates, infinityStates,
205 startValues ? maybeStates.
ite(startValues.get(), model.
getManager().template getAddZero<ValueType>())
206 : model.
getManager().template getAddZero<ValueType>());
208 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()),
209 model.
getManager().getConstant(storm::utility::zero<ValueType>()));
214template<storm::dd::DdType DdType,
typename ValueType>
238 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
240 solver->setLowerBound(storm::utility::zero<ValueType>());
242 solver->solveEquations(env, startValues ? startValues.get() : maybeStatesAdd.
getDdManager().template getAddZero<ValueType>(), subvector);
244 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()), result);
247template<storm::dd::DdType DdType,
typename ValueType>
252 return computeReachabilityRewards(env, model, transitionMatrix, rewardModel, targetStates, qualitative, startValues);
Add< LibraryType, ValueType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the ADD.
Add< LibraryType, ValueType > sumAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Sum-abstracts from the given meta variables.
Bdd< LibraryType > notZero() const
Computes a BDD that represents the function in which all assignments with a function value unequal to...
bool isZero() const
Retrieves whether this DD represents the constant zero function.
virtual uint_fast64_t getNonZeroCount() const override
Retrieves the number of encodings that are mapped to a non-zero value.
Bdd< LibraryType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the BDD.
Bdd< LibraryType > ite(Bdd< LibraryType > const &thenBdd, Bdd< LibraryType > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
DdManager< LibraryType > & getDdManager() const
Retrieves the manager that is responsible for this DD.
static storm::dd::Add< DdType, ValueType > computeUntilProbabilities(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &phiStates, storm::dd::Bdd< DdType > const &psiStates, bool qualitative, boost::optional< storm::dd::Add< DdType, ValueType > > const &startValues=boost::none)
static storm::dd::Add< DdType, ValueType > computeCumulativeRewards(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound)
static storm::dd::Add< DdType, ValueType > computeNextProbabilities(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &nextStates)
static storm::dd::Add< DdType, ValueType > computeBoundedUntilProbabilities(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &phiStates, storm::dd::Bdd< DdType > const &psiStates, uint_fast64_t stepBound)
static storm::dd::Add< DdType, ValueType > computeReachabilityTimes(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &targetStates, bool qualitative, boost::optional< storm::dd::Add< DdType, ValueType > > const &startValues=boost::none)
static storm::dd::Add< DdType, ValueType > computeReachabilityRewards(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, RewardModelType const &rewardModel, storm::dd::Bdd< DdType > const &targetStates, bool qualitative, boost::optional< storm::dd::Add< DdType, ValueType > > const &startValues=boost::none)
static storm::dd::Add< DdType, ValueType > computeGloballyProbabilities(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, storm::dd::Bdd< DdType > const &psiStates, bool qualitative)
static storm::dd::Add< DdType, ValueType > computeInstantaneousRewards(Environment const &env, storm::models::symbolic::Model< DdType, ValueType > const &model, storm::dd::Add< DdType, ValueType > const &transitionMatrix, RewardModelType const &rewardModel, uint_fast64_t stepBound)
Base class for all symbolic models.
storm::dd::DdManager< Type > & getManager() const
Retrieves the manager responsible for the DDs that represent this model.
std::set< storm::expressions::Variable > const & getColumnVariables() const
Retrieves the meta variables used to encode the columns of the transition matrix and the vector indic...
storm::dd::Add< Type, ValueType > getRowColumnIdentity() const
Retrieves an ADD that represents the diagonal of the transition matrix.
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const & getRowColumnMetaVariablePairs() const
Retrieves the pairs of row and column meta variables.
std::set< storm::expressions::Variable > const & getRowVariables() const
Retrieves the meta variables used to encode the rows of the transition matrix and the vector indices.
storm::dd::Bdd< Type > const & getReachableStates() const
Retrieves the reachable states of the model.
bool hasStateRewards() const
Retrieves whether the reward model has state rewards.
storm::dd::Add< Type, ValueType > getTotalRewardVector(storm::dd::Add< Type, ValueType > const &transitionMatrix, std::set< storm::expressions::Variable > const &columnVariables) const
Creates a vector representing the complete reward vector based on the state-, state-action- and trans...
bool empty() const
Retrieves whether the reward model is empty.
storm::dd::Add< Type, ValueType > const & getStateRewardVector() const
Retrieves the state rewards of the reward model.
virtual std::unique_ptr< storm::solver::SymbolicLinearEquationSolver< DdType, ValueType > > create(Environment const &env) const override
LinearEquationSolverProblemFormat getEquationProblemFormat(Environment const &env) const
#define STORM_LOG_INFO(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_THROW(cond, exception, message)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01(storm::models::sparse::DeterministicModel< T > const &model, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 or 1, respectively, of satisfying phi until psi i...
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 performProb1(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &, storm::storage::BitVector const &psiStates, storm::storage::BitVector const &statesWithProbabilityGreater0)
Computes the set of states of the given model for which all paths lead to the given set of target sta...