8template<DdType LibraryType>
9DdMetaVariable<LibraryType>::DdMetaVariable(std::string
const& name, int_fast64_t low, int_fast64_t high, std::vector<Bdd<LibraryType>>
const& ddVariables)
10 : name(name), type(
MetaVariableType::
Int), low(low), high(high), ddVariables(ddVariables), lowestIndex(0) {
12 this->precomputeLowestIndex();
15template<DdType LibraryType>
16DdMetaVariable<LibraryType>::DdMetaVariable(MetaVariableType
const& type, std::string
const& name, std::vector<Bdd<LibraryType>>
const& ddVariables)
17 : name(name), type(type), low(0), ddVariables(ddVariables), lowestIndex(0) {
18 STORM_LOG_ASSERT(type == MetaVariableType::Bool || type == MetaVariableType::BitVector,
"Cannot create this type of meta variable in this constructor.");
19 if (ddVariables.size() < 63) {
20 this->high = (1ull << ddVariables.size()) - 1;
24 if (ddVariables.size() == 1) {
25 this->type = MetaVariableType::Bool;
28 this->precomputeLowestIndex();
31template<DdType LibraryType>
36template<DdType LibraryType>
41template<DdType LibraryType>
46template<DdType LibraryType>
48 return this->high.get();
51template<DdType LibraryType>
53 return static_cast<bool>(this->high);
56template<DdType LibraryType>
58 bool result = value >= this->low;
60 return value <= this->high;
65template<DdType LibraryType>
67 return this->ddVariables.size();
70template<DdType LibraryType>
72 return this->ddVariables;
75template<DdType LibraryType>
80template<DdType LibraryType>
82 std::vector<std::pair<uint64_t, uint64_t>> indicesAndLevels = this->getIndicesAndLevels();
84 std::sort(indicesAndLevels.begin(), indicesAndLevels.end(),
85 [](std::pair<uint64_t, uint64_t>
const& a, std::pair<uint64_t, uint64_t>
const& b) { return a.second < b.second; });
88 std::vector<uint64_t> indices;
89 for (
auto const& e : indicesAndLevels) {
90 indices.emplace_back(e.first);
96template<DdType LibraryType>
98 std::vector<std::pair<uint64_t, uint64_t>> indicesAndLevels;
99 for (
auto const& v : ddVariables) {
100 indicesAndLevels.emplace_back(v.getIndex(), v.getLevel());
103 return indicesAndLevels;
106template<DdType LibraryType>
110 for (
auto const& v : ddVariables) {
112 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)