0
3
0
... | ... |
@@ -32,15 +32,15 @@ |
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 |
/// \tparam V The |
|
38 |
/// \tparam V The number type used for flow amounts, capacity bounds |
|
39 | 39 |
/// and supply values. By default it is \c int. |
40 |
/// \tparam C The |
|
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; |
... | ... |
@@ -72,18 +72,18 @@ |
72 | 72 |
/// Most of the parameters of the problem (except for the digraph) |
73 | 73 |
/// can be given using separate functions, and the algorithm can be |
74 | 74 |
/// executed using the \ref run() function. If some parameters are not |
75 | 75 |
/// specified, then default values will be used. |
76 | 76 |
/// |
77 | 77 |
/// \tparam GR The digraph type the algorithm runs on. |
78 |
/// \tparam V The |
|
78 |
/// \tparam V The number type used for flow amounts, capacity bounds |
|
79 | 79 |
/// and supply values in the algorithm. By default it is \c int. |
80 |
/// \tparam C The |
|
80 |
/// \tparam C The number type used for costs and potentials in the |
|
81 | 81 |
/// algorithm. By default it is the same as \c V. |
82 | 82 |
/// |
83 |
/// \warning Both |
|
83 |
/// \warning Both number types must be signed and all input data must |
|
84 | 84 |
/// be integer. |
85 | 85 |
/// \warning This algorithm does not support negative costs for such |
86 | 86 |
/// arcs that have infinite upper bound. |
87 | 87 |
#ifdef DOXYGEN |
88 | 88 |
template <typename GR, typename V, typename C, typename TR> |
89 | 89 |
#else |
... | ... |
@@ -119,13 +119,13 @@ |
119 | 119 |
/// The problem has optimal solution (i.e. it is feasible and |
120 | 120 |
/// bounded), and the algorithm has found optimal flow and node |
121 | 121 |
/// potentials (primal and dual solutions). |
122 | 122 |
OPTIMAL, |
123 | 123 |
/// The digraph contains an arc of negative cost and infinite |
124 | 124 |
/// upper bound. It means that the objective function is unbounded |
125 |
/// on that arc, however note that it could actually be bounded |
|
125 |
/// on that arc, however, note that it could actually be bounded |
|
126 | 126 |
/// over the feasible flows, but this algroithm cannot handle |
127 | 127 |
/// these cases. |
128 | 128 |
UNBOUNDED |
129 | 129 |
}; |
130 | 130 |
|
131 | 131 |
private: |
... | ... |
@@ -304,13 +304,13 @@ |
304 | 304 |
CapacityScaling(const GR& graph) : |
305 | 305 |
_graph(graph), _node_id(graph), _arc_idf(graph), _arc_idb(graph), |
306 | 306 |
INF(std::numeric_limits<Value>::has_infinity ? |
307 | 307 |
std::numeric_limits<Value>::infinity() : |
308 | 308 |
std::numeric_limits<Value>::max()) |
309 | 309 |
{ |
310 |
// Check the |
|
310 |
// Check the number types |
|
311 | 311 |
LEMON_ASSERT(std::numeric_limits<Value>::is_signed, |
312 | 312 |
"The flow type of CapacityScaling must be signed"); |
313 | 313 |
LEMON_ASSERT(std::numeric_limits<Cost>::is_signed, |
314 | 314 |
"The cost type of CapacityScaling must be signed"); |
315 | 315 |
|
316 | 316 |
// Resize vectors |
... | ... |
@@ -408,13 +408,13 @@ |
408 | 408 |
|
409 | 409 |
/// \brief Set the upper bounds (capacities) on the arcs. |
410 | 410 |
/// |
411 | 411 |
/// This function sets the upper bounds (capacities) on the arcs. |
412 | 412 |
/// If it is not used before calling \ref run(), the upper bounds |
413 | 413 |
/// will be set to \ref INF on all arcs (i.e. the flow value will be |
414 |
/// unbounded from above |
|
414 |
/// unbounded from above). |
|
415 | 415 |
/// |
416 | 416 |
/// \param map An arc map storing the upper bounds. |
417 | 417 |
/// Its \c Value type must be convertible to the \c Value type |
418 | 418 |
/// of the algorithm. |
419 | 419 |
/// |
420 | 420 |
/// \return <tt>(*this)</tt> |
... | ... |
@@ -511,26 +511,26 @@ |
511 | 511 |
/// \endcode |
512 | 512 |
/// |
513 | 513 |
/// This function can be called more than once. All the parameters |
514 | 514 |
/// that have been given are kept for the next call, unless |
515 | 515 |
/// \ref reset() is called, thus only the modified parameters |
516 | 516 |
/// have to be set again. See \ref reset() for examples. |
517 |
/// However the underlying digraph must not be modified after this |
|
517 |
/// However, the underlying digraph must not be modified after this |
|
518 | 518 |
/// class have been constructed, since it copies and extends the graph. |
519 | 519 |
/// |
520 | 520 |
/// \param factor The capacity scaling factor. It must be larger than |
521 | 521 |
/// one to use scaling. If it is less or equal to one, then scaling |
522 | 522 |
/// will be disabled. |
523 | 523 |
/// |
524 | 524 |
/// \return \c INFEASIBLE if no feasible flow exists, |
525 | 525 |
/// \n \c OPTIMAL if the problem has optimal solution |
526 | 526 |
/// (i.e. it is feasible and bounded), and the algorithm has found |
527 | 527 |
/// optimal flow and node potentials (primal and dual solutions), |
528 | 528 |
/// \n \c UNBOUNDED if the digraph contains an arc of negative cost |
529 | 529 |
/// and infinite upper bound. It means that the objective function |
530 |
/// is unbounded on that arc, however note that it could actually be |
|
530 |
/// is unbounded on that arc, however, note that it could actually be |
|
531 | 531 |
/// bounded over the feasible flows, but this algroithm cannot handle |
532 | 532 |
/// these cases. |
533 | 533 |
/// |
534 | 534 |
/// \see ProblemType |
535 | 535 |
ProblemType run(int factor = 4) { |
536 | 536 |
_factor = factor; |
... | ... |
@@ -37,15 +37,15 @@ |
37 | 37 |
namespace lemon { |
38 | 38 |
|
39 | 39 |
/// \brief Default traits class of CostScaling algorithm. |
40 | 40 |
/// |
41 | 41 |
/// Default traits class of CostScaling algorithm. |
42 | 42 |
/// \tparam GR Digraph type. |
43 |
/// \tparam V The |
|
43 |
/// \tparam V The number type used for flow amounts, capacity bounds |
|
44 | 44 |
/// and supply values. By default it is \c int. |
45 |
/// \tparam C The |
|
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 > |
... | ... |
@@ -98,18 +98,18 @@ |
98 | 98 |
/// Most of the parameters of the problem (except for the digraph) |
99 | 99 |
/// can be given using separate functions, and the algorithm can be |
100 | 100 |
/// executed using the \ref run() function. If some parameters are not |
101 | 101 |
/// specified, then default values will be used. |
102 | 102 |
/// |
103 | 103 |
/// \tparam GR The digraph type the algorithm runs on. |
104 |
/// \tparam V The |
|
104 |
/// \tparam V The number type used for flow amounts, capacity bounds |
|
105 | 105 |
/// and supply values in the algorithm. By default it is \c int. |
106 |
/// \tparam C The |
|
106 |
/// \tparam C The number type used for costs and potentials in the |
|
107 | 107 |
/// algorithm. By default it is the same as \c V. |
108 | 108 |
/// |
109 |
/// \warning Both |
|
109 |
/// \warning Both number types must be signed and all input data must |
|
110 | 110 |
/// be integer. |
111 | 111 |
/// \warning This algorithm does not support negative costs for such |
112 | 112 |
/// arcs that have infinite upper bound. |
113 | 113 |
/// |
114 | 114 |
/// \note %CostScaling provides three different internal methods, |
115 | 115 |
/// from which the most efficient one is used by default. |
... | ... |
@@ -154,13 +154,13 @@ |
154 | 154 |
/// The problem has optimal solution (i.e. it is feasible and |
155 | 155 |
/// bounded), and the algorithm has found optimal flow and node |
156 | 156 |
/// potentials (primal and dual solutions). |
157 | 157 |
OPTIMAL, |
158 | 158 |
/// The digraph contains an arc of negative cost and infinite |
159 | 159 |
/// upper bound. It means that the objective function is unbounded |
160 |
/// on that arc, however note that it could actually be bounded |
|
160 |
/// on that arc, however, note that it could actually be bounded |
|
161 | 161 |
/// over the feasible flows, but this algroithm cannot handle |
162 | 162 |
/// these cases. |
163 | 163 |
UNBOUNDED |
164 | 164 |
}; |
165 | 165 |
|
166 | 166 |
/// \brief Constants for selecting the internal method. |
... | ... |
@@ -322,13 +322,13 @@ |
322 | 322 |
_graph(graph), _node_id(graph), _arc_idf(graph), _arc_idb(graph), |
323 | 323 |
_cost_map(_cost_vec), _pi_map(_pi), |
324 | 324 |
INF(std::numeric_limits<Value>::has_infinity ? |
325 | 325 |
std::numeric_limits<Value>::infinity() : |
326 | 326 |
std::numeric_limits<Value>::max()) |
327 | 327 |
{ |
328 |
// Check the |
|
328 |
// Check the number types |
|
329 | 329 |
LEMON_ASSERT(std::numeric_limits<Value>::is_signed, |
330 | 330 |
"The flow type of CostScaling must be signed"); |
331 | 331 |
LEMON_ASSERT(std::numeric_limits<Cost>::is_signed, |
332 | 332 |
"The cost type of CostScaling must be signed"); |
333 | 333 |
|
334 | 334 |
// Resize vectors |
... | ... |
@@ -430,13 +430,13 @@ |
430 | 430 |
|
431 | 431 |
/// \brief Set the upper bounds (capacities) on the arcs. |
432 | 432 |
/// |
433 | 433 |
/// This function sets the upper bounds (capacities) on the arcs. |
434 | 434 |
/// If it is not used before calling \ref run(), the upper bounds |
435 | 435 |
/// will be set to \ref INF on all arcs (i.e. the flow value will be |
436 |
/// unbounded from above |
|
436 |
/// unbounded from above). |
|
437 | 437 |
/// |
438 | 438 |
/// \param map An arc map storing the upper bounds. |
439 | 439 |
/// Its \c Value type must be convertible to the \c Value type |
440 | 440 |
/// of the algorithm. |
441 | 441 |
/// |
442 | 442 |
/// \return <tt>(*this)</tt> |
... | ... |
@@ -546,13 +546,13 @@ |
546 | 546 |
/// \return \c INFEASIBLE if no feasible flow exists, |
547 | 547 |
/// \n \c OPTIMAL if the problem has optimal solution |
548 | 548 |
/// (i.e. it is feasible and bounded), and the algorithm has found |
549 | 549 |
/// optimal flow and node potentials (primal and dual solutions), |
550 | 550 |
/// \n \c UNBOUNDED if the digraph contains an arc of negative cost |
551 | 551 |
/// and infinite upper bound. It means that the objective function |
552 |
/// is unbounded on that arc, however note that it could actually be |
|
552 |
/// is unbounded on that arc, however, note that it could actually be |
|
553 | 553 |
/// bounded over the feasible flows, but this algroithm cannot handle |
554 | 554 |
/// these cases. |
555 | 555 |
/// |
556 | 556 |
/// \see ProblemType, Method |
557 | 557 |
ProblemType run(Method method = PARTIAL_AUGMENT, int factor = 8) { |
558 | 558 |
_alpha = factor; |
... | ... |
@@ -568,13 +568,13 @@ |
568 | 568 |
/// before using functions \ref lowerMap(), \ref upperMap(), |
569 | 569 |
/// \ref costMap(), \ref supplyMap(), \ref stSupply(). |
570 | 570 |
/// |
571 | 571 |
/// It is useful for multiple run() calls. If this function is not |
572 | 572 |
/// used, all the parameters given before are kept for the next |
573 | 573 |
/// \ref run() call. |
574 |
/// However the underlying digraph must not be modified after this |
|
574 |
/// However, the underlying digraph must not be modified after this |
|
575 | 575 |
/// class have been constructed, since it copies and extends the graph. |
576 | 576 |
/// |
577 | 577 |
/// For example, |
578 | 578 |
/// \code |
579 | 579 |
/// CostScaling<ListDigraph> cs(graph); |
580 | 580 |
/// |
... | ... |
@@ -40,33 +40,33 @@ |
40 | 40 |
/// for finding a \ref min_cost_flow "minimum cost flow". |
41 | 41 |
/// |
42 | 42 |
/// \ref NetworkSimplex implements the primal Network Simplex algorithm |
43 | 43 |
/// for finding a \ref min_cost_flow "minimum cost flow" |
44 | 44 |
/// \ref amo93networkflows, \ref dantzig63linearprog, |
45 | 45 |
/// \ref kellyoneill91netsimplex. |
46 |
/// This algorithm is a specialized version of the linear programming |
|
47 |
/// simplex method directly for the minimum cost flow problem. |
|
48 |
/// |
|
46 |
/// This algorithm is a highly efficient specialized version of the |
|
47 |
/// linear programming simplex method directly for the minimum cost |
|
48 |
/// flow problem. |
|
49 | 49 |
/// |
50 |
/// In general this class is the fastest implementation available |
|
51 |
/// in LEMON for the minimum cost flow problem. |
|
52 |
/// |
|
50 |
/// In general, %NetworkSimplex is the fastest implementation available |
|
51 |
/// in LEMON for this problem. |
|
52 |
/// Moreover, it supports both directions of the supply/demand inequality |
|
53 | 53 |
/// constraints. For more information, see \ref SupplyType. |
54 | 54 |
/// |
55 | 55 |
/// Most of the parameters of the problem (except for the digraph) |
56 | 56 |
/// can be given using separate functions, and the algorithm can be |
57 | 57 |
/// executed using the \ref run() function. If some parameters are not |
58 | 58 |
/// specified, then default values will be used. |
59 | 59 |
/// |
60 | 60 |
/// \tparam GR The digraph type the algorithm runs on. |
61 |
/// \tparam V The |
|
61 |
/// \tparam V The number type used for flow amounts, capacity bounds |
|
62 | 62 |
/// and supply values in the algorithm. By default, it is \c int. |
63 |
/// \tparam C The |
|
63 |
/// \tparam C The number type used for costs and potentials in the |
|
64 | 64 |
/// algorithm. By default, it is the same as \c V. |
65 | 65 |
/// |
66 |
/// \warning Both |
|
66 |
/// \warning Both number types must be signed and all input data must |
|
67 | 67 |
/// be integer. |
68 | 68 |
/// |
69 | 69 |
/// \note %NetworkSimplex provides five different pivot rule |
70 | 70 |
/// implementations, from which the most efficient one is used |
71 | 71 |
/// by default. For more information, see \ref PivotRule. |
72 | 72 |
template <typename GR, typename V = int, typename C = V> |
... | ... |
@@ -123,13 +123,13 @@ |
123 | 123 |
/// |
124 | 124 |
/// \ref NetworkSimplex provides five different pivot rule |
125 | 125 |
/// implementations that significantly affect the running time |
126 | 126 |
/// of the algorithm. |
127 | 127 |
/// By default, \ref BLOCK_SEARCH "Block Search" is used, which |
128 | 128 |
/// proved to be the most efficient and the most robust on various |
129 |
/// test inputs |
|
129 |
/// test inputs. |
|
130 | 130 |
/// However, another pivot rule can be selected using the \ref run() |
131 | 131 |
/// function with the proper parameter. |
132 | 132 |
enum PivotRule { |
133 | 133 |
|
134 | 134 |
/// The \e First \e Eligible pivot rule. |
135 | 135 |
/// The next eligible arc is selected in a wraparound fashion |
... | ... |
@@ -634,13 +634,13 @@ |
634 | 634 |
NetworkSimplex(const GR& graph, bool arc_mixing = false) : |
635 | 635 |
_graph(graph), _node_id(graph), _arc_id(graph), |
636 | 636 |
MAX(std::numeric_limits<Value>::max()), |
637 | 637 |
INF(std::numeric_limits<Value>::has_infinity ? |
638 | 638 |
std::numeric_limits<Value>::infinity() : MAX) |
639 | 639 |
{ |
640 |
// Check the |
|
640 |
// Check the number types |
|
641 | 641 |
LEMON_ASSERT(std::numeric_limits<Value>::is_signed, |
642 | 642 |
"The flow type of NetworkSimplex must be signed"); |
643 | 643 |
LEMON_ASSERT(std::numeric_limits<Cost>::is_signed, |
644 | 644 |
"The cost type of NetworkSimplex must be signed"); |
645 | 645 |
|
646 | 646 |
// Resize vectors |
... | ... |
@@ -726,13 +726,13 @@ |
726 | 726 |
|
727 | 727 |
/// \brief Set the upper bounds (capacities) on the arcs. |
728 | 728 |
/// |
729 | 729 |
/// This function sets the upper bounds (capacities) on the arcs. |
730 | 730 |
/// If it is not used before calling \ref run(), the upper bounds |
731 | 731 |
/// will be set to \ref INF on all arcs (i.e. the flow value will be |
732 |
/// unbounded from above |
|
732 |
/// unbounded from above). |
|
733 | 733 |
/// |
734 | 734 |
/// \param map An arc map storing the upper bounds. |
735 | 735 |
/// Its \c Value type must be convertible to the \c Value type |
736 | 736 |
/// of the algorithm. |
737 | 737 |
/// |
738 | 738 |
/// \return <tt>(*this)</tt> |
0 comments (0 inline)