gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Add citations to the scaling MCF algorithms (#180, #184) and improve the doc of their group.
0 3 0
default
3 files changed with 12 insertions and 11 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -361,105 +361,103 @@
361 361

	
362 362
The \e maximum \e flow \e problem is to find a flow of maximum value between
363 363
a single source and a single target. Formally, there is a \f$G=(V,A)\f$
364 364
digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and
365 365
\f$s, t \in V\f$ source and target nodes.
366 366
A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the
367 367
following optimization problem.
368 368

	
369 369
\f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f]
370 370
\f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu)
371 371
    \quad \forall u\in V\setminus\{s,t\} \f]
372 372
\f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f]
373 373

	
374 374
LEMON contains several algorithms for solving maximum flow problems:
375 375
- \ref EdmondsKarp Edmonds-Karp algorithm
376 376
  \ref edmondskarp72theoretical.
377 377
- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm
378 378
  \ref goldberg88newapproach.
379 379
- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees
380 380
  \ref dinic70algorithm, \ref sleator83dynamic.
381 381
- \ref GoldbergTarjan !Preflow push-relabel algorithm with dynamic trees
382 382
  \ref goldberg88newapproach, \ref sleator83dynamic.
383 383

	
384 384
In most cases the \ref Preflow algorithm provides the
385 385
fastest method for computing a maximum flow. All implementations
386 386
also provide functions to query the minimum cut, which is the dual
387 387
problem of maximum flow.
388 388

	
389 389
\ref Circulation is a preflow push-relabel algorithm implemented directly 
390 390
for finding feasible circulations, which is a somewhat different problem,
391 391
but it is strongly related to maximum flow.
392 392
For more information, see \ref Circulation.
393 393
*/
394 394

	
395 395
/**
396 396
@defgroup min_cost_flow_algs Minimum Cost Flow Algorithms
397 397
@ingroup algs
398 398

	
399 399
\brief Algorithms for finding minimum cost flows and circulations.
400 400

	
401 401
This group contains the algorithms for finding minimum cost flows and
402 402
circulations \ref amo93networkflows. For more information about this
403 403
problem and its dual solution, see \ref min_cost_flow
404 404
"Minimum Cost Flow Problem".
405 405

	
406 406
LEMON contains several algorithms for this problem.
407 407
 - \ref NetworkSimplex Primal Network Simplex algorithm with various
408 408
   pivot strategies \ref dantzig63linearprog, \ref kellyoneill91netsimplex.
409
 - \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on
410
   cost scaling \ref goldberg90approximation, \ref goldberg97efficient,
409
 - \ref CostScaling Cost Scaling algorithm based on push/augment and
410
   relabel operations \ref goldberg90approximation, \ref goldberg97efficient,
411 411
   \ref bunnagel98efficient.
412
 - \ref CapacityScaling Successive Shortest %Path algorithm with optional
413
   capacity scaling \ref edmondskarp72theoretical.
414
 - \ref CancelAndTighten The Cancel and Tighten algorithm
415
   \ref goldberg89cyclecanceling.
416
 - \ref CycleCanceling Cycle-Canceling algorithms
417
   \ref klein67primal, \ref goldberg89cyclecanceling.
412
 - \ref CapacityScaling Capacity Scaling algorithm based on the successive
413
   shortest path method \ref edmondskarp72theoretical.
414
 - \ref CycleCanceling Cycle-Canceling algorithms, two of which are
415
   strongly polynomial \ref klein67primal, \ref goldberg89cyclecanceling.
418 416

	
419 417
In general NetworkSimplex is the most efficient implementation,
420 418
but in special cases other algorithms could be faster.
421 419
For example, if the total supply and/or capacities are rather small,
422 420
CapacityScaling is usually the fastest algorithm (without effective scaling).
423 421
*/
424 422

	
425 423
/**
426 424
@defgroup min_cut Minimum Cut Algorithms
427 425
@ingroup algs
428 426

	
429 427
\brief Algorithms for finding minimum cut in graphs.
430 428

	
431 429
This group contains the algorithms for finding minimum cut in graphs.
432 430

	
433 431
The \e minimum \e cut \e problem is to find a non-empty and non-complete
434 432
\f$X\f$ subset of the nodes with minimum overall capacity on
435 433
outgoing arcs. Formally, there is a \f$G=(V,A)\f$ digraph, a
436 434
\f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum
437 435
cut is the \f$X\f$ solution of the next optimization problem:
438 436

	
439 437
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}
440 438
    \sum_{uv\in A: u\in X, v\not\in X}cap(uv) \f]
441 439

	
442 440
LEMON contains several algorithms related to minimum cut problems:
443 441

	
444 442
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut
445 443
  in directed graphs.
446 444
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for
447 445
  calculating minimum cut in undirected graphs.
448 446
- \ref GomoryHu "Gomory-Hu tree computation" for calculating
449 447
  all-pairs minimum cut in undirected graphs.
450 448

	
451 449
If you want to find minimum cut just between two distinict nodes,
452 450
see the \ref max_flow "maximum flow problem".
453 451
*/
454 452

	
455 453
/**
456 454
@defgroup min_mean_cycle Minimum Mean Cycle Algorithms
457 455
@ingroup algs
458 456
\brief Algorithms for finding minimum mean cycles.
459 457

	
460 458
This group contains the algorithms for finding minimum mean cycles
461 459
\ref clrs01algorithms, \ref amo93networkflows.
462 460

	
463 461
The \e minimum \e mean \e cycle \e problem is to find a directed cycle
464 462
of minimum mean length (cost) in a digraph.
465 463
The mean length of a cycle is the average length of its arcs, i.e. the
Ignore white space 6 line context
... ...
@@ -21,97 +21,98 @@
21 21

	
22 22
/// \ingroup min_cost_flow_algs
23 23
///
24 24
/// \file
25 25
/// \brief Capacity Scaling algorithm for finding a minimum cost flow.
26 26

	
27 27
#include <vector>
28 28
#include <limits>
29 29
#include <lemon/core.h>
30 30
#include <lemon/bin_heap.h>
31 31

	
32 32
namespace lemon {
33 33

	
34 34
  /// \brief Default traits class of CapacityScaling algorithm.
35 35
  ///
36 36
  /// Default traits class of CapacityScaling algorithm.
37 37
  /// \tparam GR Digraph type.
38 38
  /// \tparam V The number type used for flow amounts, capacity bounds
39 39
  /// and supply values. By default it is \c int.
40 40
  /// \tparam C The number type used for costs and potentials.
41 41
  /// By default it is the same as \c V.
42 42
  template <typename GR, typename V = int, typename C = V>
43 43
  struct CapacityScalingDefaultTraits
44 44
  {
45 45
    /// The type of the digraph
46 46
    typedef GR Digraph;
47 47
    /// The type of the flow amounts, capacity bounds and supply values
48 48
    typedef V Value;
49 49
    /// The type of the arc costs
50 50
    typedef C Cost;
51 51

	
52 52
    /// \brief The type of the heap used for internal Dijkstra computations.
53 53
    ///
54 54
    /// The type of the heap used for internal Dijkstra computations.
55 55
    /// It must conform to the \ref lemon::concepts::Heap "Heap" concept,
56 56
    /// its priority type must be \c Cost and its cross reference type
57 57
    /// must be \ref RangeMap "RangeMap<int>".
58 58
    typedef BinHeap<Cost, RangeMap<int> > Heap;
59 59
  };
60 60

	
61 61
  /// \addtogroup min_cost_flow_algs
62 62
  /// @{
63 63

	
64 64
  /// \brief Implementation of the Capacity Scaling algorithm for
65 65
  /// finding a \ref min_cost_flow "minimum cost flow".
66 66
  ///
67 67
  /// \ref CapacityScaling implements the capacity scaling version
68 68
  /// of the successive shortest path algorithm for finding a
69
  /// \ref min_cost_flow "minimum cost flow". It is an efficient dual
69
  /// \ref min_cost_flow "minimum cost flow" \ref amo93networkflows,
70
  /// \ref edmondskarp72theoretical. It is an efficient dual
70 71
  /// solution method.
71 72
  ///
72 73
  /// Most of the parameters of the problem (except for the digraph)
73 74
  /// can be given using separate functions, and the algorithm can be
74 75
  /// executed using the \ref run() function. If some parameters are not
75 76
  /// specified, then default values will be used.
76 77
  ///
77 78
  /// \tparam GR The digraph type the algorithm runs on.
78 79
  /// \tparam V The number type used for flow amounts, capacity bounds
79 80
  /// and supply values in the algorithm. By default it is \c int.
80 81
  /// \tparam C The number type used for costs and potentials in the
81 82
  /// algorithm. By default it is the same as \c V.
82 83
  ///
83 84
  /// \warning Both number types must be signed and all input data must
84 85
  /// be integer.
85 86
  /// \warning This algorithm does not support negative costs for such
86 87
  /// arcs that have infinite upper bound.
87 88
#ifdef DOXYGEN
88 89
  template <typename GR, typename V, typename C, typename TR>
89 90
#else
90 91
  template < typename GR, typename V = int, typename C = V,
91 92
             typename TR = CapacityScalingDefaultTraits<GR, V, C> >
92 93
#endif
93 94
  class CapacityScaling
94 95
  {
95 96
  public:
96 97

	
97 98
    /// The type of the digraph
98 99
    typedef typename TR::Digraph Digraph;
99 100
    /// The type of the flow amounts, capacity bounds and supply values
100 101
    typedef typename TR::Value Value;
101 102
    /// The type of the arc costs
102 103
    typedef typename TR::Cost Cost;
103 104

	
104 105
    /// The type of the heap used for internal Dijkstra computations
105 106
    typedef typename TR::Heap Heap;
106 107

	
107 108
    /// The \ref CapacityScalingDefaultTraits "traits class" of the algorithm
108 109
    typedef TR Traits;
109 110

	
110 111
  public:
111 112

	
112 113
    /// \brief Problem type constants for the \c run() function.
113 114
    ///
114 115
    /// Enum type containing the problem type constants that can be
115 116
    /// returned by the \ref run() function of the algorithm.
116 117
    enum ProblemType {
117 118
      /// The problem has no feasible solution (flow).
Ignore white space 96 line context
... ...
@@ -45,98 +45,100 @@
45 45
  /// \tparam C The number type used for costs and potentials.
46 46
  /// By default it is the same as \c V.
47 47
#ifdef DOXYGEN
48 48
  template <typename GR, typename V = int, typename C = V>
49 49
#else
50 50
  template < typename GR, typename V = int, typename C = V,
51 51
             bool integer = std::numeric_limits<C>::is_integer >
52 52
#endif
53 53
  struct CostScalingDefaultTraits
54 54
  {
55 55
    /// The type of the digraph
56 56
    typedef GR Digraph;
57 57
    /// The type of the flow amounts, capacity bounds and supply values
58 58
    typedef V Value;
59 59
    /// The type of the arc costs
60 60
    typedef C Cost;
61 61

	
62 62
    /// \brief The large cost type used for internal computations
63 63
    ///
64 64
    /// The large cost type used for internal computations.
65 65
    /// It is \c long \c long if the \c Cost type is integer,
66 66
    /// otherwise it is \c double.
67 67
    /// \c Cost must be convertible to \c LargeCost.
68 68
    typedef double LargeCost;
69 69
  };
70 70

	
71 71
  // Default traits class for integer cost types
72 72
  template <typename GR, typename V, typename C>
73 73
  struct CostScalingDefaultTraits<GR, V, C, true>
74 74
  {
75 75
    typedef GR Digraph;
76 76
    typedef V Value;
77 77
    typedef C Cost;
78 78
#ifdef LEMON_HAVE_LONG_LONG
79 79
    typedef long long LargeCost;
80 80
#else
81 81
    typedef long LargeCost;
82 82
#endif
83 83
  };
84 84

	
85 85

	
86 86
  /// \addtogroup min_cost_flow_algs
87 87
  /// @{
88 88

	
89 89
  /// \brief Implementation of the Cost Scaling algorithm for
90 90
  /// finding a \ref min_cost_flow "minimum cost flow".
91 91
  ///
92 92
  /// \ref CostScaling implements a cost scaling algorithm that performs
93
  /// push/augment and relabel operations for finding a minimum cost
94
  /// flow. It is an efficient primal-dual solution method, which
93
  /// push/augment and relabel operations for finding a \ref min_cost_flow
94
  /// "minimum cost flow" \ref amo93networkflows, \ref goldberg90approximation,
95
  /// \ref goldberg97efficient, \ref bunnagel98efficient. 
96
  /// It is a highly efficient primal-dual solution method, which
95 97
  /// can be viewed as the generalization of the \ref Preflow
96 98
  /// "preflow push-relabel" algorithm for the maximum flow problem.
97 99
  ///
98 100
  /// Most of the parameters of the problem (except for the digraph)
99 101
  /// can be given using separate functions, and the algorithm can be
100 102
  /// executed using the \ref run() function. If some parameters are not
101 103
  /// specified, then default values will be used.
102 104
  ///
103 105
  /// \tparam GR The digraph type the algorithm runs on.
104 106
  /// \tparam V The number type used for flow amounts, capacity bounds
105 107
  /// and supply values in the algorithm. By default it is \c int.
106 108
  /// \tparam C The number type used for costs and potentials in the
107 109
  /// algorithm. By default it is the same as \c V.
108 110
  ///
109 111
  /// \warning Both number types must be signed and all input data must
110 112
  /// be integer.
111 113
  /// \warning This algorithm does not support negative costs for such
112 114
  /// arcs that have infinite upper bound.
113 115
  ///
114 116
  /// \note %CostScaling provides three different internal methods,
115 117
  /// from which the most efficient one is used by default.
116 118
  /// For more information, see \ref Method.
117 119
#ifdef DOXYGEN
118 120
  template <typename GR, typename V, typename C, typename TR>
119 121
#else
120 122
  template < typename GR, typename V = int, typename C = V,
121 123
             typename TR = CostScalingDefaultTraits<GR, V, C> >
122 124
#endif
123 125
  class CostScaling
124 126
  {
125 127
  public:
126 128

	
127 129
    /// The type of the digraph
128 130
    typedef typename TR::Digraph Digraph;
129 131
    /// The type of the flow amounts, capacity bounds and supply values
130 132
    typedef typename TR::Value Value;
131 133
    /// The type of the arc costs
132 134
    typedef typename TR::Cost Cost;
133 135

	
134 136
    /// \brief The large cost type
135 137
    ///
136 138
    /// The large cost type used for internal computations.
137 139
    /// Using the \ref CostScalingDefaultTraits "default traits class",
138 140
    /// it is \c long \c long if the \c Cost type is integer,
139 141
    /// otherwise it is \c double.
140 142
    typedef typename TR::LargeCost LargeCost;
141 143

	
142 144
    /// The \ref CostScalingDefaultTraits "traits class" of the algorithm
0 comments (0 inline)