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