Storm 1.13.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Dtmc.cpp
Go to the documentation of this file.
2
8
9namespace storm {
10namespace models {
11namespace symbolic {
12
13template<storm::dd::DdType Type, typename ValueType>
16 std::set<storm::expressions::Variable> const& rowVariables,
17 std::shared_ptr<storm::adapters::AddExpressionAdapter<Type, ValueType>> rowExpressionAdapter,
18 std::set<storm::expressions::Variable> const& columnVariables,
19 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& rowColumnMetaVariablePairs,
20 std::map<std::string, storm::expressions::Expression> labelToExpressionMap,
21 std::unordered_map<std::string, RewardModelType> const& rewardModels)
22 : DeterministicModel<Type, ValueType>(storm::models::ModelType::Dtmc, manager, reachableStates, initialStates, deadlockStates, transitionMatrix,
23 rowVariables, rowExpressionAdapter, columnVariables, rowColumnMetaVariablePairs, labelToExpressionMap, rewardModels) {
24 // Intentionally left empty.
25}
26
27template<storm::dd::DdType Type, typename ValueType>
30 std::set<storm::expressions::Variable> const& rowVariables, std::set<storm::expressions::Variable> const& columnVariables,
31 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& rowColumnMetaVariablePairs,
32 std::map<std::string, storm::dd::Bdd<Type>> labelToBddMap, std::unordered_map<std::string, RewardModelType> const& rewardModels)
33 : DeterministicModel<Type, ValueType>(storm::models::ModelType::Dtmc, manager, reachableStates, initialStates, deadlockStates, transitionMatrix,
34 rowVariables, columnVariables, rowColumnMetaVariablePairs, labelToBddMap, rewardModels) {
35 // Intentionally left empty.
36}
37
38template<storm::dd::DdType Type, typename ValueType>
40 for (auto& rewardModel : this->getRewardModels()) {
41 rewardModel.second.reduceToStateBasedRewards(this->getTransitionMatrix(), this->getRowVariables(), this->getColumnVariables(), true);
42 }
43}
44
45template<storm::dd::DdType Type, typename ValueType>
46template<typename NewValueType>
47std::shared_ptr<Dtmc<Type, NewValueType>> Dtmc<Type, ValueType>::toValueType() const {
48 typedef typename DeterministicModel<Type, NewValueType>::RewardModelType NewRewardModelType;
49 std::unordered_map<std::string, NewRewardModelType> newRewardModels;
50
51 for (auto const& e : this->getRewardModels()) {
52 newRewardModels.emplace(e.first, e.second.template toValueType<NewValueType>());
53 }
54
55 auto newLabelToBddMap = this->getLabelToBddMap();
56 newLabelToBddMap.erase("init");
57 newLabelToBddMap.erase("deadlock");
58
59 return std::make_shared<Dtmc<Type, NewValueType>>(this->getManagerAsSharedPointer(), this->getReachableStates(), this->getInitialStates(),
62 newLabelToBddMap, newRewardModels);
63}
64
65// Explicitly instantiate the template class.
67
70template std::shared_ptr<Dtmc<storm::dd::DdType::Sylvan, double>> Dtmc<storm::dd::DdType::Sylvan, storm::RationalNumber>::toValueType() const;
72
73} // namespace symbolic
74} // namespace models
75} // namespace storm
virtual void reduceToStateBasedRewards() override
Dtmc(storm::storage::SparseMatrix< double > const &transitionMatrix, storm::models::sparse::StateLabeling const &stateLabeling, std::unordered_map< std::string, StandardRewardModel< double > > const &rewardModels=std::unordered_map< std::string, StandardRewardModel< double > >())
Model< Type, ValueType >::RewardModelType RewardModelType
DeterministicModel(DeterministicModel< Type, double > const &other)=default
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
std::shared_ptr< Dtmc< Type, NewValueType > > toValueType() const
Definition Dtmc.cpp:47
Dtmc(Dtmc< Type, ValueType > const &other)=default
storm::dd::Add< Type, ValueType > const & getTransitionMatrix() const
Definition Model.cpp:173
storm::dd::Bdd< Type > const & getDeadlockStates() const
Definition Model.cpp:108
std::set< storm::expressions::Variable > const & getColumnVariables() const
Definition Model.cpp:193
std::shared_ptr< storm::dd::DdManager< Type > > const & getManagerAsSharedPointer() const
Definition Model.cpp:93
std::map< std::string, storm::dd::Bdd< Type > > const & getLabelToBddMap() const
Definition Model.cpp:229
storm::dd::Bdd< Type > const & getInitialStates() const
Definition Model.cpp:103
storm::dd::Add< Type, ValueType > transitionMatrix
Definition Model.h:393
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const & getRowColumnMetaVariablePairs() const
Definition Model.cpp:219
std::set< storm::expressions::Variable > const & getRowVariables() const
Definition Model.cpp:188
std::unordered_map< std::string, RewardModelType > & getRewardModels()
Definition Model.cpp:294
storm::dd::Bdd< Type > const & getReachableStates() const
Definition Model.cpp:98