Newer
Older
#include <cstdint>
#include <vector>
#pragma once
#include <gp-bnb/graph.hpp>
#include <gp-bnb/edmonds_karp.hpp>
#include <gp-bnb/incremental_bfs.hpp>
#include <gp-bnb/greedy_packing.hpp>
enum class lb : char { ek, ibfs, pr, gp, none };
// Represents the current path throught the search tree.
struct trail_state {
private:
struct decision {
// Index of node that is assigned at a certain level of the search tree.
// Next alternative (or none if no alternative exists).
subgraph alt;
};
public:
// Extends the current path by adding another node.
// Reduces the current path by removing the last node.
void pop();
return stack_[n].alt;
}
private:
// Decision stack.
std::vector<decision> stack_;
};
// Main solver structure. Puts everything together.
// Read-only access to the nodes.
const graph &nodes() const {
}
// Read-only access to the optimal solution.
unsigned int get_lower();
// Expand a search tree node, i.e., assigns an node to a partition and update all data structures.
// Performs backtracking after the solver ran into a dead end,
// i.e., the current branch has been pruned.
void backtrack();
// Solves the gp problem and prints the solution.
void solve();
private:
subgraph next_possible_subgraph(node_id node, subgraph sg);
std::vector<node_id> current_sources_;
std::vector<node_id> current_sinks_;
// Value of best solution seen so far.
std::vector<subgraph> best_solution_;
unsigned int best_objective_ = 0;
};
} // namespace gp_bnb