Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PreservationInformation.cpp
Go to the documentation of this file.
2
4
6
8
11
12namespace storm {
13namespace dd {
14namespace bisimulation {
15
16template<storm::dd::DdType DdType, typename ValueType>
21
22template<storm::dd::DdType DdType, typename ValueType>
24 std::vector<std::string> const& labels) {
25 for (auto const& label : labels) {
26 this->addLabel(label);
27 this->addExpression(model.getExpression(label));
28 }
29}
30
31template<storm::dd::DdType DdType, typename ValueType>
33 std::vector<storm::expressions::Expression> const& expressions) {
34 for (auto const& e : expressions) {
35 this->addExpression(e);
36 }
37}
38
39template<storm::dd::DdType DdType, typename ValueType>
41 std::vector<std::shared_ptr<storm::logic::Formula const>> const& formulas) {
42 if (formulas.empty()) {
43 // Default to respect all labels if no formulas are given.
44 for (auto const& label : model.getLabels()) {
45 this->addLabel(label);
46 this->addExpression(model.getExpression(label));
47 }
48 for (auto const& rewardModel : model.getRewardModels()) {
49 this->addRewardModel(rewardModel.first);
50 }
51 } else {
52 for (auto const& formula : formulas) {
53 for (auto const& expressionFormula : formula->getAtomicExpressionFormulas()) {
54 this->addExpression(expressionFormula->getExpression());
55 }
56 for (auto const& labelFormula : formula->getAtomicLabelFormulas()) {
57 this->addLabel(labelFormula->getLabel());
58 std::string const& label = labelFormula->getLabel();
59 STORM_LOG_THROW(model.hasLabel(label), storm::exceptions::InvalidPropertyException, "Property refers to illegal label '" << label << "'.");
60 this->addExpression(model.getExpression(label));
61 }
62 for (auto const& rewardModel : formula->getReferencedRewardModels()) {
63 if (rewardModel == "") {
64 if (model.hasRewardModel("")) {
65 this->addRewardModel(rewardModel);
66 } else {
67 STORM_LOG_THROW(model.hasUniqueRewardModel(), storm::exceptions::InvalidPropertyException,
68 "Property refers to the default reward model, but it does not exist or is not unique.");
69 this->addRewardModel(model.getUniqueRewardModelName());
70 }
71 } else {
72 this->addRewardModel(rewardModel);
73 }
74 }
75 }
76 }
77}
78
79template<storm::dd::DdType DdType, typename ValueType>
81 labels.insert(label);
82}
83
84template<storm::dd::DdType DdType, typename ValueType>
86 expressions.insert(expression);
87}
88
89template<storm::dd::DdType DdType, typename ValueType>
91 rewardModelNames.insert(name);
92}
93
94template<storm::dd::DdType DdType, typename ValueType>
95std::set<std::string> const& PreservationInformation<DdType, ValueType>::getLabels() const {
96 return labels;
97}
98
99template<storm::dd::DdType DdType, typename ValueType>
100std::set<storm::expressions::Expression> const& PreservationInformation<DdType, ValueType>::getExpressions() const {
101 return expressions;
102}
103
104template<storm::dd::DdType DdType, typename ValueType>
106 return rewardModelNames;
107}
108
110
114} // namespace bisimulation
115} // namespace dd
116} // namespace storm
std::set< std::string > const & getLabels() const
std::set< std::string > const & getRewardModelNames() const
std::set< storm::expressions::Expression > const & getExpressions() const
void addExpression(storm::expressions::Expression const &expression)
Base class for all symbolic models.
Definition Model.h:46
virtual storm::expressions::Expression getExpression(std::string const &label) const
Returns the expression for the given label.
Definition Model.cpp:132
virtual std::string const & getUniqueRewardModelName() const override
Retrieves the name of the unique reward model, if there exists exactly one.
Definition Model.cpp:279
virtual bool hasRewardModel(std::string const &rewardModelName) const override
Retrieves whether the model has a reward model with the given name.
Definition Model.cpp:249
std::vector< std::string > getLabels() const
Definition Model.cpp:319
virtual bool hasLabel(std::string const &label) const
Retrieves whether the given label is a valid label in this model.
Definition Model.cpp:162
std::unordered_map< std::string, RewardModelType > & getRewardModels()
Definition Model.cpp:303
virtual bool hasUniqueRewardModel() const override
Retrieves whether the model has a unique reward model.
Definition Model.cpp:293
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
LabParser.cpp.
Definition cli.cpp:18