15namespace modelchecker {
18template<storm::dd::DdType DdType,
typename ValueType>
30 STORM_LOG_INFO(
"Preprocessing: " << statesWithProbability01.first.getNonZeroCount() <<
" states with probability 0, "
31 << statesWithProbability01.second.getNonZeroCount() <<
" with probability 1 (" << maybeStates.
getNonZeroCount()
32 <<
" states remaining).");
37 return statesWithProbability01.second.template toAdd<ValueType>() +
38 maybeStates.template toAdd<ValueType>() * model.
getManager().getConstant(storm::utility::convertNumber<ValueType>(0.5));
41 if (!maybeStates.
isZero()) {
42 return computeUntilProbabilities(env, model, transitionMatrix, maybeStates, statesWithProbability01.second,
43 startValues ? maybeStates.
ite(startValues.get(), model.
getManager().template getAddZero<ValueType>())
44 : model.
getManager().template getAddZero<ValueType>());
46 return statesWithProbability01.second.template toAdd<ValueType>();
51template<storm::dd::DdType DdType,
typename ValueType>
79 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
81 solver->setBounds(storm::utility::zero<ValueType>(), storm::utility::one<ValueType>());
84 return statesWithProbability1.template toAdd<ValueType>() + result;
87template<storm::dd::DdType DdType,
typename ValueType>
93 result = result.
getDdManager().template getAddOne<ValueType>() - result;
97template<storm::dd::DdType DdType,
typename ValueType>
105template<storm::dd::DdType DdType,
typename ValueType>
116 if (!maybeStates.
isZero()) {
134 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
138 return psiStates.template toAdd<ValueType>() + result;
140 return psiStates.template toAdd<ValueType>();
144template<storm::dd::DdType DdType,
typename ValueType>
149 STORM_LOG_THROW(!rewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
156 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
158 return solver->multiply(model.
getManager().template getAddZero<ValueType>(), &totalRewardVector, stepBound);
161template<storm::dd::DdType DdType,
typename ValueType>
167 "Computing instantaneous rewards for a reward model that does not define any state-rewards. The result is trivially 0.");
171 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
176template<storm::dd::DdType DdType,
typename ValueType>
182 STORM_LOG_THROW(!rewardModel.
empty(), storm::exceptions::InvalidPropertyException,
"Missing reward model for formula. Skipping formula.");
190 <<
" target states (" << maybeStates.
getNonZeroCount() <<
" states remaining).");
196 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()), model.
getManager().template getAddZero<ValueType>()) +
197 maybeStates.template toAdd<ValueType>() * model.
getManager().getConstant(storm::utility::one<ValueType>());
200 if (!maybeStates.
isZero()) {
201 return computeReachabilityRewards(env, model, transitionMatrix, rewardModel, maybeStates, targetStates, infinityStates,
202 startValues ? maybeStates.
ite(startValues.get(), model.
getManager().template getAddZero<ValueType>())
203 : model.
getManager().template getAddZero<ValueType>());
205 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()),
206 model.
getManager().getConstant(storm::utility::zero<ValueType>()));
211template<storm::dd::DdType DdType,
typename ValueType>
235 std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.
create(
237 solver->setLowerBound(storm::utility::zero<ValueType>());
239 solver->solveEquations(env, startValues ? startValues.get() : maybeStatesAdd.
getDdManager().template getAddZero<ValueType>(), subvector);
241 return infinityStates.
ite(model.
getManager().getConstant(storm::utility::infinity<ValueType>()), result);
244template<storm::dd::DdType DdType,
typename ValueType>
249 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...