40namespace steiner_tree {
76 if ((*it).cut.size() < (*bestIt).cut.size()) {
94 node w = adj->twinNode();
102 td.cutIterators[adj] =
td.cut.pushBack(adj);
109 node w = adj->twinNode();
111 auto&
cutAdjIt =
td.cutIterators[adj->twin()];
123 if (!(*it).inCut[w]) {
132 for (
auto ref : (*it).references) {
164 T cost = std::numeric_limits<T>::max();
205 for (
node t : terminals) {
279 edge uv =
network.newEdge(copy[e->source()], copy[e->target()]);
280 edge vu =
network.newEdge(copy[e->target()], copy[e->source()]);
299 lbNodes[v] += distance[copy[v]];
311 for (
node t : terminals) {
320 lbNodes[v] += distance[copy[v]];
324 lbArcs[a] += distance[a->source()];
339 for (
node root : terminals) {
361 for (
node root : terminals) {
364 compute(graph, terminals, root, nodes, edges);
Declaration of class EdgeWeightedGraph.
Compare floating point numbers with epsilons and integral numbers with normal compare operators.
Class for adjacency list elements.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
node theNode() const
Returns the node whose adjacency list contains this element.
Dynamic arrays indexed with adjacency entries.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Dijkstra's single source shortest path algorithm.
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false, bool arcsReversed=false, node target=nullptr, T maxLength=std::numeric_limits< T >::max())
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
Dynamic arrays indexed with edges.
Class for the representation of edges.
T weight(const edge e) const
std::enable_if< std::is_integral< T >::value, bool >::type leq(const T &x, const T &y) const
Compare if x is LEQ than y for integral types.
std::enable_if< std::is_integral< T >::value, bool >::type geq(const T &x, const T &y) const
Compare if x is GEQ to y for integral types.
std::enable_if< std::is_integral< T >::value, bool >::type equal(const T &x, const T &y) const
Compare if x is EQUAL to y for integral types.
Data type for general directed graphs (adjacency list representation).
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
Encapsulates a pointer to a list element.
const_reference front() const
Returns a const reference to the first element.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
Implementation of a dual-ascent-based lower bound heuristic for Steiner tree problems.
T call(const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
Calls the algorithm and returns the lower bound.
void setRepetitions(int num)
Sets the number of repeated calls to the lower bound algorithm (runs with different roots)
void compute(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root, NodeArray< T > &lbNodes, EdgeArray< T > &lbEdges)
void call(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, NodeArray< T > &lbNodes, EdgeArray< T > &lbEdges)
Compute the lower bounds under the assumption nodes or edges are included in the solution.
T compute(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root)
Computes lower bounds for minimum Steiner tree instances.
AdjEntryArray< T > m_reducedCost
void compute()
Computes the lower bound.
bool addNode(ListIterator< TerminalData > &it, node t)
Adds a node to the cut and add neighbors recursively.
T findCheapestCutArcCost(const TerminalData &td) const
Finds the cheapest arc in cut and returns its cost.
const EdgeWeightedGraph< T > & m_graph
T reducedCost(adjEntry adj) const
Returns the reduced cost of the arc given by adj.
void removeTerminalData(ListIterator< TerminalData > it)
bool addNodeChecked(ListIterator< TerminalData > &it, node w)
ListIterator< TerminalData > chooseTerminal()
Finds the terminal with the smallest cut arc set (of the last iteration)
LowerBoundDualAscent(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, double eps=1e-6)
Initializes the algorithm (and takes the first terminal as root)
LowerBoundDualAscent(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root, double eps=1e-6)
Initializes the algorithm.
NodeArray< List< ListIterator< TerminalData > > > m_inTerminalCut
Mapping of nodes to the cuts they are in.
void extendCut(adjEntry adj)
Assumes that the reduced cost of arc adj is zeroed and hence updates (in relevant cuts) the set of ar...
void update(TerminalData &td, T delta)
Updates reduced costs and cut data.
List< TerminalData > m_terminals
T get() const
Returns the lower bound.
Implementation of Dijkstra's single source shortest path algorithm.
bool isConnected(const Graph &G)
Returns true iff G is connected.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
The namespace for all OGDF objects.
ArrayBuffer< TerminalDataReference > references
TerminalData(const EdgeWeightedGraph< T > &graph, node t)
AdjEntryArray< ListIterator< adjEntry > > cutIterators
ListIterator< ListIterator< TerminalData > > it