doc/groups.dox
changeset 209 765619b7cbb2
parent 192 7bf5f97d574f
child 210 81cfc04531e8
equal deleted inserted replaced
6:b9d685ecc24f 7:1a4b0b76efe6
     1 /* -*- C++ -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2008
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
    24 /**
    24 /**
    25 @defgroup graphs Graph Structures
    25 @defgroup graphs Graph Structures
    26 @ingroup datas
    26 @ingroup datas
    27 \brief Graph structures implemented in LEMON.
    27 \brief Graph structures implemented in LEMON.
    28 
    28 
    29 The implementation of combinatorial algorithms heavily relies on 
    29 The implementation of combinatorial algorithms heavily relies on
    30 efficient graph implementations. LEMON offers data structures which are 
    30 efficient graph implementations. LEMON offers data structures which are
    31 planned to be easily used in an experimental phase of implementation studies, 
    31 planned to be easily used in an experimental phase of implementation studies,
    32 and thereafter the program code can be made efficient by small modifications. 
    32 and thereafter the program code can be made efficient by small modifications.
    33 
    33 
    34 The most efficient implementation of diverse applications require the
    34 The most efficient implementation of diverse applications require the
    35 usage of different physical graph implementations. These differences
    35 usage of different physical graph implementations. These differences
    36 appear in the size of graph we require to handle, memory or time usage
    36 appear in the size of graph we require to handle, memory or time usage
    37 limitations or in the set of operations through which the graph can be
    37 limitations or in the set of operations through which the graph can be
    38 accessed.  LEMON provides several physical graph structures to meet
    38 accessed.  LEMON provides several physical graph structures to meet
    39 the diverging requirements of the possible users.  In order to save on
    39 the diverging requirements of the possible users.  In order to save on
    40 running time or on memory usage, some structures may fail to provide
    40 running time or on memory usage, some structures may fail to provide
    41 some graph features like arc/edge or node deletion.
    41 some graph features like arc/edge or node deletion.
    42 
    42 
    43 Alteration of standard containers need a very limited number of 
    43 Alteration of standard containers need a very limited number of
    44 operations, these together satisfy the everyday requirements. 
    44 operations, these together satisfy the everyday requirements.
    45 In the case of graph structures, different operations are needed which do 
    45 In the case of graph structures, different operations are needed which do
    46 not alter the physical graph, but gives another view. If some nodes or 
    46 not alter the physical graph, but gives another view. If some nodes or
    47 arcs have to be hidden or the reverse oriented graph have to be used, then
    47 arcs have to be hidden or the reverse oriented graph have to be used, then
    48 this is the case. It also may happen that in a flow implementation 
    48 this is the case. It also may happen that in a flow implementation
    49 the residual graph can be accessed by another algorithm, or a node-set 
    49 the residual graph can be accessed by another algorithm, or a node-set
    50 is to be shrunk for another algorithm. 
    50 is to be shrunk for another algorithm.
    51 LEMON also provides a variety of graphs for these requirements called 
    51 LEMON also provides a variety of graphs for these requirements called
    52 \ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only 
    52 \ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only
    53 in conjunction with other graph representations. 
    53 in conjunction with other graph representations.
    54 
    54 
    55 You are free to use the graph structure that fit your requirements
    55 You are free to use the graph structure that fit your requirements
    56 the best, most graph algorithms and auxiliary data structures can be used
    56 the best, most graph algorithms and auxiliary data structures can be used
    57 with any graph structures. 
    57 with any graph structures.
    58 */
    58 */
    59 
    59 
    60 /**
    60 /**
    61 @defgroup semi_adaptors Semi-Adaptor Classes for Graphs
    61 @defgroup semi_adaptors Semi-Adaptor Classes for Graphs
    62 @ingroup graphs
    62 @ingroup graphs
    63 \brief Graph types between real graphs and graph adaptors.
    63 \brief Graph types between real graphs and graph adaptors.
    64 
    64 
    65 This group describes some graph types between real graphs and graph adaptors.
    65 This group describes some graph types between real graphs and graph adaptors.
    66 These classes wrap graphs to give new functionality as the adaptors do it. 
    66 These classes wrap graphs to give new functionality as the adaptors do it.
    67 On the other hand they are not light-weight structures as the adaptors.
    67 On the other hand they are not light-weight structures as the adaptors.
    68 */
    68 */
    69 
    69 
    70 /**
    70 /**
    71 @defgroup maps Maps 
    71 @defgroup maps Maps
    72 @ingroup datas
    72 @ingroup datas
    73 \brief Map structures implemented in LEMON.
    73 \brief Map structures implemented in LEMON.
    74 
    74 
    75 This group describes the map structures implemented in LEMON.
    75 This group describes the map structures implemented in LEMON.
    76 
    76 
    77 LEMON provides several special purpose maps that e.g. combine
    77 LEMON provides several special purpose maps that e.g. combine
    78 new maps from existing ones.
    78 new maps from existing ones.
    79 */
    79 */
    80 
    80 
    81 /**
    81 /**
    82 @defgroup graph_maps Graph Maps 
    82 @defgroup graph_maps Graph Maps
    83 @ingroup maps
    83 @ingroup maps
    84 \brief Special graph-related maps.
    84 \brief Special graph-related maps.
    85 
    85 
    86 This group describes maps that are specifically designed to assign
    86 This group describes maps that are specifically designed to assign
    87 values to the nodes and arcs of graphs.
    87 values to the nodes and arcs of graphs.
   113       return Color(1.0, 0.5, 1.0);
   113       return Color(1.0, 0.5, 1.0);
   114     } else {
   114     } else {
   115       return Color(0.0, 0.0, 0.0);
   115       return Color(0.0, 0.0, 0.0);
   116     }
   116     }
   117   }
   117   }
   118   
   118 
   119   Digraph::NodeMap<int> degree_map(graph);
   119   Digraph::NodeMap<int> degree_map(graph);
   120   
   120 
   121   digraphToEps(graph, "graph.eps")
   121   digraphToEps(graph, "graph.eps")
   122     .coords(coords).scaleToA4().undirected()
   122     .coords(coords).scaleToA4().undirected()
   123     .nodeColors(composeMap(functorToMap(nodeColor), degree_map))
   123     .nodeColors(composeMap(functorToMap(nodeColor), degree_map))
   124     .run();
   124     .run();
   125 \endcode 
   125 \endcode
   126 The \c functorToMap() function makes an \c int to \c Color map from the
   126 The \c functorToMap() function makes an \c int to \c Color map from the
   127 \e nodeColor() function. The \c composeMap() compose the \e degree_map
   127 \e nodeColor() function. The \c composeMap() compose the \e degree_map
   128 and the previously created map. The composed map is a proper function to
   128 and the previously created map. The composed map is a proper function to
   129 get the color of each node.
   129 get the color of each node.
   130 
   130 
   138   DoubleArcMap length(graph);
   138   DoubleArcMap length(graph);
   139   DoubleArcMap speed(graph);
   139   DoubleArcMap speed(graph);
   140 
   140 
   141   typedef DivMap<DoubleArcMap, DoubleArcMap> TimeMap;
   141   typedef DivMap<DoubleArcMap, DoubleArcMap> TimeMap;
   142   TimeMap time(length, speed);
   142   TimeMap time(length, speed);
   143   
   143 
   144   Dijkstra<Digraph, TimeMap> dijkstra(graph, time);
   144   Dijkstra<Digraph, TimeMap> dijkstra(graph, time);
   145   dijkstra.run(source, target);
   145   dijkstra.run(source, target);
   146 \endcode
   146 \endcode
   147 We have a length map and a maximum speed map on the arcs of a digraph.
   147 We have a length map and a maximum speed map on the arcs of a digraph.
   148 The minimum time to pass the arc can be calculated as the division of
   148 The minimum time to pass the arc can be calculated as the division of
   150 class. We use the implicit minimum time map as the length map of the
   150 class. We use the implicit minimum time map as the length map of the
   151 \c Dijkstra algorithm.
   151 \c Dijkstra algorithm.
   152 */
   152 */
   153 
   153 
   154 /**
   154 /**
   155 @defgroup matrices Matrices 
   155 @defgroup matrices Matrices
   156 @ingroup datas
   156 @ingroup datas
   157 \brief Two dimensional data storages implemented in LEMON.
   157 \brief Two dimensional data storages implemented in LEMON.
   158 
   158 
   159 This group describes two dimensional data storages implemented in LEMON.
   159 This group describes two dimensional data storages implemented in LEMON.
   160 */
   160 */
   198 /**
   198 /**
   199 @defgroup search Graph Search
   199 @defgroup search Graph Search
   200 @ingroup algs
   200 @ingroup algs
   201 \brief Common graph search algorithms.
   201 \brief Common graph search algorithms.
   202 
   202 
   203 This group describes the common graph search algorithms like 
   203 This group describes the common graph search algorithms like
   204 Breadth-first search (Bfs) and Depth-first search (Dfs).
   204 Breadth-first search (Bfs) and Depth-first search (Dfs).
   205 */
   205 */
   206 
   206 
   207 /**
   207 /**
   208 @defgroup shortest_path Shortest Path algorithms
   208 @defgroup shortest_path Shortest Path algorithms
   210 \brief Algorithms for finding shortest paths.
   210 \brief Algorithms for finding shortest paths.
   211 
   211 
   212 This group describes the algorithms for finding shortest paths in graphs.
   212 This group describes the algorithms for finding shortest paths in graphs.
   213 */
   213 */
   214 
   214 
   215 /** 
   215 /**
   216 @defgroup max_flow Maximum Flow algorithms 
   216 @defgroup max_flow Maximum Flow algorithms
   217 @ingroup algs 
   217 @ingroup algs
   218 \brief Algorithms for finding maximum flows.
   218 \brief Algorithms for finding maximum flows.
   219 
   219 
   220 This group describes the algorithms for finding maximum flows and
   220 This group describes the algorithms for finding maximum flows and
   221 feasible circulations.
   221 feasible circulations.
   222 
   222 
   229 \f[ 0 \le f_a \le c_a \f]
   229 \f[ 0 \le f_a \le c_a \f]
   230 \f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv} \qquad \forall u \in V \setminus \{s,t\}\f]
   230 \f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv} \qquad \forall u \in V \setminus \{s,t\}\f]
   231 \f[ \max \sum_{v\in\delta^{+}(s)}f_{uv} - \sum_{v\in\delta^{-}(s)}f_{vu}\f]
   231 \f[ \max \sum_{v\in\delta^{+}(s)}f_{uv} - \sum_{v\in\delta^{-}(s)}f_{vu}\f]
   232 
   232 
   233 LEMON contains several algorithms for solving maximum flow problems:
   233 LEMON contains several algorithms for solving maximum flow problems:
   234 - \ref lemon::EdmondsKarp "Edmonds-Karp" 
   234 - \ref lemon::EdmondsKarp "Edmonds-Karp"
   235 - \ref lemon::Preflow "Goldberg's Preflow algorithm"
   235 - \ref lemon::Preflow "Goldberg's Preflow algorithm"
   236 - \ref lemon::DinitzSleatorTarjan "Dinitz's blocking flow algorithm with dynamic trees"
   236 - \ref lemon::DinitzSleatorTarjan "Dinitz's blocking flow algorithm with dynamic trees"
   237 - \ref lemon::GoldbergTarjan "Preflow algorithm with dynamic trees"
   237 - \ref lemon::GoldbergTarjan "Preflow algorithm with dynamic trees"
   238 
   238 
   239 In most cases the \ref lemon::Preflow "Preflow" algorithm provides the
   239 In most cases the \ref lemon::Preflow "Preflow" algorithm provides the
   248 @ingroup algs
   248 @ingroup algs
   249 
   249 
   250 \brief Algorithms for finding minimum cost flows and circulations.
   250 \brief Algorithms for finding minimum cost flows and circulations.
   251 
   251 
   252 This group describes the algorithms for finding minimum cost flows and
   252 This group describes the algorithms for finding minimum cost flows and
   253 circulations.  
   253 circulations.
   254 */
   254 */
   255 
   255 
   256 /**
   256 /**
   257 @defgroup min_cut Minimum Cut algorithms 
   257 @defgroup min_cut Minimum Cut algorithms
   258 @ingroup algs 
   258 @ingroup algs
   259 
   259 
   260 \brief Algorithms for finding minimum cut in graphs.
   260 \brief Algorithms for finding minimum cut in graphs.
   261 
   261 
   262 This group describes the algorithms for finding minimum cut in graphs.
   262 This group describes the algorithms for finding minimum cut in graphs.
   263 
   263 
   270 \f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}\sum_{uv\in A, u\in X, v\not\in X}c_{uv}\f]
   270 \f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}\sum_{uv\in A, u\in X, v\not\in X}c_{uv}\f]
   271 
   271 
   272 LEMON contains several algorithms related to minimum cut problems:
   272 LEMON contains several algorithms related to minimum cut problems:
   273 
   273 
   274 - \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculate minimum cut
   274 - \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculate minimum cut
   275   in directed graphs  
   275   in directed graphs
   276 - \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to
   276 - \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to
   277   calculate minimum cut in undirected graphs
   277   calculate minimum cut in undirected graphs
   278 - \ref lemon::GomoryHuTree "Gomory-Hu tree computation" to calculate all
   278 - \ref lemon::GomoryHuTree "Gomory-Hu tree computation" to calculate all
   279   pairs minimum cut in undirected graphs
   279   pairs minimum cut in undirected graphs
   280 
   280 
   305 \image html planar.png
   305 \image html planar.png
   306 \image latex planar.eps "Plane graph" width=\textwidth
   306 \image latex planar.eps "Plane graph" width=\textwidth
   307 */
   307 */
   308 
   308 
   309 /**
   309 /**
   310 @defgroup matching Matching algorithms 
   310 @defgroup matching Matching algorithms
   311 @ingroup algs
   311 @ingroup algs
   312 \brief Algorithms for finding matchings in graphs and bipartite graphs.
   312 \brief Algorithms for finding matchings in graphs and bipartite graphs.
   313 
   313 
   314 This group contains algorithm objects and functions to calculate
   314 This group contains algorithm objects and functions to calculate
   315 matchings in graphs and bipartite graphs. The general matching problem is
   315 matchings in graphs and bipartite graphs. The general matching problem is
   316 finding a subset of the arcs which does not shares common endpoints.
   316 finding a subset of the arcs which does not shares common endpoints.
   317  
   317 
   318 There are several different algorithms for calculate matchings in
   318 There are several different algorithms for calculate matchings in
   319 graphs.  The matching problems in bipartite graphs are generally
   319 graphs.  The matching problems in bipartite graphs are generally
   320 easier than in general graphs. The goal of the matching optimization
   320 easier than in general graphs. The goal of the matching optimization
   321 can be the finding maximum cardinality, maximum weight or minimum cost
   321 can be the finding maximum cardinality, maximum weight or minimum cost
   322 matching. The search can be constrained to find perfect or
   322 matching. The search can be constrained to find perfect or
   323 maximum cardinality matching.
   323 maximum cardinality matching.
   324 
   324 
   325 Lemon contains the next algorithms:
   325 Lemon contains the next algorithms:
   326 - \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp 
   326 - \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp
   327   augmenting path algorithm for calculate maximum cardinality matching in 
   327   augmenting path algorithm for calculate maximum cardinality matching in
   328   bipartite graphs
   328   bipartite graphs
   329 - \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel 
   329 - \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel
   330   algorithm for calculate maximum cardinality matching in bipartite graphs 
   330   algorithm for calculate maximum cardinality matching in bipartite graphs
   331 - \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching" 
   331 - \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching"
   332   Successive shortest path algorithm for calculate maximum weighted matching 
   332   Successive shortest path algorithm for calculate maximum weighted matching
   333   and maximum weighted bipartite matching in bipartite graph
   333   and maximum weighted bipartite matching in bipartite graph
   334 - \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching" 
   334 - \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching"
   335   Successive shortest path algorithm for calculate minimum cost maximum 
   335   Successive shortest path algorithm for calculate minimum cost maximum
   336   matching in bipartite graph
   336   matching in bipartite graph
   337 - \ref lemon::MaxMatching "MaxMatching" Edmond's blossom shrinking algorithm
   337 - \ref lemon::MaxMatching "MaxMatching" Edmond's blossom shrinking algorithm
   338   for calculate maximum cardinality matching in general graph
   338   for calculate maximum cardinality matching in general graph
   339 - \ref lemon::MaxWeightedMatching "MaxWeightedMatching" Edmond's blossom
   339 - \ref lemon::MaxWeightedMatching "MaxWeightedMatching" Edmond's blossom
   340   shrinking algorithm for calculate maximum weighted matching in general
   340   shrinking algorithm for calculate maximum weighted matching in general
   394 various LP solvers could be used in the same manner with this
   394 various LP solvers could be used in the same manner with this
   395 interface.
   395 interface.
   396 
   396 
   397 */
   397 */
   398 
   398 
   399 /** 
   399 /**
   400 @defgroup lp_utils Tools for Lp and Mip solvers 
   400 @defgroup lp_utils Tools for Lp and Mip solvers
   401 @ingroup lp_group
   401 @ingroup lp_group
   402 \brief Helper tools to the Lp and Mip solvers.
   402 \brief Helper tools to the Lp and Mip solvers.
   403 
   403 
   404 This group adds some helper tools to general optimization framework
   404 This group adds some helper tools to general optimization framework
   405 implemented in LEMON.
   405 implemented in LEMON.
   412 
   412 
   413 This group describes some metaheuristic optimization tools.
   413 This group describes some metaheuristic optimization tools.
   414 */
   414 */
   415 
   415 
   416 /**
   416 /**
   417 @defgroup utils Tools and Utilities 
   417 @defgroup utils Tools and Utilities
   418 \brief Tools and utilities for programming in LEMON
   418 \brief Tools and utilities for programming in LEMON
   419 
   419 
   420 Tools and utilities for programming in LEMON.
   420 Tools and utilities for programming in LEMON.
   421 */
   421 */
   422 
   422 
   465 
   465 
   466 /**
   466 /**
   467 @defgroup io_group Input-Output
   467 @defgroup io_group Input-Output
   468 \brief Graph Input-Output methods
   468 \brief Graph Input-Output methods
   469 
   469 
   470 This group describes the tools for importing and exporting graphs 
   470 This group describes the tools for importing and exporting graphs
   471 and graph related data. Now it supports the LEMON format, the
   471 and graph related data. Now it supports the LEMON format, the
   472 \c DIMACS format and the encapsulated postscript (EPS) format.
   472 \c DIMACS format and the encapsulated postscript (EPS) format.
   473 */
   473 */
   474 
   474 
   475 /**
   475 /**
   484 @defgroup eps_io Postscript exporting
   484 @defgroup eps_io Postscript exporting
   485 @ingroup io_group
   485 @ingroup io_group
   486 \brief General \c EPS drawer and graph exporter
   486 \brief General \c EPS drawer and graph exporter
   487 
   487 
   488 This group describes general \c EPS drawing methods and special
   488 This group describes general \c EPS drawing methods and special
   489 graph exporting tools. 
   489 graph exporting tools.
   490 */
   490 */
   491 
   491 
   492 
   492 
   493 /**
   493 /**
   494 @defgroup concept Concepts
   494 @defgroup concept Concepts
   496 
   496 
   497 This group describes the data/algorithm skeletons and concept checking
   497 This group describes the data/algorithm skeletons and concept checking
   498 classes implemented in LEMON.
   498 classes implemented in LEMON.
   499 
   499 
   500 The purpose of the classes in this group is fourfold.
   500 The purpose of the classes in this group is fourfold.
   501  
   501 
   502 - These classes contain the documentations of the concepts. In order
   502 - These classes contain the documentations of the concepts. In order
   503   to avoid document multiplications, an implementation of a concept
   503   to avoid document multiplications, an implementation of a concept
   504   simply refers to the corresponding concept class.
   504   simply refers to the corresponding concept class.
   505 
   505 
   506 - These classes declare every functions, <tt>typedef</tt>s etc. an
   506 - These classes declare every functions, <tt>typedef</tt>s etc. an
   549 */
   549 */
   550 
   550 
   551 /**
   551 /**
   552 @defgroup tools Standalone utility applications
   552 @defgroup tools Standalone utility applications
   553 
   553 
   554 Some utility applications are listed here. 
   554 Some utility applications are listed here.
   555 
   555 
   556 The standard compilation procedure (<tt>./configure;make</tt>) will compile
   556 The standard compilation procedure (<tt>./configure;make</tt>) will compile
   557 them, as well. 
   557 them, as well.
   558 */
   558 */
   559 
   559