Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Mdp.cpp
Go to the documentation of this file.
2
8
9namespace storm {
10namespace models {
11namespace symbolic {
12
13template<storm::dd::DdType Type, typename ValueType>
15 storm::dd::Bdd<Type> deadlockStates, storm::dd::Add<Type, ValueType> transitionMatrix,
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::set<storm::expressions::Variable> const& nondeterminismVariables,
21 std::map<std::string, storm::expressions::Expression> labelToExpressionMap,
22 std::unordered_map<std::string, RewardModelType> const& rewardModels)
23 : NondeterministicModel<Type, ValueType>(storm::models::ModelType::Mdp, manager, reachableStates, initialStates, deadlockStates, transitionMatrix,
24 rowVariables, rowExpressionAdapter, columnVariables, rowColumnMetaVariablePairs, nondeterminismVariables,
25 labelToExpressionMap, rewardModels) {
26 // Intentionally left empty.
27}
28
29template<storm::dd::DdType Type, typename ValueType>
31 storm::dd::Bdd<Type> deadlockStates, storm::dd::Add<Type, ValueType> transitionMatrix,
32 std::set<storm::expressions::Variable> const& rowVariables, std::set<storm::expressions::Variable> const& columnVariables,
33 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& rowColumnMetaVariablePairs,
34 std::set<storm::expressions::Variable> const& nondeterminismVariables, std::map<std::string, storm::dd::Bdd<Type>> labelToBddMap,
35 std::unordered_map<std::string, RewardModelType> const& rewardModels)
36 : NondeterministicModel<Type, ValueType>(storm::models::ModelType::Mdp, manager, reachableStates, initialStates, deadlockStates, transitionMatrix,
37 rowVariables, columnVariables, rowColumnMetaVariablePairs, nondeterminismVariables, labelToBddMap, rewardModels) {
38 // Intentionally left empty.
39}
40
41template<storm::dd::DdType Type, typename ValueType>
42template<typename NewValueType>
43std::shared_ptr<Mdp<Type, NewValueType>> Mdp<Type, ValueType>::toValueType() const {
44 typedef typename NondeterministicModel<Type, NewValueType>::RewardModelType NewRewardModelType;
45 std::unordered_map<std::string, NewRewardModelType> newRewardModels;
46
47 for (auto const& e : this->getRewardModels()) {
48 newRewardModels.emplace(e.first, e.second.template toValueType<NewValueType>());
49 }
50
51 auto newLabelToBddMap = this->getLabelToBddMap();
52 newLabelToBddMap.erase("init");
53 newLabelToBddMap.erase("deadlock");
54
55 return std::make_shared<Mdp<Type, NewValueType>>(this->getManagerAsSharedPointer(), this->getReachableStates(), this->getInitialStates(),
56 this->getDeadlockStates(), this->getTransitionMatrix().template toValueType<NewValueType>(),
57 this->getRowVariables(), this->getColumnVariables(), this->getRowColumnMetaVariablePairs(),
58 this->getNondeterminismVariables(), newLabelToBddMap, newRewardModels);
59}
60
61// Explicitly instantiate the template class.
63
66template std::shared_ptr<Mdp<storm::dd::DdType::Sylvan, double>> Mdp<storm::dd::DdType::Sylvan, storm::RationalNumber>::toValueType() const;
68
69} // namespace symbolic
70} // namespace models
71} // namespace storm
Mdp(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::models::sparse::StateLabeling const &stateLabeling, std::unordered_map< std::string, RewardModelType > const &rewardModels=std::unordered_map< std::string, RewardModelType >(), ModelType type=ModelType::Mdp)
Constructs a model from the given data.
Definition Mdp.cpp:12
This class represents a discrete-time Markov decision process.
Definition Mdp.h:13
Base class for all nondeterministic symbolic models.