0
3
0
... | ... |
@@ -314,50 +314,55 @@ |
314 | 314 |
|
315 | 315 |
This group contains the algorithms for finding maximum flows and |
316 | 316 |
feasible circulations. |
317 | 317 |
|
318 | 318 |
The \e maximum \e flow \e problem is to find a flow of maximum value between |
319 | 319 |
a single source and a single target. Formally, there is a \f$G=(V,A)\f$ |
320 | 320 |
digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and |
321 | 321 |
\f$s, t \in V\f$ source and target nodes. |
322 | 322 |
A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the |
323 | 323 |
following optimization problem. |
324 | 324 |
|
325 | 325 |
\f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f] |
326 | 326 |
\f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu) |
327 | 327 |
\quad \forall u\in V\setminus\{s,t\} \f] |
328 | 328 |
\f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] |
329 | 329 |
|
330 | 330 |
LEMON contains several algorithms for solving maximum flow problems: |
331 | 331 |
- \ref EdmondsKarp Edmonds-Karp algorithm. |
332 | 332 |
- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm. |
333 | 333 |
- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees. |
334 | 334 |
- \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees. |
335 | 335 |
|
336 | 336 |
In most cases the \ref Preflow "Preflow" algorithm provides the |
337 | 337 |
fastest method for computing a maximum flow. All implementations |
338 |
provides functions to also query the minimum cut, which is the dual |
|
339 |
problem of the maximum flow. |
|
338 |
also provide functions to query the minimum cut, which is the dual |
|
339 |
problem of maximum flow. |
|
340 |
|
|
341 |
\ref Circulation is a preflow push-relabel algorithm implemented directly |
|
342 |
for finding feasible circulations, which is a somewhat different problem, |
|
343 |
but it is strongly related to maximum flow. |
|
344 |
For more information, see \ref Circulation. |
|
340 | 345 |
*/ |
341 | 346 |
|
342 | 347 |
/** |
343 | 348 |
@defgroup min_cost_flow Minimum Cost Flow Algorithms |
344 | 349 |
@ingroup algs |
345 | 350 |
|
346 | 351 |
\brief Algorithms for finding minimum cost flows and circulations. |
347 | 352 |
|
348 | 353 |
This group contains the algorithms for finding minimum cost flows and |
349 | 354 |
circulations. |
350 | 355 |
|
351 | 356 |
The \e minimum \e cost \e flow \e problem is to find a feasible flow of |
352 | 357 |
minimum total cost from a set of supply nodes to a set of demand nodes |
353 | 358 |
in a network with capacity constraints (lower and upper bounds) |
354 | 359 |
and arc costs. |
355 | 360 |
Formally, let \f$G=(V,A)\f$ be a digraph, \f$lower: A\rightarrow\mathbf{Z}\f$, |
356 | 361 |
\f$upper: A\rightarrow\mathbf{Z}\cup\{+\infty\}\f$ denote the lower and |
357 | 362 |
upper bounds for the flow values on the arcs, for which |
358 | 363 |
\f$lower(uv) \leq upper(uv)\f$ must hold for all \f$uv\in A\f$, |
359 | 364 |
\f$cost: A\rightarrow\mathbf{Z}\f$ denotes the cost per unit flow |
360 | 365 |
on the arcs and \f$sup: V\rightarrow\mathbf{Z}\f$ denotes the |
361 | 366 |
signed supply values of the nodes. |
362 | 367 |
If \f$sup(u)>0\f$, then \f$u\f$ is a supply node with \f$sup(u)\f$ |
363 | 368 |
supply, if \f$sup(u)<0\f$, then \f$u\f$ is a demand node with |
... | ... |
@@ -520,52 +525,52 @@ |
520 | 525 |
for calculating maximum cardinality matching in bipartite graphs. |
521 | 526 |
- \ref PrBipartiteMatching Push-relabel algorithm |
522 | 527 |
for calculating maximum cardinality matching in bipartite graphs. |
523 | 528 |
- \ref MaxWeightedBipartiteMatching |
524 | 529 |
Successive shortest path algorithm for calculating maximum weighted |
525 | 530 |
matching and maximum weighted bipartite matching in bipartite graphs. |
526 | 531 |
- \ref MinCostMaxBipartiteMatching |
527 | 532 |
Successive shortest path algorithm for calculating minimum cost maximum |
528 | 533 |
matching in bipartite graphs. |
529 | 534 |
- \ref MaxMatching Edmond's blossom shrinking algorithm for calculating |
530 | 535 |
maximum cardinality matching in general graphs. |
531 | 536 |
- \ref MaxWeightedMatching Edmond's blossom shrinking algorithm for calculating |
532 | 537 |
maximum weighted matching in general graphs. |
533 | 538 |
- \ref MaxWeightedPerfectMatching |
534 | 539 |
Edmond's blossom shrinking algorithm for calculating maximum weighted |
535 | 540 |
perfect matching in general graphs. |
536 | 541 |
|
537 | 542 |
\image html bipartite_matching.png |
538 | 543 |
\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth |
539 | 544 |
*/ |
540 | 545 |
|
541 | 546 |
/** |
542 | 547 |
@defgroup spantree Minimum Spanning Tree Algorithms |
543 | 548 |
@ingroup algs |
544 |
\brief Algorithms for finding |
|
549 |
\brief Algorithms for finding minimum cost spanning trees and arborescences. |
|
545 | 550 |
|
546 |
This group contains the algorithms for finding a minimum cost spanning |
|
547 |
tree in a graph. |
|
551 |
This group contains the algorithms for finding minimum cost spanning |
|
552 |
trees and arborescences. |
|
548 | 553 |
*/ |
549 | 554 |
|
550 | 555 |
/** |
551 | 556 |
@defgroup auxalg Auxiliary Algorithms |
552 | 557 |
@ingroup algs |
553 | 558 |
\brief Auxiliary algorithms implemented in LEMON. |
554 | 559 |
|
555 | 560 |
This group contains some algorithms implemented in LEMON |
556 | 561 |
in order to make it easier to implement complex algorithms. |
557 | 562 |
*/ |
558 | 563 |
|
559 | 564 |
/** |
560 | 565 |
@defgroup approx Approximation Algorithms |
561 | 566 |
@ingroup algs |
562 | 567 |
\brief Approximation algorithms. |
563 | 568 |
|
564 | 569 |
This group contains the approximation and heuristic algorithms |
565 | 570 |
implemented in LEMON. |
566 | 571 |
*/ |
567 | 572 |
|
568 | 573 |
/** |
569 | 574 |
@defgroup gen_opt_group General Optimization Tools |
570 | 575 |
\brief This group contains some general optimization frameworks |
571 | 576 |
implemented in LEMON. |
... | ... |
@@ -20,37 +20,33 @@ |
20 | 20 |
\mainpage LEMON Documentation |
21 | 21 |
|
22 | 22 |
\section intro Introduction |
23 | 23 |
|
24 | 24 |
\subsection whatis What is LEMON |
25 | 25 |
|
26 | 26 |
LEMON stands for |
27 | 27 |
<b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels |
28 | 28 |
and <b>O</b>ptimization in <b>N</b>etworks. |
29 | 29 |
It is a C++ template |
30 | 30 |
library aimed at combinatorial optimization tasks which |
31 | 31 |
often involve in working |
32 | 32 |
with graphs. |
33 | 33 |
|
34 | 34 |
<b> |
35 | 35 |
LEMON is an <a class="el" href="http://opensource.org/">open source</a> |
36 | 36 |
project. |
37 | 37 |
You are free to use it in your commercial or |
38 | 38 |
non-commercial applications under very permissive |
39 | 39 |
\ref license "license terms". |
40 | 40 |
</b> |
41 | 41 |
|
42 | 42 |
\subsection howtoread How to read the documentation |
43 | 43 |
|
44 |
If you want to get a quick start and see the most important features then |
|
45 |
take a look at our \ref quicktour |
|
46 |
"Quick Tour to LEMON" which will guide you along. |
|
47 |
|
|
48 |
If you |
|
44 |
If you would like to get to know the library, see |
|
49 | 45 |
<a class="el" href="http://lemon.cs.elte.hu/pub/tutorial/">LEMON Tutorial</a>. |
50 | 46 |
|
51 |
If you know what you are looking for then try to find it under the |
|
47 |
If you know what you are looking for, then try to find it under the |
|
52 | 48 |
<a class="el" href="modules.html">Modules</a> section. |
53 | 49 |
|
54 | 50 |
If you are a user of the old (0.x) series of LEMON, please check out the |
55 | 51 |
\ref migration "Migration Guide" for the backward incompatibilities. |
56 | 52 |
*/ |
... | ... |
@@ -478,68 +478,68 @@ |
478 | 478 |
(*_matching)[n] = INVALID; |
479 | 479 |
(*_status)[n] = UNMATCHED; |
480 | 480 |
} |
481 | 481 |
for(EdgeIt e(_graph); e!=INVALID; ++e) { |
482 | 482 |
if (matching[e]) { |
483 | 483 |
|
484 | 484 |
Node u = _graph.u(e); |
485 | 485 |
if ((*_matching)[u] != INVALID) return false; |
486 | 486 |
(*_matching)[u] = _graph.direct(e, true); |
487 | 487 |
(*_status)[u] = MATCHED; |
488 | 488 |
|
489 | 489 |
Node v = _graph.v(e); |
490 | 490 |
if ((*_matching)[v] != INVALID) return false; |
491 | 491 |
(*_matching)[v] = _graph.direct(e, false); |
492 | 492 |
(*_status)[v] = MATCHED; |
493 | 493 |
} |
494 | 494 |
} |
495 | 495 |
return true; |
496 | 496 |
} |
497 | 497 |
|
498 | 498 |
/// \brief Start Edmonds' algorithm |
499 | 499 |
/// |
500 | 500 |
/// This function runs the original Edmonds' algorithm. |
501 | 501 |
/// |
502 |
/// \pre \ref |
|
502 |
/// \pre \ref init(), \ref greedyInit() or \ref matchingInit() must be |
|
503 | 503 |
/// called before using this function. |
504 | 504 |
void startSparse() { |
505 | 505 |
for(NodeIt n(_graph); n != INVALID; ++n) { |
506 | 506 |
if ((*_status)[n] == UNMATCHED) { |
507 | 507 |
(*_blossom_rep)[_blossom_set->insert(n)] = n; |
508 | 508 |
_tree_set->insert(n); |
509 | 509 |
(*_status)[n] = EVEN; |
510 | 510 |
processSparse(n); |
511 | 511 |
} |
512 | 512 |
} |
513 | 513 |
} |
514 | 514 |
|
515 | 515 |
/// \brief Start Edmonds' algorithm with a heuristic improvement |
516 | 516 |
/// for dense graphs |
517 | 517 |
/// |
518 | 518 |
/// This function runs Edmonds' algorithm with a heuristic of postponing |
519 | 519 |
/// shrinks, therefore resulting in a faster algorithm for dense graphs. |
520 | 520 |
/// |
521 |
/// \pre \ref |
|
521 |
/// \pre \ref init(), \ref greedyInit() or \ref matchingInit() must be |
|
522 | 522 |
/// called before using this function. |
523 | 523 |
void startDense() { |
524 | 524 |
for(NodeIt n(_graph); n != INVALID; ++n) { |
525 | 525 |
if ((*_status)[n] == UNMATCHED) { |
526 | 526 |
(*_blossom_rep)[_blossom_set->insert(n)] = n; |
527 | 527 |
_tree_set->insert(n); |
528 | 528 |
(*_status)[n] = EVEN; |
529 | 529 |
processDense(n); |
530 | 530 |
} |
531 | 531 |
} |
532 | 532 |
} |
533 | 533 |
|
534 | 534 |
|
535 | 535 |
/// \brief Run Edmonds' algorithm |
536 | 536 |
/// |
537 | 537 |
/// This function runs Edmonds' algorithm. An additional heuristic of |
538 | 538 |
/// postponing shrinks is used for relatively dense graphs |
539 | 539 |
/// (for which <tt>m>=2*n</tt> holds). |
540 | 540 |
void run() { |
541 | 541 |
if (countEdges(_graph) < 2 * countNodes(_graph)) { |
542 | 542 |
greedyInit(); |
543 | 543 |
startSparse(); |
544 | 544 |
} else { |
545 | 545 |
init(); |
0 comments (0 inline)