# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1327962254 -3600
# Node ID f63ba40a60f442278dc74a741050b29857a6daa9
# Parent 48e17328c1551cb8196973d6056a04e40e5d624a
Improve module docs and references (#437)
diff --git a/doc/groups.dox b/doc/groups.dox
a
|
b
|
|
407 | 407 | strongly polynomial \ref klein67primal, \ref goldberg89cyclecanceling. |
408 | 408 | |
409 | 409 | In general, \ref NetworkSimplex and \ref CostScaling are the most efficient |
410 | | implementations, but the other two algorithms could be faster in special cases. |
| 410 | implementations, but the other algorithms could be faster in special cases. |
411 | 411 | For example, if the total supply and/or capacities are rather small, |
412 | 412 | \ref CapacityScaling is usually the fastest algorithm (without effective scaling). |
| 413 | |
| 414 | These classes are intended to be used with integer-valued input data |
| 415 | (capacities, supply values, and costs), except for \ref CapacityScaling, |
| 416 | which is capable of handling real-valued arc costs (other numerical |
| 417 | data are required to be integer). |
413 | 418 | */ |
414 | 419 | |
415 | 420 | /** |
… |
… |
|
448 | 453 | \brief Algorithms for finding minimum mean cycles. |
449 | 454 | |
450 | 455 | This group contains the algorithms for finding minimum mean cycles |
451 | | \ref clrs01algorithms, \ref amo93networkflows. |
| 456 | \ref amo93networkflows, \ref karp78characterization. |
452 | 457 | |
453 | 458 | The \e minimum \e mean \e cycle \e problem is to find a directed cycle |
454 | 459 | of minimum mean length (cost) in a digraph. |
… |
… |
|
464 | 469 | function. |
465 | 470 | |
466 | 471 | LEMON contains three algorithms for solving the minimum mean cycle problem: |
467 | | - \ref KarpMmc Karp's original algorithm \ref amo93networkflows, |
468 | | \ref dasdan98minmeancycle. |
| 472 | - \ref KarpMmc Karp's original algorithm \ref karp78characterization. |
469 | 473 | - \ref HartmannOrlinMmc Hartmann-Orlin's algorithm, which is an improved |
470 | | version of Karp's algorithm \ref dasdan98minmeancycle. |
| 474 | version of Karp's algorithm \ref hartmann93finding. |
471 | 475 | - \ref HowardMmc Howard's policy iteration algorithm |
472 | | \ref dasdan98minmeancycle. |
| 476 | \ref dasdan98minmeancycle, \ref dasdan04experimental. |
473 | 477 | |
474 | 478 | In practice, the \ref HowardMmc "Howard" algorithm turned out to be by far the |
475 | 479 | most efficient one, though the best known theoretical bound on its running |
diff --git a/doc/min_cost_flow.dox b/doc/min_cost_flow.dox
a
|
b
|
|
101 | 101 | sup(u) \quad \forall u\in V \f] |
102 | 102 | \f[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A \f] |
103 | 103 | |
104 | | However if the sum of the supply values is zero, then these two problems |
| 104 | However, if the sum of the supply values is zero, then these two problems |
105 | 105 | are equivalent. |
106 | 106 | The \ref min_cost_flow_algs "algorithms" in LEMON support the general |
107 | 107 | form, so if you need the equality form, you have to ensure this additional |
diff --git a/doc/references.bib b/doc/references.bib
a
|
b
|
|
4 | 4 | key = {LEMON}, |
5 | 5 | title = {{LEMON} -- {L}ibrary for {E}fficient {M}odeling and |
6 | 6 | {O}ptimization in {N}etworks}, |
7 | | howpublished = {\url{http://lemon.cs.elte.hu/}}, |
8 | | year = 2009 |
| 7 | howpublished = {\url{http://lemon.cs.elte.hu/}} |
9 | 8 | } |
10 | 9 | |
11 | 10 | @misc{egres, |
… |
… |
|
213 | 212 | pages = {309-311} |
214 | 213 | } |
215 | 214 | |
| 215 | @article{hartmann93finding, |
| 216 | author = {Mark Hartmann and James B. Orlin}, |
| 217 | title = {Finding minimum cost to time ratio cycles with small |
| 218 | integral transit times}, |
| 219 | journal = {Networks}, |
| 220 | year = 1993, |
| 221 | volume = 23, |
| 222 | pages = {567-574} |
| 223 | } |
| 224 | |
216 | 225 | @article{dasdan98minmeancycle, |
217 | 226 | author = {Ali Dasdan and Rajesh K. Gupta}, |
218 | 227 | title = {Faster Maximum and Minimum Mean Cycle Alogrithms for |
… |
… |
|
225 | 234 | pages = {889-899} |
226 | 235 | } |
227 | 236 | |
| 237 | @article{dasdan04experimental, |
| 238 | author = {Ali Dasdan}, |
| 239 | title = {Experimental analysis of the fastest optimum cycle |
| 240 | ratio and mean algorithms}, |
| 241 | journal = {ACM Trans. Des. Autom. Electron. Syst.}, |
| 242 | year = 2004, |
| 243 | volume = 9, |
| 244 | issue = 4, |
| 245 | pages = {385-418} |
| 246 | } |
| 247 | |
228 | 248 | |
229 | 249 | %%%%% Minimum cost flow algorithms %%%%% |
230 | 250 | |
diff --git a/lemon/hartmann_orlin_mmc.h b/lemon/hartmann_orlin_mmc.h
a
|
b
|
|
98 | 98 | /// |
99 | 99 | /// This class implements the Hartmann-Orlin algorithm for finding |
100 | 100 | /// a directed cycle of minimum mean cost in a digraph |
101 | | /// \ref amo93networkflows, \ref dasdan98minmeancycle. |
| 101 | /// \ref hartmann93finding, \ref dasdan98minmeancycle. |
102 | 102 | /// It is an improved version of \ref KarpMmc "Karp"'s original algorithm, |
103 | 103 | /// it applies an efficient early termination scheme. |
104 | 104 | /// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
diff --git a/lemon/howard_mmc.h b/lemon/howard_mmc.h
a
|
b
|
|
98 | 98 | /// |
99 | 99 | /// This class implements Howard's policy iteration algorithm for finding |
100 | 100 | /// a directed cycle of minimum mean cost in a digraph |
101 | | /// \ref amo93networkflows, \ref dasdan98minmeancycle. |
| 101 | /// \ref dasdan98minmeancycle, \ref dasdan04experimental. |
102 | 102 | /// This class provides the most efficient algorithm for the |
103 | 103 | /// minimum mean cycle problem, though the best known theoretical |
104 | 104 | /// bound on its running time is exponential. |
diff --git a/lemon/karp_mmc.h b/lemon/karp_mmc.h
a
|
b
|
|
98 | 98 | /// |
99 | 99 | /// This class implements Karp's algorithm for finding a directed |
100 | 100 | /// cycle of minimum mean cost in a digraph |
101 | | /// \ref amo93networkflows, \ref dasdan98minmeancycle. |
| 101 | /// \ref karp78characterization, \ref dasdan98minmeancycle. |
102 | 102 | /// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
103 | 103 | /// |
104 | 104 | /// \tparam GR The type of the digraph the algorithm runs on. |
# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1327962280 -3600
# Node ID 16f55008c8633f73db3183859734c6981a223cf4
# Parent f63ba40a60f442278dc74a741050b29857a6daa9
Doc improvements for min cost flow algorithms (#437)
diff --git a/doc/groups.dox b/doc/groups.dox
a
|
b
|
|
407 | 407 | strongly polynomial \ref klein67primal, \ref goldberg89cyclecanceling. |
408 | 408 | |
409 | 409 | In general, \ref NetworkSimplex and \ref CostScaling are the most efficient |
410 | | implementations, but the other algorithms could be faster in special cases. |
| 410 | implementations. |
| 411 | \ref NetworkSimplex is usually the fastest on relatively small graphs (up to |
| 412 | several thousands of nodes) and on dense graphs, while \ref CostScaling is |
| 413 | typically more efficient on large graphs (e.g. hundreds of thousands of |
| 414 | nodes or above), especially if they are sparse. |
| 415 | However, other algorithms could be faster in special cases. |
411 | 416 | For example, if the total supply and/or capacities are rather small, |
412 | 417 | \ref CapacityScaling is usually the fastest algorithm (without effective scaling). |
413 | 418 | |
diff --git a/lemon/capacity_scaling.h b/lemon/capacity_scaling.h
a
|
b
|
|
70 | 70 | /// \ref edmondskarp72theoretical. It is an efficient dual |
71 | 71 | /// solution method. |
72 | 72 | /// |
| 73 | /// This algorithm is typically slower than \ref CostScaling and |
| 74 | /// \ref NetworkSimplex, but in special cases, it can be more |
| 75 | /// efficient than them. |
| 76 | /// (For more information, see \ref min_cost_flow_algs "the module page".) |
| 77 | /// |
73 | 78 | /// Most of the parameters of the problem (except for the digraph) |
74 | 79 | /// can be given using separate functions, and the algorithm can be |
75 | 80 | /// executed using the \ref run() function. If some parameters are not |
… |
… |
|
676 | 681 | return _res_cap[_arc_idb[a]]; |
677 | 682 | } |
678 | 683 | |
679 | | /// \brief Return the flow map (the primal solution). |
| 684 | /// \brief Copy the flow values (the primal solution) into the |
| 685 | /// given map. |
680 | 686 | /// |
681 | 687 | /// This function copies the flow value on each arc into the given |
682 | 688 | /// map. The \c Value type of the algorithm must be convertible to |
… |
… |
|
700 | 706 | return _pi[_node_id[n]]; |
701 | 707 | } |
702 | 708 | |
703 | | /// \brief Return the potential map (the dual solution). |
| 709 | /// \brief Copy the potential values (the dual solution) into the |
| 710 | /// given map. |
704 | 711 | /// |
705 | 712 | /// This function copies the potential (dual value) of each node |
706 | 713 | /// into the given map. |
diff --git a/lemon/cost_scaling.h b/lemon/cost_scaling.h
a
|
b
|
|
98 | 98 | /// "preflow push-relabel" algorithm for the maximum flow problem. |
99 | 99 | /// |
100 | 100 | /// In general, \ref NetworkSimplex and \ref CostScaling are the fastest |
101 | | /// implementations available in LEMON for this problem. |
| 101 | /// implementations available in LEMON for solving this problem. |
| 102 | /// (For more information, see \ref min_cost_flow_algs "the module page".) |
102 | 103 | /// |
103 | 104 | /// Most of the parameters of the problem (except for the digraph) |
104 | 105 | /// can be given using separate functions, and the algorithm can be |
… |
… |
|
704 | 705 | return _res_cap[_arc_idb[a]]; |
705 | 706 | } |
706 | 707 | |
707 | | /// \brief Return the flow map (the primal solution). |
| 708 | /// \brief Copy the flow values (the primal solution) into the |
| 709 | /// given map. |
708 | 710 | /// |
709 | 711 | /// This function copies the flow value on each arc into the given |
710 | 712 | /// map. The \c Value type of the algorithm must be convertible to |
… |
… |
|
728 | 730 | return static_cast<Cost>(_pi[_node_id[n]]); |
729 | 731 | } |
730 | 732 | |
731 | | /// \brief Return the potential map (the dual solution). |
| 733 | /// \brief Copy the potential values (the dual solution) into the |
| 734 | /// given map. |
732 | 735 | /// |
733 | 736 | /// This function copies the potential (dual value) of each node |
734 | 737 | /// into the given map. |
diff --git a/lemon/cycle_canceling.h b/lemon/cycle_canceling.h
a
|
b
|
|
48 | 48 | /// algorithms for finding a \ref min_cost_flow "minimum cost flow" |
49 | 49 | /// \ref amo93networkflows, \ref klein67primal, |
50 | 50 | /// \ref goldberg89cyclecanceling. |
51 | | /// The most efficent one (both theoretically and practically) |
52 | | /// is the \ref CANCEL_AND_TIGHTEN "Cancel and Tighten" algorithm, |
53 | | /// thus it is the default method. |
54 | | /// It is strongly polynomial, but in practice, it is typically much |
55 | | /// slower than the scaling algorithms and NetworkSimplex. |
| 51 | /// The most efficent one is the \ref CANCEL_AND_TIGHTEN |
| 52 | /// "Cancel-and-Tighten" algorithm, thus it is the default method. |
| 53 | /// It runs in strongly polynomial time, but in practice, it is typically |
| 54 | /// orders of magnitude slower than the scaling algorithms and |
| 55 | /// \ref NetworkSimplex. |
| 56 | /// (For more information, see \ref min_cost_flow_algs "the module page".) |
56 | 57 | /// |
57 | 58 | /// Most of the parameters of the problem (except for the digraph) |
58 | 59 | /// can be given using separate functions, and the algorithm can be |
… |
… |
|
116 | 117 | /// for the \ref run() function. |
117 | 118 | /// |
118 | 119 | /// \ref CycleCanceling provides three different cycle-canceling |
119 | | /// methods. By default, \ref CANCEL_AND_TIGHTEN "Cancel and Tighten" |
| 120 | /// methods. By default, \ref CANCEL_AND_TIGHTEN "Cancel-and-Tighten" |
120 | 121 | /// is used, which is by far the most efficient and the most robust. |
121 | 122 | /// However, the other methods can be selected using the \ref run() |
122 | 123 | /// function with the proper parameter. |
123 | 124 | enum Method { |
124 | 125 | /// A simple cycle-canceling method, which uses the |
125 | | /// \ref BellmanFord "Bellman-Ford" algorithm with limited iteration |
126 | | /// number for detecting negative cycles in the residual network. |
| 126 | /// \ref BellmanFord "Bellman-Ford" algorithm for detecting negative |
| 127 | /// cycles in the residual network. |
| 128 | /// The number of Bellman-Ford iterations is bounded by a successively |
| 129 | /// increased limit. |
127 | 130 | SIMPLE_CYCLE_CANCELING, |
128 | 131 | /// The "Minimum Mean Cycle-Canceling" algorithm, which is a |
129 | 132 | /// well-known strongly polynomial method |
130 | 133 | /// \ref goldberg89cyclecanceling. It improves along a |
131 | 134 | /// \ref min_mean_cycle "minimum mean cycle" in each iteration. |
132 | | /// Its running time complexity is O(n<sup>2</sup>m<sup>3</sup>log(n)). |
| 135 | /// Its running time complexity is O(n<sup>2</sup>e<sup>3</sup>log(n)). |
133 | 136 | MINIMUM_MEAN_CYCLE_CANCELING, |
134 | | /// The "Cancel And Tighten" algorithm, which can be viewed as an |
| 137 | /// The "Cancel-and-Tighten" algorithm, which can be viewed as an |
135 | 138 | /// improved version of the previous method |
136 | 139 | /// \ref goldberg89cyclecanceling. |
137 | 140 | /// It is faster both in theory and in practice, its running time |
138 | | /// complexity is O(n<sup>2</sup>m<sup>2</sup>log(n)). |
| 141 | /// complexity is O(n<sup>2</sup>e<sup>2</sup>log(n)). |
139 | 142 | CANCEL_AND_TIGHTEN |
140 | 143 | }; |
141 | 144 | |
… |
… |
|
610 | 613 | return _res_cap[_arc_idb[a]]; |
611 | 614 | } |
612 | 615 | |
613 | | /// \brief Return the flow map (the primal solution). |
| 616 | /// \brief Copy the flow values (the primal solution) into the |
| 617 | /// given map. |
614 | 618 | /// |
615 | 619 | /// This function copies the flow value on each arc into the given |
616 | 620 | /// map. The \c Value type of the algorithm must be convertible to |
… |
… |
|
634 | 638 | return static_cast<Cost>(_pi[_node_id[n]]); |
635 | 639 | } |
636 | 640 | |
637 | | /// \brief Return the potential map (the dual solution). |
| 641 | /// \brief Copy the potential values (the dual solution) into the |
| 642 | /// given map. |
638 | 643 | /// |
639 | 644 | /// This function copies the potential (dual value) of each node |
640 | 645 | /// into the given map. |
… |
… |
|
954 | 959 | } |
955 | 960 | } |
956 | 961 | |
957 | | // Execute the "Cancel And Tighten" method |
| 962 | // Execute the "Cancel-and-Tighten" method |
958 | 963 | void startCancelAndTighten() { |
959 | 964 | // Constants for the min mean cycle computations |
960 | 965 | const double LIMIT_FACTOR = 1.0; |
diff --git a/lemon/network_simplex.h b/lemon/network_simplex.h
a
|
b
|
|
48 | 48 | /// flow problem. |
49 | 49 | /// |
50 | 50 | /// In general, \ref NetworkSimplex and \ref CostScaling are the fastest |
51 | | /// implementations available in LEMON for this problem. |
| 51 | /// implementations available in LEMON for solving this problem. |
| 52 | /// (For more information, see \ref min_cost_flow_algs "the module page".) |
52 | 53 | /// Furthermore, this class supports both directions of the supply/demand |
53 | 54 | /// inequality constraints. For more information, see \ref SupplyType. |
54 | 55 | /// |
… |
… |
|
1006 | 1007 | return _flow[_arc_id[a]]; |
1007 | 1008 | } |
1008 | 1009 | |
1009 | | /// \brief Return the flow map (the primal solution). |
| 1010 | /// \brief Copy the flow values (the primal solution) into the |
| 1011 | /// given map. |
1010 | 1012 | /// |
1011 | 1013 | /// This function copies the flow value on each arc into the given |
1012 | 1014 | /// map. The \c Value type of the algorithm must be convertible to |
… |
… |
|
1030 | 1032 | return _pi[_node_id[n]]; |
1031 | 1033 | } |
1032 | 1034 | |
1033 | | /// \brief Return the potential map (the dual solution). |
| 1035 | /// \brief Copy the potential values (the dual solution) into the |
| 1036 | /// given map. |
1034 | 1037 | /// |
1035 | 1038 | /// This function copies the potential (dual value) of each node |
1036 | 1039 | /// into the given map. |