7 #ifndef GRAPHGEN_FIND_OPTIMAL_DRAG_H_
8 #define GRAPHGEN_FIND_OPTIMAL_DRAG_H_
13 #include <unordered_set>
23 std::vector<BinaryDrag<conact>::node*>
lma_;
24 std::unordered_set<BinaryDrag<conact>::node*>
visited_;
48 if (n->data.action.count() > 1) {
75 std::cout <<
"\r" << std::setfill(
' ') << std::setw(3) <<
counter_ / 79626 <<
"%";
81 if (cur_leaf ==
lma_.size()) {
89 auto action_bs =
lma_[cur_leaf]->data.action;
90 auto actions =
lma_[cur_leaf]->data.actions();
92 for (
size_t i = 0; i < actions.size(); ++i) {
94 bs.set(actions[i] - 1);
95 lma_[cur_leaf]->data.action = bs;
98 lma_[cur_leaf]->data.action = action_bs;
node * GetRoot() const
Returns the last root of the BinaryDrag.
void enqueue_work(F &&f, Args &&... args)
BinaryDrag< conact > best_tree_
void GetLeavesWithMultipleActionsRec(BinaryDrag< conact >::node *n)
std::mutex best_tree_mutex_
void GenerateAllTreesRec(int cur_leaf)
std::vector< BinaryDrag< conact >::node * > lma_
void ReduceAndUpdateBest(BinaryDrag< conact > t)
FindOptimalDrag(BinaryDrag< conact > t)
std::unordered_set< BinaryDrag< conact >::node * > visited_
This class allows to "remove" equal subtrees from a BinaryDrag.