Class managing LP and LP-based approximation. More...
#include <ogdf/graphalg/MinSteinerTreeGoemans139.h>
Classes | |
| class | BlowupComponents |
| Obtain and provides information about components in a given blowup graph. More... | |
| class | CoreWitness |
| Manage witness set and core edges of a blowup graph. More... | |
Public Member Functions | |
| UFCR (const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal) | |
| Initialize all attributes, sort the terminal list. More... | |
| ~UFCR () | |
| void | addCycleConstraints (bool add=true) |
| Define if we want to use cycle constraints for a stronger LP. More... | |
| void | forceAPSP (bool force=true) |
| Define if APSP shortest path algorithm should be used even if SSSP can be used. More... | |
| T | getApproximation (EdgeWeightedGraphCopy< T > *&finalSteinerTree, const std::minstd_rand &rng, const bool doPreprocessing=true) |
| Obtain an (1.39+epsilon)-approximation based on the LP solution. More... | |
| void | init (bool perturb=false) |
| Perform basic initialization algorithms: find shortest paths, find the full components, generate the LP model. More... | |
| void | setMaxComponentSize (int restricted) |
| Set the maximum full component size to generate. More... | |
| void | solve () |
| Solve the LP. More... | |
| void | use2Approximation (bool use2approx) |
| Define if we want to use a 2-approximation as bound. More... | |
Private Member Functions | |
Finding full components | |
| void | findFull2Components (SubsetEnumerator< node > &terminalSubset) |
| Find full components of size 2. More... | |
| void | findFull3Components (SubsetEnumerator< node > &terminalSubset) |
| Find full components of size 3. More... | |
| void | findFullComponents () |
| Find full components. More... | |
| bool | isValidComponent (const EdgeWeightedGraphCopy< T > &graph) |
| Check if a given (sub)graph is a valid full component. More... | |
LP model generation and separation | |
| void | generateProblem (bool perturb=false) |
| Generate the LP model. More... | |
| void | generateObjective (bool perturb) |
| Generate the LP objective. More... | |
| void | addTerminalCoverConstraint () |
| Add terminal cover constraints to the LP. More... | |
| bool | addSubsetCoverConstraint (const List< node > &subset) |
| Add subset cover constraints to the LP for a given subset of terminals. More... | |
| void | addYConstraint (const node t) |
Add constraint that the sum of x_C over all components C spanning terminal t is at least 1 to ensure y_t >= 0. More... | |
| bool | separateConnected (const ArrayBuffer< int > &activeComponents) |
| Separate to ensure that the solution is connected. More... | |
| bool | separateMinCut (const ArrayBuffer< int > &activeComponents) |
| Perform the general cut-based separation algorithm. More... | |
| bool | separateCycles (const ArrayBuffer< int > &activeComponents) |
| Perform the separation algorithm for cycle constraints (to obtain stronger LP solution) More... | |
| bool | separate () |
| Perform all available separation algorithms. More... | |
| double | generateMinCutSeparationGraph (const ArrayBuffer< int > &activeComponents, node &source, node &target, GraphCopy &G, EdgeArray< double > &capacity, int &cutsFound) |
| Generates an auxiliary multi-graph for separation (during LP solving): directed, with special source and target, without Steiner vertices of degree 2. More... | |
Preliminaries and preprocessing for the approximation algorithm | |
| void | removeInactiveComponents () |
| Remove inactive components from m_fullCompStore (since we do not need them any longer) More... | |
| void | removeComponents (ArrayBuffer< int > &ids) |
| Remove the full components with the given ids. More... | |
| void | addComponent (NodeArray< bool > &isNewTerminal, int id) |
| Add a full component to the final solution (by changing nonterminals to terminals) More... | |
| void | preprocess (NodeArray< bool > &isNewTerminal) |
| Preprocess LP solution. More... | |
The approximation algorithm | |
| void | insertShortestPathIntoBlowupGraph (EdgeWeightedGraphCopy< T > &blowupGraph, NodeArray< node > &bgOriginal, EdgeArray< int > &capacity, node s, node t, const node vC, const node wC, int cap) |
| Inserts (based on m_distance and m_predAPSP) a shortest path from a component, directed, into the blowupGraph and sets weights and capacity accordingly. More... | |
| int | generateGammoidGraph (node &source, node &target, CoreWitness &cw, EdgeWeightedGraphCopy< T > &blowupGraph, NodeArray< node > &bgOriginal, List< node > &bgTerminals, EdgeArray< int > &capacity, int &y_R) const |
| Generates a special-purpose blowup graph for gammoid computation: directed, with special source and target, with core edges (implemented as nodes) More... | |
| int | gammoidGetRank (EdgeWeightedGraphCopy< T > &blowupGraph, EdgeArray< int > &capacity, const node source, const node target) const |
| Computes the rank of the gammoid (given by the blowup graph) More... | |
| int | findComponentAndMaxBasis (List< std::pair< node, int >> *&maxBasis, EdgeWeightedGraphCopy< T > &blowupGraph, const List< node > &bgTerminals, const CoreWitness &cw, EdgeArray< int > &capacity, const BlowupComponents &gamma, const int N, const int y_R, const node source, const node target) |
| Finds the best component and its maximum-weight basis in the given blowup graph with given core and witness set. More... | |
| int | findCheapestComponentAndRemainingBasis (List< std::pair< node, int >> *&maxBasis, const CoreWitness &cw, EdgeArray< int > &capacity, const BlowupComponents &gamma) |
| For the end of the algorithm: find cheapest component and choose all remaining core edges as basis. More... | |
| void | addComponent (NodeArray< bool > &isNewTerminal, const EdgeWeightedGraphCopy< T > &blowupGraph, const NodeArray< node > &bgOriginal, const edge rootEdge) |
| Add a component of the blowup graph to the final solution (by changing nonterminals to terminals) More... | |
| void | copyComponent (EdgeWeightedGraphCopy< T > &blowupGraph, EdgeArray< int > &capacity, CoreWitness &cw, NodeArray< node > &bgOriginal, const edge origEdge, const int origCap, const int copyCap) |
Copy a component in the blowup graph and set original capacity to origCap and capacity of copy to copyCap. More... | |
| void | removeBasisAndCleanup (EdgeWeightedGraphCopy< T > &blowupGraph, BlowupComponents &gamma, node v, const node source, const node pseudotarget, const int N) |
Remove basis (given by v, a core edge node of the maximum basis) and cleanup. More... | |
| void | removeFractionalBasisAndCleanup (List< std::pair< node, int >> &basis, EdgeWeightedGraphCopy< T > &blowupGraph, NodeArray< node > &bgOriginal, EdgeArray< int > &capacity, BlowupComponents &gamma, CoreWitness &cw, const node source, const node pseudotarget, const int N) |
| Remove a given basis and cleanup, the basis may be given fractionally. More... | |
| int | updateSourceAndTargetArcCapacities (EdgeWeightedGraphCopy< T > &blowupGraph, EdgeArray< int > &capacity, const node v, const node source, const node pseudotarget, const int N) |
| Update arc capacities s->v and v->t. More... | |
| void | doGoemansApproximation (NodeArray< bool > &isNewTerminal) |
| Perform the actual approximation algorithm on the LP solution. More... | |
Private Attributes | |
| EdgeWeightedGraphCopy< T > * | m_approx2SteinerTree |
| T | m_approx2Weight |
| NodeArray< NodeArray< T > > | m_distance |
| double | m_eps |
| steiner_tree::FullComponentWithExtraStore< T, double > | m_fullCompStore |
| all enumerated full components, with solution More... | |
| const EdgeWeightedGraph< T > & | m_G |
| const NodeArray< bool > & | m_isTerminal |
| double * | m_lowerBounds |
| CoinPackedMatrix * | m_matrix |
| List< node > | m_nonterminals |
| List of non-terminals. More... | |
| double * | m_objective |
| OsiSolverInterface * | m_osiSolver |
| NodeArray< NodeArray< edge > > | m_predAPSP |
| int | m_restricted |
| std::minstd_rand | m_rng |
| bool | m_separateCycles |
| int | m_separationStage |
| bool | m_ssspDistances |
| List< node > | m_terminals |
| List of terminals. More... | |
| double * | m_upperBounds |
| Approx2State | m_use2approx |
Class managing LP and LP-based approximation.
Definition at line 162 of file MinSteinerTreeGoemans139.h.
|
inline |
Initialize all attributes, sort the terminal list.
Definition at line 1296 of file MinSteinerTreeGoemans139.h.
|
inline |
Definition at line 1322 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Add a full component to the final solution (by changing nonterminals to terminals)
Definition at line 721 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Add a component of the blowup graph to the final solution (by changing nonterminals to terminals)
Definition at line 1090 of file MinSteinerTreeGoemans139.h.
|
inline |
Define if we want to use cycle constraints for a stronger LP.
Definition at line 1396 of file MinSteinerTreeGoemans139.h.
|
private |
Add subset cover constraints to the LP for a given subset of terminals.
Definition at line 1598 of file MinSteinerTreeGoemans139.h.
|
private |
Add terminal cover constraints to the LP.
Definition at line 1637 of file MinSteinerTreeGoemans139.h.
|
private |
Add constraint that the sum of x_C over all components C spanning terminal t is at least 1 to ensure y_t >= 0.
Definition at line 1582 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Copy a component in the blowup graph and set original capacity to origCap and capacity of copy to copyCap.
Definition at line 1117 of file MinSteinerTreeGoemans139.h.
|
private |
Perform the actual approximation algorithm on the LP solution.
Definition at line 1416 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
For the end of the algorithm: find cheapest component and choose all remaining core edges as basis.
Definition at line 1066 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Finds the best component and its maximum-weight basis in the given blowup graph with given core and witness set.
Definition at line 944 of file MinSteinerTreeGoemans139.h.
|
private |
Find full components of size 2.
Definition at line 1652 of file MinSteinerTreeGoemans139.h.
|
private |
Find full components of size 3.
Definition at line 1668 of file MinSteinerTreeGoemans139.h.
|
private |
Find full components.
Definition at line 1710 of file MinSteinerTreeGoemans139.h.
|
inline |
Define if APSP shortest path algorithm should be used even if SSSP can be used.
Definition at line 1402 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Computes the rank of the gammoid (given by the blowup graph)
Definition at line 934 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Generates a special-purpose blowup graph for gammoid computation: directed, with special source and target, with core edges (implemented as nodes)
Definition at line 816 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Generates an auxiliary multi-graph for separation (during LP solving): directed, with special source and target, without Steiner vertices of degree 2.
Definition at line 613 of file MinSteinerTreeGoemans139.h.
|
private |
Generate the LP objective.
Definition at line 1564 of file MinSteinerTreeGoemans139.h.
|
private |
Generate the LP model.
Definition at line 1538 of file MinSteinerTreeGoemans139.h.
| T ogdf::MinSteinerTreeGoemans139< T >::UFCR::getApproximation | ( | EdgeWeightedGraphCopy< T > *& | finalSteinerTree, |
| const std::minstd_rand & | rng, | ||
| const bool | doPreprocessing = true |
||
| ) |
Obtain an (1.39+epsilon)-approximation based on the LP solution.
Definition at line 1492 of file MinSteinerTreeGoemans139.h.
|
inline |
Perform basic initialization algorithms: find shortest paths, find the full components, generate the LP model.
Definition at line 1332 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Inserts (based on m_distance and m_predAPSP) a shortest path from a component, directed, into the blowupGraph and sets weights and capacity accordingly.
Definition at line 788 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Check if a given (sub)graph is a valid full component.
Definition at line 562 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Preprocess LP solution.
Definition at line 730 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Remove basis (given by v, a core edge node of the maximum basis) and cleanup.
Definition at line 1157 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Remove the full components with the given ids.
Definition at line 712 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Remove a given basis and cleanup, the basis may be given fractionally.
Definition at line 1202 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Remove inactive components from m_fullCompStore (since we do not need them any longer)
Definition at line 698 of file MinSteinerTreeGoemans139.h.
|
private |
Perform all available separation algorithms.
Definition at line 1762 of file MinSteinerTreeGoemans139.h.
|
private |
Separate to ensure that the solution is connected.
Definition at line 1790 of file MinSteinerTreeGoemans139.h.
|
private |
Perform the separation algorithm for cycle constraints (to obtain stronger LP solution)
Definition at line 1881 of file MinSteinerTreeGoemans139.h.
|
private |
Perform the general cut-based separation algorithm.
Definition at line 1831 of file MinSteinerTreeGoemans139.h.
|
inline |
Set the maximum full component size to generate.
Definition at line 1384 of file MinSteinerTreeGoemans139.h.
| void ogdf::MinSteinerTreeGoemans139< T >::UFCR::solve | ( | ) |
Solve the LP.
Definition at line 1735 of file MinSteinerTreeGoemans139.h.
|
inlineprivate |
Update arc capacities s->v and v->t.
Definition at line 1246 of file MinSteinerTreeGoemans139.h.
|
inline |
Define if we want to use a 2-approximation as bound.
Definition at line 1390 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 196 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 197 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 170 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 192 of file MinSteinerTreeGoemans139.h.
|
private |
all enumerated full components, with solution
Definition at line 168 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 164 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 165 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 176 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 174 of file MinSteinerTreeGoemans139.h.
|
private |
List of non-terminals.
Definition at line 167 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 175 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 173 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 171 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 179 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 194 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 187 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 189 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 186 of file MinSteinerTreeGoemans139.h.
|
private |
List of terminals.
Definition at line 166 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 177 of file MinSteinerTreeGoemans139.h.
|
private |
Definition at line 185 of file MinSteinerTreeGoemans139.h.