0
4
0
... | ... |
@@ -441,37 +441,39 @@ |
441 | 441 |
} |
442 | 442 |
|
443 | 443 |
/// \brief Returns a const reference to the elevator. |
444 | 444 |
/// |
445 | 445 |
/// Returns a const reference to the elevator. |
446 | 446 |
/// |
447 | 447 |
/// \pre Either \ref run() or \ref init() must be called before |
448 | 448 |
/// using this function. |
449 | 449 |
const Elevator& elevator() const { |
450 | 450 |
return *_level; |
451 | 451 |
} |
452 | 452 |
|
453 |
/// \brief Sets the tolerance used by algorithm. |
|
453 |
/// \brief Sets the tolerance used by the algorithm. |
|
454 | 454 |
/// |
455 |
/// Sets the tolerance used by algorithm. |
|
456 |
Circulation& tolerance(const Tolerance& tolerance) const { |
|
455 |
/// Sets the tolerance object used by the algorithm. |
|
456 |
/// \return <tt>(*this)</tt> |
|
457 |
Circulation& tolerance(const Tolerance& tolerance) { |
|
457 | 458 |
_tol = tolerance; |
458 | 459 |
return *this; |
459 | 460 |
} |
460 | 461 |
|
461 | 462 |
/// \brief Returns a const reference to the tolerance. |
462 | 463 |
/// |
463 |
/// Returns a const reference to the tolerance |
|
464 |
/// Returns a const reference to the tolerance object used by |
|
465 |
/// the algorithm. |
|
464 | 466 |
const Tolerance& tolerance() const { |
465 |
return |
|
467 |
return _tol; |
|
466 | 468 |
} |
467 | 469 |
|
468 | 470 |
/// \name Execution Control |
469 | 471 |
/// The simplest way to execute the algorithm is to call \ref run().\n |
470 | 472 |
/// If you need more control on the initial solution or the execution, |
471 | 473 |
/// first you have to call one of the \ref init() functions, then |
472 | 474 |
/// the \ref start() function. |
473 | 475 |
|
474 | 476 |
///@{ |
475 | 477 |
|
476 | 478 |
/// Initializes the internal data structures. |
477 | 479 |
... | ... |
@@ -88,25 +88,25 @@ |
88 | 88 |
|
89 | 89 |
}; |
90 | 90 |
|
91 | 91 |
|
92 | 92 |
/// \ingroup max_flow |
93 | 93 |
/// |
94 | 94 |
/// \brief %Preflow algorithm class. |
95 | 95 |
/// |
96 | 96 |
/// This class provides an implementation of Goldberg-Tarjan's \e preflow |
97 | 97 |
/// \e push-relabel algorithm producing a \ref max_flow |
98 | 98 |
/// "flow of maximum value" in a digraph. |
99 | 99 |
/// The preflow algorithms are the fastest known maximum |
100 |
/// flow algorithms. The current implementation |
|
100 |
/// flow algorithms. The current implementation uses a mixture of the |
|
101 | 101 |
/// \e "highest label" and the \e "bound decrease" heuristics. |
102 | 102 |
/// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$. |
103 | 103 |
/// |
104 | 104 |
/// The algorithm consists of two phases. After the first phase |
105 | 105 |
/// the maximum flow value and the minimum cut is obtained. The |
106 | 106 |
/// second phase constructs a feasible maximum flow on each arc. |
107 | 107 |
/// |
108 | 108 |
/// \tparam GR The type of the digraph the algorithm runs on. |
109 | 109 |
/// \tparam CAP The type of the capacity map. The default map |
110 | 110 |
/// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
111 | 111 |
#ifdef DOXYGEN |
112 | 112 |
template <typename GR, typename CAP, typename TR> |
... | ... |
@@ -362,37 +362,39 @@ |
362 | 362 |
} |
363 | 363 |
|
364 | 364 |
/// \brief Returns a const reference to the elevator. |
365 | 365 |
/// |
366 | 366 |
/// Returns a const reference to the elevator. |
367 | 367 |
/// |
368 | 368 |
/// \pre Either \ref run() or \ref init() must be called before |
369 | 369 |
/// using this function. |
370 | 370 |
const Elevator& elevator() const { |
371 | 371 |
return *_level; |
372 | 372 |
} |
373 | 373 |
|
374 |
/// \brief Sets the tolerance used by algorithm. |
|
374 |
/// \brief Sets the tolerance used by the algorithm. |
|
375 | 375 |
/// |
376 |
/// Sets the tolerance used by algorithm. |
|
377 |
Preflow& tolerance(const Tolerance& tolerance) const { |
|
376 |
/// Sets the tolerance object used by the algorithm. |
|
377 |
/// \return <tt>(*this)</tt> |
|
378 |
Preflow& tolerance(const Tolerance& tolerance) { |
|
378 | 379 |
_tolerance = tolerance; |
379 | 380 |
return *this; |
380 | 381 |
} |
381 | 382 |
|
382 | 383 |
/// \brief Returns a const reference to the tolerance. |
383 | 384 |
/// |
384 |
/// Returns a const reference to the tolerance |
|
385 |
/// Returns a const reference to the tolerance object used by |
|
386 |
/// the algorithm. |
|
385 | 387 |
const Tolerance& tolerance() const { |
386 |
return |
|
388 |
return _tolerance; |
|
387 | 389 |
} |
388 | 390 |
|
389 | 391 |
/// \name Execution Control |
390 | 392 |
/// The simplest way to execute the preflow algorithm is to use |
391 | 393 |
/// \ref run() or \ref runMinCut().\n |
392 | 394 |
/// If you need more control on the initial solution or the execution, |
393 | 395 |
/// first you have to call one of the \ref init() functions, then |
394 | 396 |
/// \ref startFirstPhase() and if you need it \ref startSecondPhase(). |
395 | 397 |
|
396 | 398 |
///@{ |
397 | 399 |
|
398 | 400 |
/// \brief Initializes the internal data structures. |
... | ... |
@@ -79,24 +79,29 @@ |
79 | 79 |
::SetElevator<Elev> |
80 | 80 |
::SetStandardElevator<LinkedElev> |
81 | 81 |
::Create CirculationType; |
82 | 82 |
CirculationType circ_test(g, lcap, ucap, supply); |
83 | 83 |
const CirculationType& const_circ_test = circ_test; |
84 | 84 |
|
85 | 85 |
circ_test |
86 | 86 |
.lowerMap(lcap) |
87 | 87 |
.upperMap(ucap) |
88 | 88 |
.supplyMap(supply) |
89 | 89 |
.flowMap(flow); |
90 | 90 |
|
91 |
const CirculationType::Elevator& elev = const_circ_test.elevator(); |
|
92 |
circ_test.elevator(const_cast<CirculationType::Elevator&>(elev)); |
|
93 |
CirculationType::Tolerance tol = const_circ_test.tolerance(); |
|
94 |
circ_test.tolerance(tol); |
|
95 |
|
|
91 | 96 |
circ_test.init(); |
92 | 97 |
circ_test.greedyInit(); |
93 | 98 |
circ_test.start(); |
94 | 99 |
circ_test.run(); |
95 | 100 |
|
96 | 101 |
v = const_circ_test.flow(a); |
97 | 102 |
const FlowMap& fm = const_circ_test.flowMap(); |
98 | 103 |
b = const_circ_test.barrier(n); |
99 | 104 |
const_circ_test.barrierMap(bar); |
100 | 105 |
|
101 | 106 |
ignore_unused_variable_warning(fm); |
102 | 107 |
} |
... | ... |
@@ -86,24 +86,29 @@ |
86 | 86 |
CutMap cut; |
87 | 87 |
VType v; |
88 | 88 |
bool b; |
89 | 89 |
|
90 | 90 |
typedef Preflow<Digraph, CapMap> |
91 | 91 |
::SetFlowMap<FlowMap> |
92 | 92 |
::SetElevator<Elev> |
93 | 93 |
::SetStandardElevator<LinkedElev> |
94 | 94 |
::Create PreflowType; |
95 | 95 |
PreflowType preflow_test(g, cap, n, n); |
96 | 96 |
const PreflowType& const_preflow_test = preflow_test; |
97 | 97 |
|
98 |
const PreflowType::Elevator& elev = const_preflow_test.elevator(); |
|
99 |
preflow_test.elevator(const_cast<PreflowType::Elevator&>(elev)); |
|
100 |
PreflowType::Tolerance tol = const_preflow_test.tolerance(); |
|
101 |
preflow_test.tolerance(tol); |
|
102 |
|
|
98 | 103 |
preflow_test |
99 | 104 |
.capacityMap(cap) |
100 | 105 |
.flowMap(flow) |
101 | 106 |
.source(n) |
102 | 107 |
.target(n); |
103 | 108 |
|
104 | 109 |
preflow_test.init(); |
105 | 110 |
preflow_test.init(cap); |
106 | 111 |
preflow_test.startFirstPhase(); |
107 | 112 |
preflow_test.startSecondPhase(); |
108 | 113 |
preflow_test.run(); |
109 | 114 |
preflow_test.runMinCut(); |
0 comments (0 inline)