0
2
0
16
104
... | ... |
@@ -227,32 +227,24 @@ |
227 | 227 |
|
228 | 228 |
Dijkstra<Digraph, TimeMap> dijkstra(graph, time); |
229 | 229 |
dijkstra.run(source, target); |
230 | 230 |
\endcode |
231 | 231 |
We have a length map and a maximum speed map on the arcs of a digraph. |
232 | 232 |
The minimum time to pass the arc can be calculated as the division of |
233 | 233 |
the two maps which can be done implicitly with the \c DivMap template |
234 | 234 |
class. We use the implicit minimum time map as the length map of the |
235 | 235 |
\c Dijkstra algorithm. |
236 | 236 |
*/ |
237 | 237 |
|
238 | 238 |
/** |
239 |
@defgroup matrices Matrices |
|
240 |
@ingroup datas |
|
241 |
\brief Two dimensional data storages implemented in LEMON. |
|
242 |
|
|
243 |
This group contains two dimensional data storages implemented in LEMON. |
|
244 |
*/ |
|
245 |
|
|
246 |
/** |
|
247 | 239 |
@defgroup paths Path Structures |
248 | 240 |
@ingroup datas |
249 | 241 |
\brief %Path structures implemented in LEMON. |
250 | 242 |
|
251 | 243 |
This group contains the path structures implemented in LEMON. |
252 | 244 |
|
253 | 245 |
LEMON provides flexible data structures to work with paths. |
254 | 246 |
All of them have similar interfaces and they can be copied easily with |
255 | 247 |
assignment operators and copy constructors. This makes it easy and |
256 | 248 |
efficient to have e.g. the Dijkstra algorithm to store its result in |
257 | 249 |
any kind of path structure. |
258 | 250 |
|
... | ... |
@@ -284,68 +276,58 @@ |
284 | 276 |
|
285 | 277 |
This group contains the common graph search algorithms, namely |
286 | 278 |
\e breadth-first \e search (BFS) and \e depth-first \e search (DFS). |
287 | 279 |
*/ |
288 | 280 |
|
289 | 281 |
/** |
290 | 282 |
@defgroup shortest_path Shortest Path Algorithms |
291 | 283 |
@ingroup algs |
292 | 284 |
\brief Algorithms for finding shortest paths. |
293 | 285 |
|
294 | 286 |
This group contains the algorithms for finding shortest paths in digraphs. |
295 | 287 |
|
296 |
- \ref Dijkstra algorithm for finding shortest paths from a source node |
|
297 |
when all arc lengths are non-negative. |
|
298 |
- \ref BellmanFord "Bellman-Ford" algorithm for finding shortest paths |
|
299 |
from a source node when arc lenghts can be either positive or negative, |
|
300 |
but the digraph should not contain directed cycles with negative total |
|
301 |
length. |
|
302 |
- \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms |
|
303 |
for solving the \e all-pairs \e shortest \e paths \e problem when arc |
|
304 |
lenghts can be either positive or negative, but the digraph should |
|
305 |
not contain directed cycles with negative total length. |
|
288 |
- \ref Dijkstra Dijkstra's algorithm for finding shortest paths from a |
|
289 |
source node when all arc lengths are non-negative. |
|
306 | 290 |
- \ref Suurballe A successive shortest path algorithm for finding |
307 | 291 |
arc-disjoint paths between two nodes having minimum total length. |
308 | 292 |
*/ |
309 | 293 |
|
310 | 294 |
/** |
311 | 295 |
@defgroup max_flow Maximum Flow Algorithms |
312 | 296 |
@ingroup algs |
313 | 297 |
\brief Algorithms for finding maximum flows. |
314 | 298 |
|
315 | 299 |
This group contains the algorithms for finding maximum flows and |
316 | 300 |
feasible circulations. |
317 | 301 |
|
318 | 302 |
The \e maximum \e flow \e problem is to find a flow of maximum value between |
319 | 303 |
a single source and a single target. Formally, there is a \f$G=(V,A)\f$ |
320 | 304 |
digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and |
321 | 305 |
\f$s, t \in V\f$ source and target nodes. |
322 | 306 |
A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the |
323 | 307 |
following optimization problem. |
324 | 308 |
|
325 | 309 |
\f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f] |
326 | 310 |
\f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu) |
327 | 311 |
\quad \forall u\in V\setminus\{s,t\} \f] |
328 | 312 |
\f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] |
329 | 313 |
|
330 |
LEMON contains several algorithms for solving maximum flow problems: |
|
331 |
- \ref EdmondsKarp Edmonds-Karp algorithm. |
|
332 |
- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm. |
|
333 |
- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees. |
|
334 |
|
|
314 |
\ref Preflow implements the preflow push-relabel algorithm of Goldberg and |
|
315 |
Tarjan for solving this problem. It also provides functions to query the |
|
316 |
minimum cut, which is the dual problem of maximum flow. |
|
335 | 317 |
|
336 |
In most cases the \ref Preflow "Preflow" algorithm provides the |
|
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. |
|
318 |
\ref Circulation is a preflow push-relabel algorithm implemented directly |
|
319 |
for finding feasible circulations, which is a somewhat different problem, |
|
320 |
but it is strongly related to maximum flow. |
|
321 |
For more information, see \ref Circulation. |
|
340 | 322 |
*/ |
341 | 323 |
|
342 | 324 |
/** |
343 | 325 |
@defgroup min_cost_flow Minimum Cost Flow Algorithms |
344 | 326 |
@ingroup algs |
345 | 327 |
|
346 | 328 |
\brief Algorithms for finding minimum cost flows and circulations. |
347 | 329 |
|
348 | 330 |
This group contains the algorithms for finding minimum cost flows and |
349 | 331 |
circulations. |
350 | 332 |
|
351 | 333 |
The \e minimum \e cost \e flow \e problem is to find a feasible flow of |
... | ... |
@@ -412,129 +394,85 @@ |
412 | 394 |
- For all \f$uv\in A\f$ arcs: |
413 | 395 |
- if \f$cost^\pi(uv)>0\f$, then \f$f(uv)=lower(uv)\f$; |
414 | 396 |
- if \f$lower(uv)<f(uv)<upper(uv)\f$, then \f$cost^\pi(uv)=0\f$; |
415 | 397 |
- if \f$cost^\pi(uv)<0\f$, then \f$f(uv)=upper(uv)\f$. |
416 | 398 |
- For all \f$u\in V\f$ nodes: |
417 | 399 |
- if \f$\sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) \neq sup(u)\f$, |
418 | 400 |
then \f$\pi(u)=0\f$. |
419 | 401 |
|
420 | 402 |
Here \f$cost^\pi(uv)\f$ denotes the \e reduced \e cost of the arc |
421 | 403 |
\f$uv\in A\f$ with respect to the potential function \f$\pi\f$, i.e. |
422 | 404 |
\f[ cost^\pi(uv) = cost(uv) + \pi(u) - \pi(v).\f] |
423 | 405 |
|
424 |
All algorithms provide dual solution (node potentials) as well, |
|
425 |
if an optimal flow is found. |
|
426 |
|
|
427 |
LEMON contains several algorithms for solving minimum cost flow problems. |
|
428 |
- \ref NetworkSimplex Primal Network Simplex algorithm with various |
|
429 |
pivot strategies. |
|
430 |
- \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on |
|
431 |
cost scaling. |
|
432 |
- \ref CapacityScaling Successive Shortest %Path algorithm with optional |
|
433 |
capacity scaling. |
|
434 |
- \ref CancelAndTighten The Cancel and Tighten algorithm. |
|
435 |
- \ref CycleCanceling Cycle-Canceling algorithms. |
|
436 |
|
|
437 |
Most of these implementations support the general inequality form of the |
|
438 |
minimum cost flow problem, but CancelAndTighten and CycleCanceling |
|
439 |
only support the equality form due to the primal method they use. |
|
440 |
|
|
441 |
In general NetworkSimplex is the most efficient implementation, |
|
442 |
but in special cases other algorithms could be faster. |
|
443 |
For example, if the total supply and/or capacities are rather small, |
|
444 |
|
|
406 |
\ref NetworkSimplex is an efficient implementation of the primal Network |
|
407 |
Simplex algorithm for finding minimum cost flows. It also provides dual |
|
408 |
solution (node potentials), if an optimal flow is found. |
|
445 | 409 |
*/ |
446 | 410 |
|
447 | 411 |
/** |
448 | 412 |
@defgroup min_cut Minimum Cut Algorithms |
449 | 413 |
@ingroup algs |
450 | 414 |
|
451 | 415 |
\brief Algorithms for finding minimum cut in graphs. |
452 | 416 |
|
453 | 417 |
This group contains the algorithms for finding minimum cut in graphs. |
454 | 418 |
|
455 | 419 |
The \e minimum \e cut \e problem is to find a non-empty and non-complete |
456 | 420 |
\f$X\f$ subset of the nodes with minimum overall capacity on |
457 | 421 |
outgoing arcs. Formally, there is a \f$G=(V,A)\f$ digraph, a |
458 | 422 |
\f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum |
459 | 423 |
cut is the \f$X\f$ solution of the next optimization problem: |
460 | 424 |
|
461 | 425 |
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} |
462 | 426 |
\sum_{uv\in A, u\in X, v\not\in X}cap(uv) \f] |
463 | 427 |
|
464 | 428 |
LEMON contains several algorithms related to minimum cut problems: |
465 | 429 |
|
466 | 430 |
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut |
467 | 431 |
in directed graphs. |
468 |
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for |
|
469 |
calculating minimum cut in undirected graphs. |
|
470 | 432 |
- \ref GomoryHu "Gomory-Hu tree computation" for calculating |
471 | 433 |
all-pairs minimum cut in undirected graphs. |
472 | 434 |
|
473 | 435 |
If you want to find minimum cut just between two distinict nodes, |
474 | 436 |
see the \ref max_flow "maximum flow problem". |
475 | 437 |
*/ |
476 | 438 |
|
477 | 439 |
/** |
478 | 440 |
@defgroup graph_properties Connectivity and Other Graph Properties |
479 | 441 |
@ingroup algs |
480 | 442 |
\brief Algorithms for discovering the graph properties |
481 | 443 |
|
482 | 444 |
This group contains the algorithms for discovering the graph properties |
483 | 445 |
like connectivity, bipartiteness, euler property, simplicity etc. |
484 | 446 |
|
485 | 447 |
\image html edge_biconnected_components.png |
486 | 448 |
\image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth |
487 | 449 |
*/ |
488 | 450 |
|
489 | 451 |
/** |
490 |
@defgroup planar Planarity Embedding and Drawing |
|
491 |
@ingroup algs |
|
492 |
\brief Algorithms for planarity checking, embedding and drawing |
|
493 |
|
|
494 |
This group contains the algorithms for planarity checking, |
|
495 |
embedding and drawing. |
|
496 |
|
|
497 |
\image html planar.png |
|
498 |
\image latex planar.eps "Plane graph" width=\textwidth |
|
499 |
*/ |
|
500 |
|
|
501 |
/** |
|
502 | 452 |
@defgroup matching Matching Algorithms |
503 | 453 |
@ingroup algs |
504 | 454 |
\brief Algorithms for finding matchings in graphs and bipartite graphs. |
505 | 455 |
|
506 |
This group contains the algorithms for calculating |
|
507 |
matchings in graphs and bipartite graphs. The general matching problem is |
|
508 |
finding a subset of the edges for which each node has at most one incident |
|
509 |
edge. |
|
456 |
This group contains the algorithms for calculating matchings in graphs. |
|
457 |
The general matching problem is finding a subset of the edges for which |
|
458 |
each node has at most one incident edge. |
|
510 | 459 |
|
511 | 460 |
There are several different algorithms for calculate matchings in |
512 |
graphs. The matching problems in bipartite graphs are generally |
|
513 |
easier than in general graphs. The goal of the matching optimization |
|
461 |
graphs. The goal of the matching optimization |
|
514 | 462 |
can be finding maximum cardinality, maximum weight or minimum cost |
515 | 463 |
matching. The search can be constrained to find perfect or |
516 | 464 |
maximum cardinality matching. |
517 | 465 |
|
518 | 466 |
The matching algorithms implemented in LEMON: |
519 |
- \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm |
|
520 |
for calculating maximum cardinality matching in bipartite graphs. |
|
521 |
- \ref PrBipartiteMatching Push-relabel algorithm |
|
522 |
for calculating maximum cardinality matching in bipartite graphs. |
|
523 |
- \ref MaxWeightedBipartiteMatching |
|
524 |
Successive shortest path algorithm for calculating maximum weighted |
|
525 |
matching and maximum weighted bipartite matching in bipartite graphs. |
|
526 |
- \ref MinCostMaxBipartiteMatching |
|
527 |
Successive shortest path algorithm for calculating minimum cost maximum |
|
528 |
matching in bipartite graphs. |
|
529 | 467 |
- \ref MaxMatching Edmond's blossom shrinking algorithm for calculating |
530 | 468 |
maximum cardinality matching in general graphs. |
531 | 469 |
- \ref MaxWeightedMatching Edmond's blossom shrinking algorithm for calculating |
532 | 470 |
maximum weighted matching in general graphs. |
533 | 471 |
- \ref MaxWeightedPerfectMatching |
534 | 472 |
Edmond's blossom shrinking algorithm for calculating maximum weighted |
535 | 473 |
perfect matching in general graphs. |
536 | 474 |
|
537 | 475 |
\image html bipartite_matching.png |
538 | 476 |
\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth |
539 | 477 |
*/ |
540 | 478 |
|
... | ... |
@@ -548,69 +486,43 @@ |
548 | 486 |
*/ |
549 | 487 |
|
550 | 488 |
/** |
551 | 489 |
@defgroup auxalg Auxiliary Algorithms |
552 | 490 |
@ingroup algs |
553 | 491 |
\brief Auxiliary algorithms implemented in LEMON. |
554 | 492 |
|
555 | 493 |
This group contains some algorithms implemented in LEMON |
556 | 494 |
in order to make it easier to implement complex algorithms. |
557 | 495 |
*/ |
558 | 496 |
|
559 | 497 |
/** |
560 |
@defgroup approx Approximation Algorithms |
|
561 |
@ingroup algs |
|
562 |
\brief Approximation algorithms. |
|
563 |
|
|
564 |
This group contains the approximation and heuristic algorithms |
|
565 |
implemented in LEMON. |
|
566 |
*/ |
|
567 |
|
|
568 |
/** |
|
569 | 498 |
@defgroup gen_opt_group General Optimization Tools |
570 | 499 |
\brief This group contains some general optimization frameworks |
571 | 500 |
implemented in LEMON. |
572 | 501 |
|
573 | 502 |
This group contains some general optimization frameworks |
574 | 503 |
implemented in LEMON. |
575 | 504 |
*/ |
576 | 505 |
|
577 | 506 |
/** |
578 | 507 |
@defgroup lp_group Lp and Mip Solvers |
579 | 508 |
@ingroup gen_opt_group |
580 | 509 |
\brief Lp and Mip solver interfaces for LEMON. |
581 | 510 |
|
582 | 511 |
This group contains Lp and Mip solver interfaces for LEMON. The |
583 | 512 |
various LP solvers could be used in the same manner with this |
584 | 513 |
interface. |
585 | 514 |
*/ |
586 | 515 |
|
587 | 516 |
/** |
588 |
@defgroup lp_utils Tools for Lp and Mip Solvers |
|
589 |
@ingroup lp_group |
|
590 |
\brief Helper tools to the Lp and Mip solvers. |
|
591 |
|
|
592 |
This group adds some helper tools to general optimization framework |
|
593 |
implemented in LEMON. |
|
594 |
*/ |
|
595 |
|
|
596 |
/** |
|
597 |
@defgroup metah Metaheuristics |
|
598 |
@ingroup gen_opt_group |
|
599 |
\brief Metaheuristics for LEMON library. |
|
600 |
|
|
601 |
This group contains some metaheuristic optimization tools. |
|
602 |
*/ |
|
603 |
|
|
604 |
/** |
|
605 | 517 |
@defgroup utils Tools and Utilities |
606 | 518 |
\brief Tools and utilities for programming in LEMON |
607 | 519 |
|
608 | 520 |
Tools and utilities for programming in LEMON. |
609 | 521 |
*/ |
610 | 522 |
|
611 | 523 |
/** |
612 | 524 |
@defgroup gutils Basic Graph Utilities |
613 | 525 |
@ingroup utils |
614 | 526 |
\brief Simple basic graph utilities. |
615 | 527 |
|
616 | 528 |
This group contains some simple basic graph utilities. |
... | ... |
@@ -36,26 +36,26 @@ |
36 | 36 |
/// \addtogroup shortest_path |
37 | 37 |
/// @{ |
38 | 38 |
|
39 | 39 |
/// \brief Algorithm for finding arc-disjoint paths between two nodes |
40 | 40 |
/// having minimum total length. |
41 | 41 |
/// |
42 | 42 |
/// \ref lemon::Suurballe "Suurballe" implements an algorithm for |
43 | 43 |
/// finding arc-disjoint paths having minimum total length (cost) |
44 | 44 |
/// from a given source node to a given target node in a digraph. |
45 | 45 |
/// |
46 | 46 |
/// Note that this problem is a special case of the \ref min_cost_flow |
47 | 47 |
/// "minimum cost flow problem". This implementation is actually an |
48 |
/// efficient specialized version of the \ref CapacityScaling |
|
49 |
/// "Successive Shortest Path" algorithm directly for this problem. |
|
48 |
/// efficient specialized version of the Successive Shortest Path |
|
49 |
/// algorithm directly for this problem. |
|
50 | 50 |
/// Therefore this class provides query functions for flow values and |
51 | 51 |
/// node potentials (the dual solution) just like the minimum cost flow |
52 | 52 |
/// algorithms. |
53 | 53 |
/// |
54 | 54 |
/// \tparam GR The digraph type the algorithm runs on. |
55 | 55 |
/// \tparam LEN The type of the length map. |
56 | 56 |
/// The default value is <tt>GR::ArcMap<int></tt>. |
57 | 57 |
/// |
58 | 58 |
/// \warning Length values should be \e non-negative \e integers. |
59 | 59 |
/// |
60 | 60 |
/// \note For finding node-disjoint paths this algorithm can be used |
61 | 61 |
/// along with the \ref SplitNodes adaptor. |
0 comments (0 inline)