diff --git a/src/adiar/internal/algorithms/substitution.h b/src/adiar/internal/algorithms/substitution.h index 470d39aef..63f9b5da3 100644 --- a/src/adiar/internal/algorithms/substitution.h +++ b/src/adiar/internal/algorithms/substitution.h @@ -104,6 +104,8 @@ namespace adiar::internal typename substitute_policy::label_t level = n.label(); size_t level_size = 0; + bool output_changes = false; + assignment a = amgr.assignment_for_level(level); // process the root and create initial recursion requests @@ -115,9 +117,13 @@ namespace adiar::internal level_size = 1; + output_changes |= n_res != n; + __substitute_resolve_request(low_arc_of(n_res), substitute_pq, aw); __substitute_resolve_request(high_arc_of(n_res), substitute_pq, aw); } else { // std::holds_alternative(n_res) + output_changes = true; + const ptr_uint64 rec_child = std::get(rec_res).child;; if(rec_child.is_terminal()) { @@ -156,6 +162,7 @@ namespace adiar::internal if(std::holds_alternative(rec_res)) { const node n_res = std::get(rec_res).out; + output_changes |= n_res != n; // outgoing arcs __substitute_resolve_request(low_arc_of(n_res), substitute_pq, aw); @@ -172,6 +179,8 @@ namespace adiar::internal level_size++; } else { // std::holds_alternative(rec_res) + output_changes = true; + const ptr_uint64 rec_child = std::get(rec_res).child; while(substitute_pq.can_pull() && substitute_pq.top().target() == n.uid()) { @@ -194,6 +203,10 @@ namespace adiar::internal } out_arcs->max_1level_cut = max_1level_cut; + + if (!output_changes) { + return dd; + } return out_arcs; } diff --git a/src/adiar/zdd.h b/src/adiar/zdd.h index 3df15f0ba..cabb3b611 100644 --- a/src/adiar/zdd.h +++ b/src/adiar/zdd.h @@ -407,24 +407,62 @@ namespace adiar /// /// \param A Family of set /// - /// \param vars Label of the variables to filter on (in ascending order) + /// \param vars Generator function of the variable labels to filter on in + /// *ascending* order. /// /// \returns /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \not\in a \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_offset(const zdd &A, const shared_file &vars); + __zdd zdd_offset(const zdd &A, const std::function &vars); + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Subset that do \em not include the given set of variables. + /// + /// \param A Family of set + /// + /// \param begin Iterator with variables to filter on in *ascending* order. + /// + /// \param end Iterator that marks the end for `begin`. + /// + /// \returns + /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \not\in a \} \f$ + ////////////////////////////////////////////////////////////////////////////// + template + __zdd zdd_offset(const zdd &A, IT begin, IT end) + { + return zdd_offset(A, internal::iterator_gen(begin, end)); + } ////////////////////////////////////////////////////////////////////////////// /// \brief Subset that \em do include the given set of variables. /// /// \param A Family of set /// - /// \param vars Label of the variables to filter on (in ascending order) + /// \param vars Generator function of the variable labels to filter on in + /// *ascending* order. /// /// \returns /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \in a \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_onset(const zdd &A, const shared_file &vars); + __zdd zdd_onset(const zdd &A, const std::function &vars); + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Subset that \em do include the given set of variables. + /// + /// \param A Family of set + /// + /// \param begin Iterator with variables to filter on in *ascending* order. + /// + /// \param end Iterator that marks the end for `begin`. + /// + /// \returns + /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \in a \} \f$ + ////////////////////////////////////////////////////////////////////////////// + template + __zdd zdd_onset(const zdd &A, IT begin, IT end) + { + return zdd_onset(A, internal::iterator_gen(begin, end)); + } ////////////////////////////////////////////////////////////////////////////// /// \brief Project family of sets onto a domain, i.e. remove from every diff --git a/src/adiar/zdd/subset.cpp b/src/adiar/zdd/subset.cpp index 75dc6c884..e71dabb98 100644 --- a/src/adiar/zdd/subset.cpp +++ b/src/adiar/zdd/subset.cpp @@ -10,71 +10,81 @@ namespace adiar { template - class zdd_subset_label_assignment + class zdd_subset_labels { - internal::file_stream ls; + const std::function &gen; - zdd::label_t l_incl; - zdd::label_t l_excl; + /// \brief The current level (including the current algorithm level) + zdd::label_t l_incl = zdd::MAX_LABEL+1; - bool has_excl = false; + /// \brief The next level (definitely excluding the current level) + zdd::label_t l_excl = zdd::MAX_LABEL+1; - // We will rememeber how far the algorithm in substitution.h has got + /// We will rememeber how far the algorithm in substitution.h has got zdd::label_t alg_level = 0; public: - zdd_subset_label_assignment(const shared_file &lf) - : ls(lf) + /// We will remember whether any level of the input actually matched. + bool l_match = false; + + public: + zdd_subset_labels(const std::function &g) + : gen(g) { - l_incl = ls.pull(); + l_incl = gen(); + if (l_incl <= zdd::MAX_LABEL) { l_excl = gen(); } } private: - inline void forward_to_level(const zdd::label_t new_level) { + /// \brief Forwards through the input to the given level + inline void forward_to_level(const zdd::label_t new_level) + { adiar_assert(alg_level <= new_level, "The algorithm should ask for the levels in increasing order."); alg_level = new_level; - if (l_incl < new_level && has_excl) { - l_incl = l_excl; - has_excl = false; - } - - while (l_incl < new_level && ls.can_pull()) { - l_incl = ls.pull(); + while (l_incl <= zdd::MAX_LABEL && l_incl < new_level) { + l_incl = std::move(l_excl); + if (l_incl <= zdd::MAX_LABEL) { l_excl = gen(); }; } } public: - assignment assignment_for_level(const zdd::label_t new_level) { + /// \brief Obtain the assignment for the current level + assignment assignment_for_level(const zdd::label_t new_level) + { forward_to_level(new_level); - return l_incl == new_level ? FIX_VALUE : assignment::None; + + const bool level_matches = l_incl == new_level; + l_match |= level_matches; + + return level_matches ? FIX_VALUE : assignment::None; } public: - bool has_level_incl() { - return alg_level <= l_incl || ls.can_pull(); + /// \brief Whether the manager has a next level (including the current) + bool has_level_incl() + { + return l_incl <= zdd::MAX_LABEL && alg_level <= l_incl; } + /// \brief Get the current level (including the current algorithm level) zdd::label_t level_incl() { return l_incl; } - bool has_level_excl() { - return alg_level < l_incl || has_excl || ls.can_pull(); + /// \brief Whether the manager has a level ahead of the current + bool has_level_excl() + { + return (l_incl <= zdd::MAX_LABEL && alg_level < l_incl) || l_excl <= zdd::MAX_LABEL; } + /// \brief Get the next level (excluding the current one) zdd::label_t level_excl() { if (alg_level < l_incl) { return l_incl; } - - if (!has_excl) { - l_excl = ls.pull(); - has_excl = true; - } - return l_excl; } }; @@ -100,17 +110,24 @@ namespace adiar { return zdd_terminal(terminal_val); } }; - __zdd zdd_offset(const zdd &dd, const shared_file &l) + __zdd zdd_offset(const zdd &A, const std::function &xs) { - if (l->size() == 0 - || is_terminal(dd) - || internal::disjoint_levels, - internal::file_stream>(l, dd)) { - return dd; - } + // Both { Ø }, and Ø cannot have more variables removed + if (is_terminal(A)) { return A; } + + zdd_subset_labels amgr(xs); + + // Empty set of variables in `xs`? + if (!amgr.has_level_incl()) { return A; } + + // Run Substitute sweep + __zdd res = internal::substitute>>(A, amgr); - zdd_subset_label_assignment amgr(l); - return internal::substitute>>(dd, amgr); + // Skip Reduce if no level of `xs` matched with any in `A`. + if (!amgr.l_match) { + return A; + } + return res; } ////////////////////////////////////////////////////////////////////////////// @@ -148,6 +165,7 @@ namespace adiar return internal::substitute_rec_skipto { zdd::ptr_t(false) }; } } + return internal::substitute_rec_output { zdd::node_t(n.uid(), zdd::ptr_t(false), n.high()) }; } @@ -158,15 +176,29 @@ namespace adiar } }; - __zdd zdd_onset(const zdd &dd, const shared_file &l) + __zdd zdd_onset(const zdd &A, const std::function &xs) { - if (l->size() == 0 || (is_false(dd))) { return dd; } - if ((is_true(dd)) || internal::disjoint_levels, - internal::file_stream>(l, dd)) { + if (is_false(A)) { return A; } + + zdd_subset_labels amgr(xs); + + // Empty set of variables in `xs`? + if (!amgr.has_level_incl()) { + return A; + } + + // If `A` is { Ø } and `xs` is non-empty, then it trivially collapses to Ø. + if (is_true(A)) { return zdd_empty(); } - zdd_subset_label_assignment amgr(l); - return internal::substitute>>(dd, amgr); + // Run Substitute sweep + __zdd res = internal::substitute>>(A, amgr); + + // Skip Reduce no levels of `xs` matched with one from `A`. + if (!amgr.l_match) { + return zdd_empty(); + } + return res; } } diff --git a/test/adiar/zdd/test_subset.cpp b/test/adiar/zdd/test_subset.cpp index 2351bb5c9..1b803f132 100644 --- a/test/adiar/zdd/test_subset.cpp +++ b/test/adiar/zdd/test_subset.cpp @@ -68,45 +68,34 @@ go_bandit([]() { w << n2_4 << n2_3 << n2_2 << n2_1; } - describe("zdd_offset", [&]() { - it("should return input unchanged when given Ø", [&]() { - adiar::shared_file labels; + describe("zdd_offset(A, vars)", [&]() { + // TODO + }); - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 21 << 42; - } + describe("zdd_offset(A, begin, end)", [&]() { + it("should return input unchanged when given Ø", [&]() { + std::vector labels = { 21, 42 }; - __zdd out = zdd_offset(zdd_F, labels); + __zdd out = zdd_offset(zdd_F, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("should return input unchanged when given { Ø }", [&]() { - adiar::shared_file labels; + std::vector labels = { 7, 42 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 7 << 42; - } - - __zdd out = zdd_offset(zdd_T, labels); + __zdd out = zdd_offset(zdd_T, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("should return input unchanged when given empty set of labels", [&]() { - adiar::shared_file labels; + std::vector labels = { }; - __zdd out = zdd_offset(zdd_1, labels); + __zdd out = zdd_offset(zdd_1, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(zdd_1)); }); it("should return input unchanged when given { { 2 }, { 1,2 } } without (0,3,4,5,6)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 3 << 4 << 5 << 6; - } + std::vector labels = { 0, 3, 4, 5, 6 }; shared_levelized_file in; @@ -116,17 +105,12 @@ go_bandit([]() { << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); } - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(in)); }); it("should return { Ø } when given { Ø, { 1,2 } } without (0,2)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 2; - } + std::vector labels = { 0, 2 }; shared_levelized_file in; @@ -138,7 +122,7 @@ go_bandit([]() { nw << n2 << n1; } - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().False()); @@ -165,12 +149,7 @@ go_bandit([]() { }); it("should return { Ø, { 1 } } when given { Ø, { 1 }, { 2 }, { 1, 2 } } without (0,2)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 2; - } + std::vector labels = { 0, 2 }; shared_levelized_file in; @@ -182,7 +161,7 @@ go_bandit([]() { nw << n2 << n1; } - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().False()); @@ -209,12 +188,7 @@ go_bandit([]() { }); it("should return { Ø, { 2 } } when given { Ø, { 1 }, { 2 }, { 1, 2 } } without (1,3)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1 << 3; - } + std::vector labels = { 1, 3}; shared_levelized_file in; @@ -226,7 +200,7 @@ go_bandit([]() { nw << n2 << n1; } - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().False()); @@ -253,14 +227,9 @@ go_bandit([]() { }); it("should skip root of [1] without (0,42)", [&]() { - adiar::shared_file labels; + std::vector labels = { 0, 42 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 42; - } - - __zdd out = zdd_offset(zdd_1, labels); + __zdd out = zdd_offset(zdd_1, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -322,14 +291,9 @@ go_bandit([]() { }); it("should skip 'dead' nodes in [1] without (1)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } + std::vector labels = { 1 }; - __zdd out = zdd_offset(zdd_1, labels); + __zdd out = zdd_offset(zdd_1, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -376,14 +340,9 @@ go_bandit([]() { }); it("should restrict to a terminal in [1] without (0,1,3)", [&]() { - adiar::shared_file labels; + std::vector labels = { 0, 1, 3 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 1 << 3; - } - - __zdd out = zdd_offset(zdd_1, labels); + __zdd out = zdd_offset(zdd_1, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -422,14 +381,9 @@ go_bandit([]() { << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), terminal_T); } - adiar::shared_file labels; + std::vector labels = { 1,2 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1 << 2; - } - - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -465,14 +419,9 @@ go_bandit([]() { << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); } - adiar::shared_file labels; + std::vector labels = { 1 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } - - __zdd out = zdd_offset(in, labels); + __zdd out = zdd_offset(in, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -493,14 +442,9 @@ go_bandit([]() { }); it("should bridge levels in [2] on (3)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 3; - } + std::vector labels = { 3 }; - __zdd out = zdd_offset(zdd_2, labels); + __zdd out = zdd_offset(zdd_2, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -547,42 +491,35 @@ go_bandit([]() { }); }); - describe("zdd_onset", [&]() { - it("should return input unchanged when given Ø", [&]() { - adiar::shared_file labels; + describe("zdd_onset(A, vars)", [&]() { + }); - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 21 << 42; - } + describe("zdd_onset(A, begin, end)", [&]() { + it("should return input unchanged when given Ø", [&]() { + std::vector labels = { 21, 42 }; - __zdd out = zdd_onset(zdd_F, labels); + __zdd out = zdd_onset(zdd_F, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("should return input unchanged when given { Ø } for ()", [&]() { - adiar::shared_file labels; + std::vector labels = { }; - __zdd out = zdd_onset(zdd_T, labels); + __zdd out = zdd_onset(zdd_T, labels.begin(), labels.end()); AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("should return input unchanged when given [1] for ()", [&]() { - adiar::shared_file labels; + std::vector labels = { }; - __zdd out = zdd_onset(zdd_1, labels); - AssertThat(out.get>(), Is().EqualTo(zdd_1)); - }); + __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); + AssertThat(out.get>(), Is().EqualTo(zdd_1)); + }); it("should return Ø when given { Ø } for (0)", [&]() { - adiar::shared_file labels; + std::vector labels = { 0 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0; - } - - __zdd out = zdd_onset(zdd_T, labels); + __zdd out = zdd_onset(zdd_T, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -603,14 +540,9 @@ go_bandit([]() { }); it("should return Ø when given { Ø } for (21,42)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 21 << 42; - } + std::vector labels = { 21, 42 }; - __zdd out = zdd_onset(zdd_T, labels); + __zdd out = zdd_onset(zdd_T, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -631,32 +563,27 @@ go_bandit([]() { }); it("should return Ø when given disjoint labels", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 5 << 6; - } + std::vector labels = { 5, 6 }; - __zdd out = zdd_onset(zdd_1, labels); + __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); - node_test_stream out_nodes(out); + node_test_stream out_nodes(out); - AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(false))); - AssertThat(out_nodes.can_pull(), Is().False()); + AssertThat(out_nodes.can_pull(), Is().True()); + AssertThat(out_nodes.pull(), Is().EqualTo(node(false))); + AssertThat(out_nodes.can_pull(), Is().False()); - level_info_test_stream meta_arcs(out); - AssertThat(meta_arcs.can_pull(), Is().False()); + level_info_test_stream meta_arcs(out); + AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); - }); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + }); it("should return { { 0 } } when given { Ø, { 0 } } for (0)", [&]() { shared_levelized_file in; @@ -668,14 +595,9 @@ go_bandit([]() { w << n; } - adiar::shared_file labels; + std::vector labels = { 0 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0; - } - - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().False()); @@ -709,14 +631,10 @@ go_bandit([]() { w << node(0, node::MAX_ID, terminal_T, terminal_T); } - adiar::shared_file labels; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 1; - } + std::vector labels = { 0, 1 }; - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -739,14 +657,9 @@ go_bandit([]() { it("should return { Ø } in [2] for (0,2,3)", [&]() { // One would normally expect this to return { Ø }, but for zdd_onset // this is not the case! - adiar::shared_file labels; + std::vector labels = { 0, 2, 3 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 2 << 3; - } - - __zdd out = zdd_onset(zdd_2, labels); + __zdd out = zdd_onset(zdd_2, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -800,14 +713,9 @@ go_bandit([]() { // Yet, it can still skip the bottom-most node (4) as it has not yet // output in-going arcs. - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0 << 2 << 3 << 4; - } + std::vector labels = { 0, 2, 3, 4 }; - __zdd out = zdd_onset(zdd_2, labels); + __zdd out = zdd_onset(zdd_2, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -845,14 +753,9 @@ go_bandit([]() { }); it("should keep root of [1] but shortcut its low for (0)", [&]() { - adiar::shared_file labels; + std::vector labels = { 0 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 0; - } - - __zdd out = zdd_onset(zdd_1, labels); + __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -923,14 +826,9 @@ go_bandit([]() { }); it("should skip 'dead' nodes of [1] for (1,2)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1 << 2; - } + std::vector labels = { 1, 2 }; - __zdd out = zdd_onset(zdd_1, labels); + __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -1012,14 +910,9 @@ go_bandit([]() { << node(0, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); } - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } + std::vector labels = { 1 }; - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); node_test_stream out_nodes(out); @@ -1060,14 +953,9 @@ go_bandit([]() { w << n3 << n2 << n1; } - adiar::shared_file labels; + std::vector labels = { 1 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } - - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -1134,14 +1022,9 @@ go_bandit([]() { w << n3 << n2 << n1; } - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } + std::vector labels = { 1 }; - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); @@ -1178,14 +1061,9 @@ go_bandit([]() { }); it("should falsify early terminals in [2] for (3)", [&]() { - adiar::shared_file labels; + std::vector labels = { 3 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 3; - } - - __zdd out = zdd_onset(zdd_2, labels); + __zdd out = zdd_onset(zdd_2, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -1241,14 +1119,9 @@ go_bandit([]() { }); it("should skip root in [2] due to cut on high edge for (1,3)", [&]() { - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1; - } + std::vector labels = { 1 }; - __zdd out = zdd_onset(zdd_2, labels); + __zdd out = zdd_onset(zdd_2, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -1295,14 +1168,9 @@ go_bandit([]() { }); it("should falsify early terminal and bridge over removed node in [1] for (4)", [&]() { - adiar::shared_file labels; + std::vector labels = { 4 }; - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 4; - } - - __zdd out = zdd_onset(zdd_1, labels); + __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True()); @@ -1392,14 +1260,9 @@ go_bandit([]() { w << n6 << n5 << n4 << n3 << n2 << n1; } - adiar::shared_file labels; - - { // Garbage collect writer to free write-lock - label_writer lw(labels); - lw << 1 << 2; - } + std::vector labels = { 1, 2 }; - __zdd out = zdd_onset(in, labels); + __zdd out = zdd_onset(in, labels.begin(), labels.end()); arc_test_stream arcs(out); AssertThat(arcs.can_pull_internal(), Is().True());