Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
LocalExpressionInformation.h
Go to the documentation of this file.
1#pragma once
2
3#include <ostream>
4#include <set>
5#include <unordered_map>
6#include <vector>
7
10
12
13namespace storm::gbar {
14namespace abstraction {
15
16template<storm::dd::DdType DdType>
17class AbstractionInformation;
18
19template<storm::dd::DdType DdType>
21 public:
28
35 std::map<uint64_t, uint64_t> addExpression(uint_fast64_t globalExpressionIndex);
36
44 bool areRelated(storm::expressions::Variable const& firstVariable, storm::expressions::Variable const& secondVariable);
45
53 std::map<uint64_t, uint64_t> relate(storm::expressions::Variable const& firstVariable, storm::expressions::Variable const& secondVariable);
54
61 std::map<uint64_t, uint64_t> relate(std::set<storm::expressions::Variable> const& variables);
62
69 std::set<storm::expressions::Variable> const& getBlockOfVariable(storm::expressions::Variable const& variable) const;
70
77 uint_fast64_t getBlockIndexOfVariable(storm::expressions::Variable const& variable) const;
78
85 std::set<uint_fast64_t> getBlockIndicesOfVariables(std::set<storm::expressions::Variable> const& variables) const;
86
92 uint_fast64_t getNumberOfBlocks() const;
93
100 std::set<storm::expressions::Variable> const& getVariableBlockWithIndex(uint_fast64_t blockIndex) const;
101
108 std::set<uint_fast64_t> const& getRelatedExpressions(storm::expressions::Variable const& variable) const;
109
116 std::set<uint_fast64_t> getRelatedExpressions(std::set<storm::expressions::Variable> const& variables) const;
117
124 std::set<uint_fast64_t> const& getExpressionsUsingVariable(storm::expressions::Variable const& variable) const;
125
132 std::set<uint_fast64_t> getExpressionsUsingVariables(std::set<storm::expressions::Variable> const& variables) const;
133
139 std::set<uint_fast64_t> const& getExpressionBlock(uint64_t index) const;
140
141 template<storm::dd::DdType DdTypePrime>
142 friend std::ostream& operator<<(std::ostream& out, LocalExpressionInformation<DdTypePrime> const& partition);
143
144 private:
151 std::map<uint64_t, uint64_t> mergeBlocks(std::set<uint_fast64_t> const& blocksToMerge);
152
153 // The set of variables relevant for this partition.
154 std::set<storm::expressions::Variable> relevantVariables;
155
156 // A mapping from variables to their blocks.
157 std::unordered_map<storm::expressions::Variable, uint_fast64_t> variableToBlockMapping;
158
159 // The variable blocks of the partition.
160 std::vector<std::set<storm::expressions::Variable>> variableBlocks;
161
162 // The expression blocks of the partition.
163 std::vector<std::set<uint_fast64_t>> expressionBlocks;
164
165 // A mapping from variables to the indices of all expressions they appear in.
166 std::unordered_map<storm::expressions::Variable, std::set<uint_fast64_t>> variableToExpressionsMapping;
167
168 // The object storing the abstraction information.
169 std::reference_wrapper<AbstractionInformation<DdType> const> abstractionInformation;
170};
171
172template<storm::dd::DdType DdType>
173std::ostream& operator<<(std::ostream& out, LocalExpressionInformation<DdType> const& partition);
174
175} // namespace abstraction
176} // namespace storm::gbar
std::map< uint64_t, uint64_t > addExpression(uint_fast64_t globalExpressionIndex)
Adds the expression and therefore indirectly may cause blocks of variables to be merged.
bool areRelated(storm::expressions::Variable const &firstVariable, storm::expressions::Variable const &secondVariable)
Retrieves whether the two given variables are in the same block of the partition.
std::set< uint_fast64_t > getExpressionsUsingVariables(std::set< storm::expressions::Variable > const &variables) const
Retrieves the indices of the expressions in which the given variables appear.
std::set< storm::expressions::Variable > const & getBlockOfVariable(storm::expressions::Variable const &variable) const
Retrieves the block of related variables of the given variable.
friend std::ostream & operator<<(std::ostream &out, LocalExpressionInformation< DdTypePrime > const &partition)
std::set< uint_fast64_t > getBlockIndicesOfVariables(std::set< storm::expressions::Variable > const &variables) const
Retrieves the block indices of the given variables.
std::map< uint64_t, uint64_t > relate(storm::expressions::Variable const &firstVariable, storm::expressions::Variable const &secondVariable)
Places the given variables in the same block of the partition and performs the implied merges.
std::set< uint_fast64_t > const & getExpressionsUsingVariable(storm::expressions::Variable const &variable) const
Retrieves the indices of the expressions in which the given variable appears.
uint_fast64_t getNumberOfBlocks() const
Retrieves the number of blocks of the variable partition.
std::set< uint_fast64_t > const & getRelatedExpressions(storm::expressions::Variable const &variable) const
Retrieves the indices of the expressions related to the given variable.
std::set< storm::expressions::Variable > const & getVariableBlockWithIndex(uint_fast64_t blockIndex) const
Retrieves the block with the given index.
std::set< uint_fast64_t > const & getExpressionBlock(uint64_t index) const
Retrieves the expression block with the given index.
uint_fast64_t getBlockIndexOfVariable(storm::expressions::Variable const &variable) const
Retrieves the block index of the given variable.
std::ostream & operator<<(std::ostream &out, LocalExpressionInformation< DdType > const &partition)