gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge
0 7 0
merge default
0 files changed with 146 insertions and 118 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1 1
LEMON code without an explicit copyright notice is covered by the following
2 2
copyright/license.
3 3

	
4
Copyright (C) 2003-2009 Egervary Jeno Kombinatorikus Optimalizalasi
4
Copyright (C) 2003-2010 Egervary Jeno Kombinatorikus Optimalizalasi
5 5
Kutatocsoport (Egervary Combinatorial Optimization Research Group,
6 6
EGRES).
7 7

	
8 8
===========================================================================
9 9
Boost Software License, Version 1.0
10 10
===========================================================================
11 11

	
12 12
Permission is hereby granted, free of charge, to any person or organization
13 13
obtaining a copy of the software and accompanying documentation covered by
14 14
this license (the "Software") to use, reproduce, display, distribute,
15 15
execute, and transmit the Software, and to prepare derivative works of the
16 16
Software, and to permit third-parties to whom the Software is furnished to
17 17
do so, all subject to the following:
18 18

	
19 19
The copyright notices in the Software and this entire statement, including
20 20
the above license grant, this restriction and the following disclaimer,
21 21
must be included in all copies of the Software, in whole or in part, and
22 22
all derivative works of the Software, unless such copies or derivative
23 23
works are solely in the form of machine-executable object code generated by
24 24
a source language processor.
25 25

	
26 26
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 27
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 28
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29 29
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30 30
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31 31
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 32
DEALINGS IN THE SOFTWARE.
Ignore white space 6 line context
1
2010-03-19 Version 1.2 released
2

	
3
        This is major feature release
4

	
5
        * New algorithms
6
          * Bellman-Ford algorithm (#51)
7
          * Minimum mean cycle algorithms (#179)
8
            * Karp, Hartman-Orlin and Howard algorithms
9
          * New minimum cost flow algorithms (#180)
10
            * Cost Scaling algorithms
11
            * Capacity Scaling algorithm
12
            * Cycle-Canceling algorithms
13
          * Planarity related algorithms (#62)
14
            * Planarity checking algorithm
15
            * Planar embedding algorithm
16
            * Schnyder's planar drawing algorithm
17
            * Coloring planar graphs with five or six colors
18
          * Fractional matching algorithms (#314)
19
        * New data structures
20
          * StaticDigraph structure (#68)
21
          * Several new priority queue structures (#50, #301)
22
            * Fibonacci, Radix, Bucket, Pairing, Binomial
23
              D-ary and fourary heaps (#301)
24
          * Iterable map structures (#73)
25
        * Other new tools and functionality
26
          * Map utility functions (#320)
27
          * Reserve functions are added to ListGraph and SmartGraph (#311)
28
          * A resize() function is added to HypercubeGraph (#311)
29
          * A count() function is added to CrossRefMap (#302)
30
          * Support for multiple targets in Suurballe using fullInit() (#181)
31
          * Traits class and named parameters for Suurballe (#323)
32
          * Separate reset() and resetParams() functions in NetworkSimplex
33
            to handle graph changes (#327)
34
          * tolerance() functions are added to HaoOrlin (#306)
35
        * Implementation improvements
36
          * Improvements in weighted matching algorithms (#314)
37
            * Jumpstart initialization
38
          * ArcIt iteration is based on out-arc lists instead of in-arc lists
39
            in ListDigraph (#311)
40
          * Faster add row operation in CbcMip (#203)
41
          * Better implementation for split() in ListDigraph (#311)
42
          * ArgParser can also throw exception instead of exit(1) (#332)
43
        * Miscellaneous
44
          * A simple interactive bootstrap script
45
          * Doc improvements (#62,#180,#299,#302,#303,#304,#307,#311,#331,#315,
46
                #316,#319)
47
            * BibTeX references in the doc (#184)
48
          * Optionally use valgrind when running tests
49
          * Also check ReferenceMapTag in concept checks (#312)
50
          * dimacs-solver uses long long type by default.
51
        * Several bugfixes (compared to release 1.1):
52
          #295: Suppress MSVC warnings using pragmas
53
          ----: Various CMAKE related improvements
54
                * Remove duplications from doc/CMakeLists.txt
55
                * Rename documentation install folder from 'docs' to 'html'
56
                * Add tools/CMakeLists.txt to the tarball
57
                * Generate and install LEMONConfig.cmake
58
                * Change the label of the html project in Visual Studio
59
                * Fix the check for the 'long long' type
60
                * Put the version string into config.h
61
                * Minor CMake improvements
62
                * Set the version to 'hg-tip' if everything fails
63
          #311: Add missing 'explicit' keywords
64
          #302: Fix the implementation and doc of CrossRefMap
65
          #308: Remove duplicate list_graph.h entry from source list
66
          #307: Bugfix in Preflow and Circulation
67
          #305: Bugfix and extension in the rename script
68
          #312: Also check ReferenceMapTag in concept checks
69
          #250: Bugfix in pathSource() and pathTarget()
70
          #321: Use pathCopy(from,to) instead of copyPath(to,from)
71
          #322: Distribure LEMONConfig.cmake.in
72
          #330: Bug fix in map_extender.h
73
          #336: Fix the date field comment of graphToEps() output
74
          #323: Bug fix in Suurballe
75
          #335: Fix clear() function in ExtendFindEnum
76
          #337: Use void* as the LPX object pointer
77
          #317: Fix (and improve) error message in mip_test.cc
78
                Remove unnecessary OsiCbc dependency
79
          #356: Allow multiple executions of weighted matching algorithms (#356)
80

	
1 81
2009-05-13 Version 1.1 released
2 82

	
3 83
        This is the second stable release of the 1.x series. It
4 84
        features a better coverage of the tools available in the 0.x
5 85
        series, a thoroughly reworked LP/MIP interface plus various
6 86
        improvements in the existing tools.
7 87

	
8 88
        * Much improved M$ Windows support
9 89
          * Various improvements in the CMAKE build system
10 90
          * Compilation warnings are fixed/suppressed
11 91
        * Support IBM xlC compiler
12 92
        * New algorithms
13 93
          * Connectivity related algorithms (#61)
14 94
          * Euler walks (#65)
15 95
          * Preflow push-relabel max. flow algorithm (#176)
16 96
          * Circulation algorithm (push-relabel based) (#175)
17 97
          * Suurballe algorithm (#47)
18 98
          * Gomory-Hu algorithm (#66)
19 99
          * Hao-Orlin algorithm (#58)
20 100
          * Edmond's maximum cardinality and weighted matching algorithms
21 101
            in general graphs (#48,#265)
22 102
          * Minimum cost arborescence/branching (#60)
23 103
          * Network Simplex min. cost flow algorithm (#234)
24 104
        * New data structures
25 105
          * Full graph structure (#57)
26 106
          * Grid graph structure (#57)
27 107
          * Hypercube graph structure (#57)
28 108
          * Graph adaptors (#67)
29 109
          * ArcSet and EdgeSet classes (#67)
30 110
          * Elevator class (#174)
31 111
        * Other new tools
32 112
          * LP/MIP interface (#44)
33 113
            * Support for GLPK, CPLEX, Soplex, COIN-OR CLP and CBC
34 114
          * Reader for the Nauty file format (#55)
35 115
          * DIMACS readers (#167)
36 116
          * Radix sort algorithms (#72)
37 117
          * RangeIdMap and CrossRefMap (#160)
38 118
        * New command line tools
39 119
          * DIMACS to LGF converter (#182)
40 120
          * lgf-gen - a graph generator (#45)
41 121
          * DIMACS solver utility (#226)
42 122
        * Other code improvements
43 123
          * Lognormal distribution added to Random (#102)
44 124
          * Better (i.e. O(1) time) item counting in SmartGraph (#3)
45 125
          * The standard maps of graphs are guaranteed to be
46 126
            reference maps (#190)
47 127
        * Miscellaneous
48 128
          * Various doc improvements
49 129
          * Improved 0.x -> 1.x converter script
50 130

	
51 131
        * Several bugfixes (compared to release 1.0):
52 132
          #170: Bugfix SmartDigraph::split()
53 133
          #171: Bugfix in SmartGraph::restoreSnapshot()
54 134
          #172: Extended test cases for graphs and digraphs
55 135
          #173: Bugfix in Random
56 136
                * operator()s always return a double now
57 137
                * the faulty real<Num>(Num) and real<Num>(Num,Num)
58 138
                  have been removed
59 139
          #187: Remove DijkstraWidestPathOperationTraits
60 140
          #61:  Bugfix in DfsVisit
61 141
          #193: Bugfix in GraphReader::skipSection()
62 142
          #195: Bugfix in ConEdgeIt()
63 143
          #197: Bugfix in heap unionfind
64 144
                * This bug affects Edmond's general matching algorithms
65 145
          #207: Fix 'make install' without 'make html' using CMAKE
66 146
          #208: Suppress or fix VS2008 compilation warnings
67 147
          ----: Update the LEMON icon
68 148
          ----: Enable the component-based installer
69 149
                (in installers made by CPACK)
70 150
          ----: Set the proper version for CMAKE in the tarballs
71 151
                (made by autotools)
72 152
          ----: Minor clarification in the LICENSE file
73 153
          ----: Add missing unistd.h include to time_measure.h
74 154
          #204: Compilation bug fixed in graph_to_eps.h with VS2005
75
          #214,#215: windows.h should never be included by lemon headers
155
          #214,#215: windows.h should never be included by LEMON headers
76 156
          #230: Build systems check the availability of 'long long' type
77 157
          #229: Default implementation of Tolerance<> is used for integer types
78 158
          #211,#212: Various fixes for compiling on AIX
79 159
          ----: Improvements in CMAKE config
80 160
                - docs is installed in share/doc/
81 161
                - detects newer versions of Ghostscript
82 162
          #239: Fix missing 'inline' specifier in time_measure.h
83 163
          #274,#280: Install lemon/config.h
84 164
          #275: Prefix macro names with LEMON_ in lemon/config.h
85 165
          ----: Small script for making the release tarballs added
86 166
          ----: Minor improvement in unify-sources.sh (a76f55d7d397)
87 167

	
88 168
2009-03-27 LEMON joins to the COIN-OR initiative
89 169

	
90 170
        COIN-OR (Computational Infrastructure for Operations Research,
91 171
        http://www.coin-or.org) project is an initiative to spur the
92 172
        development of open-source software for the operations research
93 173
        community.
94 174

	
95 175
2008-10-13 Version 1.0 released
96 176

	
97
	This is the first stable release of LEMON. Compared to the 0.x
98
	release series, it features a considerably smaller but more
99
	matured set of tools. The API has also completely revised and
100
	changed in several places.
177
        This is the first stable release of LEMON. Compared to the 0.x
178
        release series, it features a considerably smaller but more
179
        matured set of tools. The API has also completely revised and
180
        changed in several places.
101 181

	
102
	* The major name changes compared to the 0.x series (see the
182
        * The major name changes compared to the 0.x series (see the
103 183
          Migration Guide in the doc for more details)
104 184
          * Graph -> Digraph, UGraph -> Graph
105 185
          * Edge -> Arc, UEdge -> Edge
106
	  * source(UEdge)/target(UEdge) -> u(Edge)/v(Edge)
107
	* Other improvements
108
	  * Better documentation
109
	  * Reviewed and cleaned up codebase
110
	  * CMake based build system (along with the autotools based one)
111
	* Contents of the library (ported from 0.x)
112
	  * Algorithms
113
       	    * breadth-first search (bfs.h)
114
       	    * depth-first search (dfs.h)
115
       	    * Dijkstra's algorithm (dijkstra.h)
116
       	    * Kruskal's algorithm (kruskal.h)
117
    	  * Data structures
118
       	    * graph data structures (list_graph.h, smart_graph.h)
119
       	    * path data structures (path.h)
120
       	    * binary heap data structure (bin_heap.h)
121
       	    * union-find data structures (unionfind.h)
122
       	    * miscellaneous property maps (maps.h)
123
       	    * two dimensional vector and bounding box (dim2.h)
186
          * source(UEdge)/target(UEdge) -> u(Edge)/v(Edge)
187
        * Other improvements
188
          * Better documentation
189
          * Reviewed and cleaned up codebase
190
          * CMake based build system (along with the autotools based one)
191
        * Contents of the library (ported from 0.x)
192
          * Algorithms
193
            * breadth-first search (bfs.h)
194
            * depth-first search (dfs.h)
195
            * Dijkstra's algorithm (dijkstra.h)
196
            * Kruskal's algorithm (kruskal.h)
197
          * Data structures
198
            * graph data structures (list_graph.h, smart_graph.h)
199
            * path data structures (path.h)
200
            * binary heap data structure (bin_heap.h)
201
            * union-find data structures (unionfind.h)
202
            * miscellaneous property maps (maps.h)
203
            * two dimensional vector and bounding box (dim2.h)
124 204
          * Concepts
125
       	    * graph structure concepts (concepts/digraph.h, concepts/graph.h,
205
            * graph structure concepts (concepts/digraph.h, concepts/graph.h,
126 206
              concepts/graph_components.h)
127
       	    * concepts for other structures (concepts/heap.h, concepts/maps.h,
128
	      concepts/path.h)
129
    	  * Tools
130
       	    * Mersenne twister random number generator (random.h)
131
       	    * tools for measuring cpu and wall clock time (time_measure.h)
132
       	    * tools for counting steps and events (counter.h)
133
       	    * tool for parsing command line arguments (arg_parser.h)
134
       	    * tool for visualizing graphs (graph_to_eps.h)
135
       	    * tools for reading and writing data in LEMON Graph Format
207
            * concepts for other structures (concepts/heap.h, concepts/maps.h,
208
              concepts/path.h)
209
          * Tools
210
            * Mersenne twister random number generator (random.h)
211
            * tools for measuring cpu and wall clock time (time_measure.h)
212
            * tools for counting steps and events (counter.h)
213
            * tool for parsing command line arguments (arg_parser.h)
214
            * tool for visualizing graphs (graph_to_eps.h)
215
            * tools for reading and writing data in LEMON Graph Format
136 216
              (lgf_reader.h, lgf_writer.h)
137 217
            * tools to handle the anomalies of calculations with
138
	      floating point numbers (tolerance.h)
218
              floating point numbers (tolerance.h)
139 219
            * tools to manage RGB colors (color.h)
140
    	  * Infrastructure
141
       	    * extended assertion handling (assert.h)
142
       	    * exception classes and error handling (error.h)
143
      	    * concept checking (concept_check.h)
144
       	    * commonly used mathematical constants (math.h)
220
          * Infrastructure
221
            * extended assertion handling (assert.h)
222
            * exception classes and error handling (error.h)
223
            * concept checking (concept_check.h)
224
            * commonly used mathematical constants (math.h)
Ignore white space 6 line context
... ...
@@ -218,104 +218,96 @@
218 218
  Dijkstra<Digraph, TimeMap> dijkstra(graph, time);
219 219
  dijkstra.run(source, target);
220 220
\endcode
221 221
We have a length map and a maximum speed map on the arcs of a digraph.
222 222
The minimum time to pass the arc can be calculated as the division of
223 223
the two maps which can be done implicitly with the \c DivMap template
224 224
class. We use the implicit minimum time map as the length map of the
225 225
\c Dijkstra algorithm.
226 226
*/
227 227

	
228 228
/**
229 229
@defgroup paths Path Structures
230 230
@ingroup datas
231 231
\brief %Path structures implemented in LEMON.
232 232

	
233 233
This group contains the path structures implemented in LEMON.
234 234

	
235 235
LEMON provides flexible data structures to work with paths.
236 236
All of them have similar interfaces and they can be copied easily with
237 237
assignment operators and copy constructors. This makes it easy and
238 238
efficient to have e.g. the Dijkstra algorithm to store its result in
239 239
any kind of path structure.
240 240

	
241 241
\sa \ref concepts::Path "Path concept"
242 242
*/
243 243

	
244 244
/**
245 245
@defgroup heaps Heap Structures
246 246
@ingroup datas
247 247
\brief %Heap structures implemented in LEMON.
248 248

	
249 249
This group contains the heap structures implemented in LEMON.
250 250

	
251 251
LEMON provides several heap classes. They are efficient implementations
252 252
of the abstract data type \e priority \e queue. They store items with
253 253
specified values called \e priorities in such a way that finding and
254 254
removing the item with minimum priority are efficient.
255 255
The basic operations are adding and erasing items, changing the priority
256 256
of an item, etc.
257 257

	
258 258
Heaps are crucial in several algorithms, such as Dijkstra and Prim.
259 259
The heap implementations have the same interface, thus any of them can be
260 260
used easily in such algorithms.
261 261

	
262 262
\sa \ref concepts::Heap "Heap concept"
263 263
*/
264 264

	
265 265
/**
266
@defgroup matrices Matrices
267
@ingroup datas
268
\brief Two dimensional data storages implemented in LEMON.
269

	
270
This group contains two dimensional data storages implemented in LEMON.
271
*/
272

	
273
/**
274 266
@defgroup auxdat Auxiliary Data Structures
275 267
@ingroup datas
276 268
\brief Auxiliary data structures implemented in LEMON.
277 269

	
278 270
This group contains some data structures implemented in LEMON in
279 271
order to make it easier to implement combinatorial algorithms.
280 272
*/
281 273

	
282 274
/**
283 275
@defgroup geomdat Geometric Data Structures
284 276
@ingroup auxdat
285 277
\brief Geometric data structures implemented in LEMON.
286 278

	
287 279
This group contains geometric data structures implemented in LEMON.
288 280

	
289 281
 - \ref lemon::dim2::Point "dim2::Point" implements a two dimensional
290 282
   vector with the usual operations.
291 283
 - \ref lemon::dim2::Box "dim2::Box" can be used to determine the
292 284
   rectangular bounding box of a set of \ref lemon::dim2::Point
293 285
   "dim2::Point"'s.
294 286
*/
295 287

	
296 288
/**
297 289
@defgroup matrices Matrices
298 290
@ingroup auxdat
299 291
\brief Two dimensional data storages implemented in LEMON.
300 292

	
301 293
This group contains two dimensional data storages implemented in LEMON.
302 294
*/
303 295

	
304 296
/**
305 297
@defgroup algs Algorithms
306 298
\brief This group contains the several algorithms
307 299
implemented in LEMON.
308 300

	
309 301
This group contains the several algorithms
310 302
implemented in LEMON.
311 303
*/
312 304

	
313 305
/**
314 306
@defgroup search Graph Search
315 307
@ingroup algs
316 308
\brief Common graph search algorithms.
317 309

	
318 310
This group contains the common graph search algorithms, namely
319 311
\e breadth-first \e search (BFS) and \e depth-first \e search (DFS)
320 312
\ref clrs01algorithms.
321 313
*/
... ...
@@ -427,109 +419,109 @@
427 419
\brief Algorithms for finding minimum cut in graphs.
428 420

	
429 421
This group contains the algorithms for finding minimum cut in graphs.
430 422

	
431 423
The \e minimum \e cut \e problem is to find a non-empty and non-complete
432 424
\f$X\f$ subset of the nodes with minimum overall capacity on
433 425
outgoing arcs. Formally, there is a \f$G=(V,A)\f$ digraph, a
434 426
\f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum
435 427
cut is the \f$X\f$ solution of the next optimization problem:
436 428

	
437 429
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}
438 430
    \sum_{uv\in A: u\in X, v\not\in X}cap(uv) \f]
439 431

	
440 432
LEMON contains several algorithms related to minimum cut problems:
441 433

	
442 434
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut
443 435
  in directed graphs.
444 436
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for
445 437
  calculating minimum cut in undirected graphs.
446 438
- \ref GomoryHu "Gomory-Hu tree computation" for calculating
447 439
  all-pairs minimum cut in undirected graphs.
448 440

	
449 441
If you want to find minimum cut just between two distinict nodes,
450 442
see the \ref max_flow "maximum flow problem".
451 443
*/
452 444

	
453 445
/**
454 446
@defgroup min_mean_cycle Minimum Mean Cycle Algorithms
455 447
@ingroup algs
456 448
\brief Algorithms for finding minimum mean cycles.
457 449

	
458 450
This group contains the algorithms for finding minimum mean cycles
459 451
\ref clrs01algorithms, \ref amo93networkflows.
460 452

	
461 453
The \e minimum \e mean \e cycle \e problem is to find a directed cycle
462 454
of minimum mean length (cost) in a digraph.
463 455
The mean length of a cycle is the average length of its arcs, i.e. the
464 456
ratio between the total length of the cycle and the number of arcs on it.
465 457

	
466 458
This problem has an important connection to \e conservative \e length
467 459
\e functions, too. A length function on the arcs of a digraph is called
468 460
conservative if and only if there is no directed cycle of negative total
469 461
length. For an arbitrary length function, the negative of the minimum
470 462
cycle mean is the smallest \f$\epsilon\f$ value so that increasing the
471 463
arc lengths uniformly by \f$\epsilon\f$ results in a conservative length
472 464
function.
473 465

	
474 466
LEMON contains three algorithms for solving the minimum mean cycle problem:
475
- \ref Karp "Karp"'s original algorithm \ref amo93networkflows,
467
- \ref KarpMmc Karp's original algorithm \ref amo93networkflows,
476 468
  \ref dasdan98minmeancycle.
477
- \ref HartmannOrlin "Hartmann-Orlin"'s algorithm, which is an improved
469
- \ref HartmannOrlinMmc Hartmann-Orlin's algorithm, which is an improved
478 470
  version of Karp's algorithm \ref dasdan98minmeancycle.
479
- \ref Howard "Howard"'s policy iteration algorithm
471
- \ref HowardMmc Howard's policy iteration algorithm
480 472
  \ref dasdan98minmeancycle.
481 473

	
482
In practice, the Howard algorithm proved to be by far the most efficient
483
one, though the best known theoretical bound on its running time is
484
exponential.
485
Both Karp and HartmannOrlin algorithms run in time O(ne) and use space
486
O(n<sup>2</sup>+e), but the latter one is typically faster due to the
487
applied early termination scheme.
474
In practice, the \ref HowardMmc "Howard" algorithm proved to be by far the
475
most efficient one, though the best known theoretical bound on its running
476
time is exponential.
477
Both \ref KarpMmc "Karp" and \ref HartmannOrlinMmc "Hartmann-Orlin" algorithms
478
run in time O(ne) and use space O(n<sup>2</sup>+e), but the latter one is
479
typically faster due to the applied early termination scheme.
488 480
*/
489 481

	
490 482
/**
491 483
@defgroup matching Matching Algorithms
492 484
@ingroup algs
493 485
\brief Algorithms for finding matchings in graphs and bipartite graphs.
494 486

	
495 487
This group contains the algorithms for calculating
496 488
matchings in graphs and bipartite graphs. The general matching problem is
497 489
finding a subset of the edges for which each node has at most one incident
498 490
edge.
499 491

	
500 492
There are several different algorithms for calculate matchings in
501 493
graphs.  The matching problems in bipartite graphs are generally
502 494
easier than in general graphs. The goal of the matching optimization
503 495
can be finding maximum cardinality, maximum weight or minimum cost
504 496
matching. The search can be constrained to find perfect or
505 497
maximum cardinality matching.
506 498

	
507 499
The matching algorithms implemented in LEMON:
508 500
- \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm
509 501
  for calculating maximum cardinality matching in bipartite graphs.
510 502
- \ref PrBipartiteMatching Push-relabel algorithm
511 503
  for calculating maximum cardinality matching in bipartite graphs.
512 504
- \ref MaxWeightedBipartiteMatching
513 505
  Successive shortest path algorithm for calculating maximum weighted
514 506
  matching and maximum weighted bipartite matching in bipartite graphs.
515 507
- \ref MinCostMaxBipartiteMatching
516 508
  Successive shortest path algorithm for calculating minimum cost maximum
517 509
  matching in bipartite graphs.
518 510
- \ref MaxMatching Edmond's blossom shrinking algorithm for calculating
519 511
  maximum cardinality matching in general graphs.
520 512
- \ref MaxWeightedMatching Edmond's blossom shrinking algorithm for calculating
521 513
  maximum weighted matching in general graphs.
522 514
- \ref MaxWeightedPerfectMatching
523 515
  Edmond's blossom shrinking algorithm for calculating maximum weighted
524 516
  perfect matching in general graphs.
525 517
- \ref MaxFractionalMatching Push-relabel algorithm for calculating
526 518
  maximum cardinality fractional matching in general graphs.
527 519
- \ref MaxWeightedFractionalMatching Augmenting path algorithm for calculating
528 520
  maximum weighted fractional matching in general graphs.
529 521
- \ref MaxWeightedPerfectFractionalMatching
530 522
  Augmenting path algorithm for calculating maximum weighted
531 523
  perfect fractional matching in general graphs.
532 524

	
533 525
\image html matching.png
534 526
\image latex matching.eps "Min Cost Perfect Matching" width=\textwidth
535 527
*/
Ignore white space 6 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2010
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_ARG_PARSER_H
20 20
#define LEMON_ARG_PARSER_H
21 21

	
22 22
#include <vector>
23 23
#include <map>
24 24
#include <list>
25 25
#include <string>
26 26
#include <iostream>
27 27
#include <sstream>
28 28
#include <algorithm>
29 29
#include <lemon/assert.h>
30 30

	
31 31
///\ingroup misc
32 32
///\file
33 33
///\brief A tool to parse command line arguments.
34 34

	
35 35
namespace lemon {
36 36

	
37 37
  ///Exception used by ArgParser
38

	
39
  ///Exception used by ArgParser.
40
  ///
38 41
  class ArgParserException : public Exception {
39 42
  public:
43
    /// Reasons for failure
44

	
45
    /// Reasons for failure.
46
    ///
40 47
    enum Reason {
41
      HELP,         /// <tt>--help</tt> option was given
42
      UNKNOWN_OPT,  /// Unknown option was given
43
      INVALID_OPT   /// Invalid combination of options
48
      HELP,         ///< <tt>--help</tt> option was given.
49
      UNKNOWN_OPT,  ///< Unknown option was given.
50
      INVALID_OPT   ///< Invalid combination of options.
44 51
    };
45 52

	
46 53
  private:
47 54
    Reason _reason;
48 55

	
49 56
  public:
50 57
    ///Constructor
51 58
    ArgParserException(Reason r) throw() : _reason(r) {}
52 59
    ///Virtual destructor
53 60
    virtual ~ArgParserException() throw() {}
54 61
    ///A short description of the exception
55 62
    virtual const char* what() const throw() {
56 63
      switch(_reason)
57 64
        {
58 65
        case HELP:
59 66
          return "lemon::ArgParseException: ask for help";
60 67
          break;
61 68
        case UNKNOWN_OPT:
62 69
          return "lemon::ArgParseException: unknown option";
63 70
          break;
64 71
        case INVALID_OPT:
65 72
          return "lemon::ArgParseException: invalid combination of options";
66 73
          break;
67 74
        }
68 75
      return "";
69 76
    }
70 77
    ///Return the reason for the failure
71 78
    Reason reason() const {return _reason; }
72 79
  };
73 80

	
74 81

	
75 82
  ///Command line arguments parser
76 83

	
77 84
  ///\ingroup misc
78 85
  ///Command line arguments parser.
79 86
  ///
80 87
  ///For a complete example see the \ref arg_parser_demo.cc demo file.
81 88
  class ArgParser {
82 89

	
83 90
    static void _showHelp(void *p);
84 91
  protected:
85 92

	
86 93
    int _argc;
87 94
    const char * const *_argv;
88 95

	
89 96
    enum OptType { UNKNOWN=0, BOOL=1, STRING=2, DOUBLE=3, INTEGER=4, FUNC=5 };
90 97

	
91 98
    class ParData {
Ignore white space 6 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2010
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_BELLMAN_FORD_H
20 20
#define LEMON_BELLMAN_FORD_H
21 21

	
22 22
/// \ingroup shortest_path
23 23
/// \file
24 24
/// \brief Bellman-Ford algorithm.
25 25

	
26 26
#include <lemon/list_graph.h>
27 27
#include <lemon/bits/path_dump.h>
28 28
#include <lemon/core.h>
29 29
#include <lemon/error.h>
30 30
#include <lemon/maps.h>
31
#include <lemon/tolerance.h>
32 31
#include <lemon/path.h>
33 32

	
34 33
#include <limits>
35 34

	
36 35
namespace lemon {
37 36

	
38
  /// \brief Default operation traits for the BellmanFord algorithm class.
37
  /// \brief Default OperationTraits for the BellmanFord algorithm class.
39 38
  ///
40 39
  /// This operation traits class defines all computational operations
41 40
  /// and constants that are used in the Bellman-Ford algorithm.
42 41
  /// The default implementation is based on the \c numeric_limits class.
43 42
  /// If the numeric type does not have infinity value, then the maximum
44 43
  /// value is used as extremal infinity value.
45
  ///
46
  /// \see BellmanFordToleranceOperationTraits
47 44
  template <
48 45
    typename V,
49 46
    bool has_inf = std::numeric_limits<V>::has_infinity>
50 47
  struct BellmanFordDefaultOperationTraits {
51
    /// \brief Value type for the algorithm.
48
    /// \e
52 49
    typedef V Value;
53 50
    /// \brief Gives back the zero value of the type.
54 51
    static Value zero() {
55 52
      return static_cast<Value>(0);
56 53
    }
57 54
    /// \brief Gives back the positive infinity value of the type.
58 55
    static Value infinity() {
59 56
      return std::numeric_limits<Value>::infinity();
60 57
    }
61 58
    /// \brief Gives back the sum of the given two elements.
62 59
    static Value plus(const Value& left, const Value& right) {
63 60
      return left + right;
64 61
    }
65 62
    /// \brief Gives back \c true only if the first value is less than
66 63
    /// the second.
67 64
    static bool less(const Value& left, const Value& right) {
68 65
      return left < right;
69 66
    }
70 67
  };
71 68

	
72 69
  template <typename V>
73 70
  struct BellmanFordDefaultOperationTraits<V, false> {
74 71
    typedef V Value;
75 72
    static Value zero() {
76 73
      return static_cast<Value>(0);
77 74
    }
78 75
    static Value infinity() {
79 76
      return std::numeric_limits<Value>::max();
80 77
    }
81 78
    static Value plus(const Value& left, const Value& right) {
82 79
      if (left == infinity() || right == infinity()) return infinity();
83 80
      return left + right;
84 81
    }
85 82
    static bool less(const Value& left, const Value& right) {
86 83
      return left < right;
87 84
    }
88 85
  };
89 86

	
90
  /// \brief Operation traits for the BellmanFord algorithm class
91
  /// using tolerance.
92
  ///
93
  /// This operation traits class defines all computational operations
94
  /// and constants that are used in the Bellman-Ford algorithm.
95
  /// The only difference between this implementation and
96
  /// \ref BellmanFordDefaultOperationTraits is that this class uses
97
  /// the \ref Tolerance "tolerance technique" in its \ref less()
98
  /// function.
99
  ///
100
  /// \tparam V The value type.
101
  /// \tparam eps The epsilon value for the \ref less() function.
102
  /// By default, it is the epsilon value used by \ref Tolerance
103
  /// "Tolerance<V>".
104
  ///
105
  /// \see BellmanFordDefaultOperationTraits
106
#ifdef DOXYGEN
107
  template <typename V, V eps>
108
#else
109
  template <
110
    typename V,
111
    V eps = Tolerance<V>::def_epsilon>
112
#endif
113
  struct BellmanFordToleranceOperationTraits {
114
    /// \brief Value type for the algorithm.
115
    typedef V Value;
116
    /// \brief Gives back the zero value of the type.
117
    static Value zero() {
118
      return static_cast<Value>(0);
119
    }
120
    /// \brief Gives back the positive infinity value of the type.
121
    static Value infinity() {
122
      return std::numeric_limits<Value>::infinity();
123
    }
124
    /// \brief Gives back the sum of the given two elements.
125
    static Value plus(const Value& left, const Value& right) {
126
      return left + right;
127
    }
128
    /// \brief Gives back \c true only if the first value is less than
129
    /// the second.
130
    static bool less(const Value& left, const Value& right) {
131
      return left + eps < right;
132
    }
133
  };
134

	
135 87
  /// \brief Default traits class of BellmanFord class.
136 88
  ///
137 89
  /// Default traits class of BellmanFord class.
138 90
  /// \param GR The type of the digraph.
139 91
  /// \param LEN The type of the length map.
140 92
  template<typename GR, typename LEN>
141 93
  struct BellmanFordDefaultTraits {
142 94
    /// The type of the digraph the algorithm runs on.
143 95
    typedef GR Digraph;
144 96

	
145 97
    /// \brief The type of the map that stores the arc lengths.
146 98
    ///
147 99
    /// The type of the map that stores the arc lengths.
148 100
    /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
149 101
    typedef LEN LengthMap;
150 102

	
151 103
    /// The type of the arc lengths.
152 104
    typedef typename LEN::Value Value;
153 105

	
154 106
    /// \brief Operation traits for Bellman-Ford algorithm.
155 107
    ///
156 108
    /// It defines the used operations and the infinity value for the
157 109
    /// given \c Value type.
158
    /// \see BellmanFordDefaultOperationTraits,
159
    /// BellmanFordToleranceOperationTraits
110
    /// \see BellmanFordDefaultOperationTraits
160 111
    typedef BellmanFordDefaultOperationTraits<Value> OperationTraits;
161 112

	
162 113
    /// \brief The type of the map that stores the last arcs of the
163 114
    /// shortest paths.
164 115
    ///
165 116
    /// The type of the map that stores the last
166 117
    /// arcs of the shortest paths.
167 118
    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
168 119
    typedef typename GR::template NodeMap<typename GR::Arc> PredMap;
169 120

	
170 121
    /// \brief Instantiates a \c PredMap.
171 122
    ///
172 123
    /// This function instantiates a \ref PredMap.
173 124
    /// \param g is the digraph to which we would like to define the
174 125
    /// \ref PredMap.
175 126
    static PredMap *createPredMap(const GR& g) {
176 127
      return new PredMap(g);
177 128
    }
178 129

	
179 130
    /// \brief The type of the map that stores the distances of the nodes.
180 131
    ///
181 132
    /// The type of the map that stores the distances of the nodes.
182 133
    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
183 134
    typedef typename GR::template NodeMap<typename LEN::Value> DistMap;
184 135

	
185 136
    /// \brief Instantiates a \c DistMap.
186 137
    ///
187 138
    /// This function instantiates a \ref DistMap.
188 139
    /// \param g is the digraph to which we would like to define the
189 140
    /// \ref DistMap.
190 141
    static DistMap *createDistMap(const GR& g) {
191 142
      return new DistMap(g);
192 143
    }
193 144

	
194 145
  };
195 146

	
196 147
  /// \brief %BellmanFord algorithm class.
197 148
  ///
198 149
  /// \ingroup shortest_path
199 150
  /// This class provides an efficient implementation of the Bellman-Ford
200 151
  /// algorithm. The maximum time complexity of the algorithm is
201 152
  /// <tt>O(ne)</tt>.
202 153
  ///
203 154
  /// The Bellman-Ford algorithm solves the single-source shortest path
204 155
  /// problem when the arcs can have negative lengths, but the digraph
205 156
  /// should not contain directed cycles with negative total length.
206 157
  /// If all arc costs are non-negative, consider to use the Dijkstra
207 158
  /// algorithm instead, since it is more efficient.
... ...
@@ -841,98 +792,97 @@
841 792
      lemon::Path<Digraph> cycle;
842 793
      for (int i = 0; i < int(_process.size()); ++i) {
843 794
        if (state[_process[i]] != -1) continue;
844 795
        for (Node v = _process[i]; (*_pred)[v] != INVALID;
845 796
             v = _gr->source((*_pred)[v])) {
846 797
          if (state[v] == i) {
847 798
            cycle.addFront((*_pred)[v]);
848 799
            for (Node u = _gr->source((*_pred)[v]); u != v;
849 800
                 u = _gr->source((*_pred)[u])) {
850 801
              cycle.addFront((*_pred)[u]);
851 802
            }
852 803
            return cycle;
853 804
          }
854 805
          else if (state[v] >= 0) {
855 806
            break;
856 807
          }
857 808
          state[v] = i;
858 809
        }
859 810
      }
860 811
      return cycle;
861 812
    }
862 813

	
863 814
    ///@}
864 815
  };
865 816

	
866 817
  /// \brief Default traits class of bellmanFord() function.
867 818
  ///
868 819
  /// Default traits class of bellmanFord() function.
869 820
  /// \tparam GR The type of the digraph.
870 821
  /// \tparam LEN The type of the length map.
871 822
  template <typename GR, typename LEN>
872 823
  struct BellmanFordWizardDefaultTraits {
873 824
    /// The type of the digraph the algorithm runs on.
874 825
    typedef GR Digraph;
875 826

	
876 827
    /// \brief The type of the map that stores the arc lengths.
877 828
    ///
878 829
    /// The type of the map that stores the arc lengths.
879 830
    /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
880 831
    typedef LEN LengthMap;
881 832

	
882 833
    /// The type of the arc lengths.
883 834
    typedef typename LEN::Value Value;
884 835

	
885 836
    /// \brief Operation traits for Bellman-Ford algorithm.
886 837
    ///
887 838
    /// It defines the used operations and the infinity value for the
888 839
    /// given \c Value type.
889
    /// \see BellmanFordDefaultOperationTraits,
890
    /// BellmanFordToleranceOperationTraits
840
    /// \see BellmanFordDefaultOperationTraits
891 841
    typedef BellmanFordDefaultOperationTraits<Value> OperationTraits;
892 842

	
893 843
    /// \brief The type of the map that stores the last
894 844
    /// arcs of the shortest paths.
895 845
    ///
896 846
    /// The type of the map that stores the last arcs of the shortest paths.
897 847
    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
898 848
    typedef typename GR::template NodeMap<typename GR::Arc> PredMap;
899 849

	
900 850
    /// \brief Instantiates a \c PredMap.
901 851
    ///
902 852
    /// This function instantiates a \ref PredMap.
903 853
    /// \param g is the digraph to which we would like to define the
904 854
    /// \ref PredMap.
905 855
    static PredMap *createPredMap(const GR &g) {
906 856
      return new PredMap(g);
907 857
    }
908 858

	
909 859
    /// \brief The type of the map that stores the distances of the nodes.
910 860
    ///
911 861
    /// The type of the map that stores the distances of the nodes.
912 862
    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
913 863
    typedef typename GR::template NodeMap<Value> DistMap;
914 864

	
915 865
    /// \brief Instantiates a \c DistMap.
916 866
    ///
917 867
    /// This function instantiates a \ref DistMap.
918 868
    /// \param g is the digraph to which we would like to define the
919 869
    /// \ref DistMap.
920 870
    static DistMap *createDistMap(const GR &g) {
921 871
      return new DistMap(g);
922 872
    }
923 873

	
924 874
    ///The type of the shortest paths.
925 875

	
926 876
    ///The type of the shortest paths.
927 877
    ///It must meet the \ref concepts::Path "Path" concept.
928 878
    typedef lemon::Path<Digraph> Path;
929 879
  };
930 880

	
931 881
  /// \brief Default traits class used by BellmanFordWizard.
932 882
  ///
933 883
  /// Default traits class used by BellmanFordWizard.
934 884
  /// \tparam GR The type of the digraph.
935 885
  /// \tparam LEN The type of the length map.
936 886
  template <typename GR, typename LEN>
937 887
  class BellmanFordWizardBase
938 888
    : public BellmanFordWizardDefaultTraits<GR, LEN> {
Ignore white space 6 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2010
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_HARTMANN_ORLIN_MMC_H
20 20
#define LEMON_HARTMANN_ORLIN_MMC_H
21 21

	
22 22
/// \ingroup min_mean_cycle
23 23
///
24 24
/// \file
25 25
/// \brief Hartmann-Orlin's algorithm for finding a minimum mean cycle.
26 26

	
27 27
#include <vector>
28 28
#include <limits>
29 29
#include <lemon/core.h>
30 30
#include <lemon/path.h>
31 31
#include <lemon/tolerance.h>
32 32
#include <lemon/connectivity.h>
33 33

	
34 34
namespace lemon {
35 35

	
36 36
  /// \brief Default traits class of HartmannOrlinMmc class.
37 37
  ///
38 38
  /// Default traits class of HartmannOrlinMmc class.
39 39
  /// \tparam GR The type of the digraph.
40 40
  /// \tparam CM The type of the cost map.
41
  /// It must conform to the \ref concepts::Rea_data "Rea_data" concept.
41
  /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
42 42
#ifdef DOXYGEN
43 43
  template <typename GR, typename CM>
44 44
#else
45 45
  template <typename GR, typename CM,
46 46
    bool integer = std::numeric_limits<typename CM::Value>::is_integer>
47 47
#endif
48 48
  struct HartmannOrlinMmcDefaultTraits
49 49
  {
50 50
    /// The type of the digraph
51 51
    typedef GR Digraph;
52 52
    /// The type of the cost map
53 53
    typedef CM CostMap;
54 54
    /// The type of the arc costs
55 55
    typedef typename CostMap::Value Cost;
56 56

	
57 57
    /// \brief The large cost type used for internal computations
58 58
    ///
59 59
    /// The large cost type used for internal computations.
60 60
    /// It is \c long \c long if the \c Cost type is integer,
61 61
    /// otherwise it is \c double.
62 62
    /// \c Cost must be convertible to \c LargeCost.
63 63
    typedef double LargeCost;
64 64

	
65 65
    /// The tolerance type used for internal computations
66 66
    typedef lemon::Tolerance<LargeCost> Tolerance;
67 67

	
68 68
    /// \brief The path type of the found cycles
69 69
    ///
70 70
    /// The path type of the found cycles.
71 71
    /// It must conform to the \ref lemon::concepts::Path "Path" concept
72 72
    /// and it must have an \c addFront() function.
73 73
    typedef lemon::Path<Digraph> Path;
74 74
  };
75 75

	
76 76
  // Default traits class for integer cost types
77 77
  template <typename GR, typename CM>
78 78
  struct HartmannOrlinMmcDefaultTraits<GR, CM, true>
79 79
  {
80 80
    typedef GR Digraph;
81 81
    typedef CM CostMap;
82 82
    typedef typename CostMap::Value Cost;
83 83
#ifdef LEMON_HAVE_LONG_LONG
84 84
    typedef long long LargeCost;
85 85
#else
86 86
    typedef long LargeCost;
87 87
#endif
88 88
    typedef lemon::Tolerance<LargeCost> Tolerance;
89 89
    typedef lemon::Path<Digraph> Path;
90 90
  };
91 91

	
92 92

	
93 93
  /// \addtogroup min_mean_cycle
94 94
  /// @{
95 95

	
96 96
  /// \brief Implementation of the Hartmann-Orlin algorithm for finding
97 97
  /// a minimum mean cycle.
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 101
  /// \ref amo93networkflows, \ref dasdan98minmeancycle.
102
  /// It is an improved version of \ref Karp "Karp"'s original algorithm,
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).
105 105
  ///
106 106
  /// \tparam GR The type of the digraph the algorithm runs on.
107 107
  /// \tparam CM The type of the cost map. The default
108 108
  /// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>".
109 109
  /// \tparam TR The traits class that defines various types used by the
110 110
  /// algorithm. By default, it is \ref HartmannOrlinMmcDefaultTraits
111 111
  /// "HartmannOrlinMmcDefaultTraits<GR, CM>".
112 112
  /// In most cases, this parameter should not be set directly,
113 113
  /// consider to use the named template parameters instead.
114 114
#ifdef DOXYGEN
115 115
  template <typename GR, typename CM, typename TR>
116 116
#else
117 117
  template < typename GR,
118 118
             typename CM = typename GR::template ArcMap<int>,
119 119
             typename TR = HartmannOrlinMmcDefaultTraits<GR, CM> >
120 120
#endif
121 121
  class HartmannOrlinMmc
122 122
  {
123 123
  public:
124 124

	
125 125
    /// The type of the digraph
126 126
    typedef typename TR::Digraph Digraph;
127 127
    /// The type of the cost map
128 128
    typedef typename TR::CostMap CostMap;
129 129
    /// The type of the arc costs
130 130
    typedef typename TR::Cost Cost;
131 131

	
132 132
    /// \brief The large cost type
133 133
    ///
134 134
    /// The large cost type used for internal computations.
135 135
    /// By default, it is \c long \c long if the \c Cost type is integer,
136 136
    /// otherwise it is \c double.
137 137
    typedef typename TR::LargeCost LargeCost;
138 138

	
139 139
    /// The tolerance type
140 140
    typedef typename TR::Tolerance Tolerance;
141 141

	
142 142
    /// \brief The path type of the found cycles
143 143
    ///
144 144
    /// The path type of the found cycles.
145 145
    /// Using the \ref HartmannOrlinMmcDefaultTraits "default traits class",
146 146
    /// it is \ref lemon::Path "Path<Digraph>".
147 147
    typedef typename TR::Path Path;
148 148

	
149 149
    /// The \ref HartmannOrlinMmcDefaultTraits "traits class" of the algorithm
150 150
    typedef TR Traits;
Ignore white space 96 line context
... ...
@@ -59,97 +59,96 @@
59 59
  typedef concepts::ReadMap<Digraph::Arc,Value> LengthMap;
60 60
  typedef BellmanFord<Digraph, LengthMap> BF;
61 61
  typedef Digraph::Node Node;
62 62
  typedef Digraph::Arc Arc;
63 63

	
64 64
  Digraph gr;
65 65
  Node s, t, n;
66 66
  Arc e;
67 67
  Value l;
68 68
  int k=3;
69 69
  bool b;
70 70
  BF::DistMap d(gr);
71 71
  BF::PredMap p(gr);
72 72
  LengthMap length;
73 73
  concepts::Path<Digraph> pp;
74 74

	
75 75
  {
76 76
    BF bf_test(gr,length);
77 77
    const BF& const_bf_test = bf_test;
78 78

	
79 79
    bf_test.run(s);
80 80
    bf_test.run(s,k);
81 81

	
82 82
    bf_test.init();
83 83
    bf_test.addSource(s);
84 84
    bf_test.addSource(s, 1);
85 85
    b = bf_test.processNextRound();
86 86
    b = bf_test.processNextWeakRound();
87 87

	
88 88
    bf_test.start();
89 89
    bf_test.checkedStart();
90 90
    bf_test.limitedStart(k);
91 91

	
92 92
    l  = const_bf_test.dist(t);
93 93
    e  = const_bf_test.predArc(t);
94 94
    s  = const_bf_test.predNode(t);
95 95
    b  = const_bf_test.reached(t);
96 96
    d  = const_bf_test.distMap();
97 97
    p  = const_bf_test.predMap();
98 98
    pp = const_bf_test.path(t);
99 99
    pp = const_bf_test.negativeCycle();
100 100

	
101 101
    for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
102 102
  }
103 103
  {
104 104
    BF::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
105 105
      ::SetDistMap<concepts::ReadWriteMap<Node,Value> >
106 106
      ::SetOperationTraits<BellmanFordDefaultOperationTraits<Value> >
107
      ::SetOperationTraits<BellmanFordToleranceOperationTraits<Value, 0> >
108 107
      ::Create bf_test(gr,length);
109 108

	
110 109
    LengthMap length_map;
111 110
    concepts::ReadWriteMap<Node,Arc> pred_map;
112 111
    concepts::ReadWriteMap<Node,Value> dist_map;
113 112

	
114 113
    bf_test
115 114
      .lengthMap(length_map)
116 115
      .predMap(pred_map)
117 116
      .distMap(dist_map);
118 117

	
119 118
    bf_test.run(s);
120 119
    bf_test.run(s,k);
121 120

	
122 121
    bf_test.init();
123 122
    bf_test.addSource(s);
124 123
    bf_test.addSource(s, 1);
125 124
    b = bf_test.processNextRound();
126 125
    b = bf_test.processNextWeakRound();
127 126

	
128 127
    bf_test.start();
129 128
    bf_test.checkedStart();
130 129
    bf_test.limitedStart(k);
131 130

	
132 131
    l  = bf_test.dist(t);
133 132
    e  = bf_test.predArc(t);
134 133
    s  = bf_test.predNode(t);
135 134
    b  = bf_test.reached(t);
136 135
    pp = bf_test.path(t);
137 136
    pp = bf_test.negativeCycle();
138 137
  }
139 138
}
140 139

	
141 140
void checkBellmanFordFunctionCompile()
142 141
{
143 142
  typedef int Value;
144 143
  typedef concepts::Digraph Digraph;
145 144
  typedef Digraph::Arc Arc;
146 145
  typedef Digraph::Node Node;
147 146
  typedef concepts::ReadMap<Digraph::Arc,Value> LengthMap;
148 147

	
149 148
  Digraph g;
150 149
  bool b;
151 150
  bellmanFord(g,LengthMap()).run(Node());
152 151
  b = bellmanFord(g,LengthMap()).run(Node(),Node());
153 152
  bellmanFord(g,LengthMap())
154 153
    .predMap(concepts::ReadWriteMap<Node,Arc>())
155 154
    .distMap(concepts::ReadWriteMap<Node,Value>())
0 comments (0 inline)