7template<DdType LibraryType>
8DdMetaVariable<LibraryType>::DdMetaVariable(std::string
const& name, int_fast64_t low, int_fast64_t high, std::vector<Bdd<LibraryType>>
const& ddVariables)
9 : name(name), type(
MetaVariableType::
Int), low(low), high(high), ddVariables(ddVariables), lowestIndex(0) {
11 this->precomputeLowestIndex();
14template<DdType LibraryType>
15DdMetaVariable<LibraryType>::DdMetaVariable(MetaVariableType
const& type, std::string
const& name, std::vector<Bdd<LibraryType>>
const& ddVariables)
16 : name(name), type(type), low(0), ddVariables(ddVariables), lowestIndex(0) {
17 STORM_LOG_ASSERT(type == MetaVariableType::Bool || type == MetaVariableType::BitVector,
"Cannot create this type of meta variable in this constructor.");
18 if (ddVariables.size() < 63) {
19 this->high = (1ull << ddVariables.size()) - 1;
23 if (ddVariables.size() == 1) {
24 this->type = MetaVariableType::Bool;
27 this->precomputeLowestIndex();
30template<DdType LibraryType>
35template<DdType LibraryType>
40template<DdType LibraryType>
45template<DdType LibraryType>
47 return this->high.get();
50template<DdType LibraryType>
52 return static_cast<bool>(this->high);
55template<DdType LibraryType>
57 bool result = value >= this->low;
59 return value <= this->high;
64template<DdType LibraryType>
66 return this->ddVariables.size();
69template<DdType LibraryType>
71 return this->ddVariables;
74template<DdType LibraryType>
79template<DdType LibraryType>
81 std::vector<std::pair<uint64_t, uint64_t>> indicesAndLevels = this->getIndicesAndLevels();
83 std::sort(indicesAndLevels.begin(), indicesAndLevels.end(),
84 [](std::pair<uint64_t, uint64_t>
const& a, std::pair<uint64_t, uint64_t>
const& b) { return a.second < b.second; });
87 std::vector<uint64_t> indices;
88 for (
auto const& e : indicesAndLevels) {
89 indices.emplace_back(e.first);
95template<DdType LibraryType>
97 std::vector<std::pair<uint64_t, uint64_t>> indicesAndLevels;
98 for (
auto const& v : ddVariables) {
99 indicesAndLevels.emplace_back(v.getIndex(), v.getLevel());
102 return indicesAndLevels;
105template<DdType LibraryType>
109 for (
auto const& v : ddVariables) {
111 result = v.getLevel();
114 result = std::max(result, v.getLevel());
121template<DdType LibraryType>
126template<DdType LibraryType>
128 STORM_LOG_ASSERT(!this->ddVariables.empty(),
"The DD variables must not be empty.");
129 auto it = this->ddVariables.begin();
132 for (
auto ite = this->ddVariables.end(); it != ite; ++it) {
137template<DdType LibraryType>
138void DdMetaVariable<LibraryType>::precomputeLowestIndex() {
140 for (
auto const& var : this->ddVariables) {
143 this->lowestIndex = var.getIndex();
145 this->lowestIndex = std::min(lowestIndex, var.getIndex());
150template class DdMetaVariable<DdType::CUDD>;
151template class DdMetaVariable<DdType::Sylvan>;
#define STORM_LOG_ASSERT(cond, message)