Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Update.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
7
8namespace storm {
9namespace prism {
10class Update : public LocatedInformation {
11 public:
12 using ExpressionPair = std::pair<storm::expressions::Expression, storm::expressions::Expression>;
13
23 Update(uint_fast64_t globalIndex, storm::expressions::Expression const& likelihoodExpression, std::vector<storm::prism::Assignment> const& assignments,
24 std::string const& filename = "", uint_fast64_t lineNumber = 0);
35 Update(uint_fast64_t globalIndex, ExpressionPair const& likelihoodExpressionInterval, std::vector<storm::prism::Assignment> const& assignments,
36 std::string const& filename = "", uint_fast64_t lineNumber = 0);
37
38 // Create default implementations of constructors/assignment.
39 Update() = default;
40 Update(Update const& other) = default;
41 Update& operator=(Update const& other) = default;
42 Update(Update&& other) = default;
43 Update& operator=(Update&& other) = default;
44
45 bool isLikelihoodInterval() const;
46
54
62
68 std::size_t getNumberOfAssignments() const;
69
75 std::vector<storm::prism::Assignment> const& getAssignments() const;
76
82 std::vector<storm::prism::Assignment>& getAssignments();
83
89 storm::prism::Assignment const& getAssignment(std::string const& variableName) const;
90
96 std::map<storm::expressions::Variable, storm::expressions::Expression> getAsVariableToExpressionMap() const;
97
103 uint_fast64_t getGlobalIndex() const;
104
111 Update substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const;
112
119
121
125 Update simplify() const;
126
127 friend std::ostream& operator<<(std::ostream& stream, Update const& assignment);
128
129 private:
133 void createAssignmentMapping();
134
135 // Expressions specifying the likelihood of taking this update.
136 // Either both expressions are initialized (representing an interval likelihood [first, second] for interval models)
137 // or only the first one is initialized (standard, non-interval interpretation)
138 ExpressionPair likelihoodExpressions;
139
140 // The assignments of this update.
141 std::vector<storm::prism::Assignment> assignments;
142
143 // A mapping from variable names to their assignments.
144 std::map<std::string, uint_fast64_t> variableToAssignmentIndexMap;
145
146 // The global index of the update.
147 uint_fast64_t globalIndex;
148};
149} // namespace prism
150} // namespace storm
LocatedInformation(std::string const &filename, uint_fast64_t lineNumber)
Constructs a located information with the given filename and line number.
Update substituteNonStandardPredicates() const
Definition Update.cpp:133
std::size_t getNumberOfAssignments() const
Retrieves the number of assignments associated with this update.
Definition Update.cpp:71
bool isLikelihoodInterval() const
Definition Update.cpp:57
Update & operator=(Update const &other)=default
Update substitute(std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution) const
Substitutes all identifiers in the update according to the given map.
Definition Update.cpp:111
Update simplify() const
Simplifies the update in various ways (also removes identity assignments).
Definition Update.cpp:166
std::pair< storm::expressions::Expression, storm::expressions::Expression > ExpressionPair
Definition Update.h:12
Update(uint_fast64_t globalIndex, storm::expressions::Expression const &likelihoodExpression, std::vector< storm::prism::Assignment > const &assignments, std::string const &filename="", uint_fast64_t lineNumber=0)
Creates an update with the given expression specifying the likelihood and assignments.
Definition Update.cpp:13
std::map< storm::expressions::Variable, storm::expressions::Expression > getAsVariableToExpressionMap() const
Creates a mapping representation of this update.
Definition Update.cpp:90
Update(Update &&other)=default
Update(Update const &other)=default
storm::prism::Assignment const & getAssignment(std::string const &variableName) const
Retrieves a reference to the assignment for the variable with the given name.
Definition Update.cpp:83
uint_fast64_t getGlobalIndex() const
Retrieves the global index of the update, that is, a unique index over all modules.
Definition Update.cpp:100
Update & operator=(Update &&other)=default
Update removeIdentityAssignments() const
Removes all assignments which do not change the variable.
Definition Update.cpp:155
friend std::ostream & operator<<(std::ostream &stream, Update const &assignment)
Definition Update.cpp:184
ExpressionPair const & getLikelihoodExpressionInterval() const
Retrieves the two expression for the interval likelihood of this update.
Definition Update.cpp:66
std::vector< storm::prism::Assignment > const & getAssignments() const
Retrieves a reference to the map of variable names to their respective assignments.
Definition Update.cpp:75
storm::expressions::Expression const & getLikelihoodExpression() const
Retrieves the expression for the likelihood of this update.
Definition Update.cpp:61