!
!
!
42
42
139
139
9
5
2
2
1
1
2
2
10
10
4
3
41
41
9
5
7
7
89
89
10
10
11
11
2
2
46
46
11
11
15
15
2
2
4
4
31
31
12
12
54
53
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -27,3 +27,3 @@ |
27 | 27 |
data structures and algorithms with focus on combinatorial optimization |
28 |
tasks connected mainly with graphs and networks. |
|
28 |
tasks connected mainly with graphs and networks. |
|
29 | 29 |
|
... | ... |
@@ -37,3 +37,3 @@ |
37 | 37 |
|
38 |
The project is maintained by the |
|
38 |
The project is maintained by the |
|
39 | 39 |
<a href="http://www.cs.elte.hu/egres/">Egerváry Research Group on |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -83,3 +83,3 @@ |
83 | 83 |
then \f$\pi(u)=0\f$. |
84 |
|
|
84 |
|
|
85 | 85 |
Here \f$cost^\pi(uv)\f$ denotes the \e reduced \e cost of the arc |
... | ... |
@@ -121,3 +121,3 @@ |
121 | 121 |
|
122 |
It means that the total demand must be less or equal to the |
|
122 |
It means that the total demand must be less or equal to the |
|
123 | 123 |
total supply (i.e. \f$\sum_{u\in V} sup(u)\f$ must be zero or |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -423,3 +423,3 @@ |
423 | 423 |
_node_filter = &node_filter; |
424 |
_arc_filter = &arc_filter; |
|
424 |
_arc_filter = &arc_filter; |
|
425 | 425 |
} |
... | ... |
@@ -510,7 +510,7 @@ |
510 | 510 |
template <typename V> |
511 |
class NodeMap |
|
512 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
513 |
|
|
511 |
class NodeMap |
|
512 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
513 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { |
|
514 | 514 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
515 |
|
|
515 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
|
516 | 516 |
|
... | ... |
@@ -537,5 +537,5 @@ |
537 | 537 |
template <typename V> |
538 |
class ArcMap |
|
538 |
class ArcMap |
|
539 | 539 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
540 |
|
|
540 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { |
|
541 | 541 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
... | ... |
@@ -584,3 +584,3 @@ |
584 | 584 |
_node_filter = &node_filter; |
585 |
_arc_filter = &arc_filter; |
|
585 |
_arc_filter = &arc_filter; |
|
586 | 586 |
} |
... | ... |
@@ -653,6 +653,6 @@ |
653 | 653 |
template <typename V> |
654 |
class NodeMap |
|
654 |
class NodeMap |
|
655 | 655 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
656 | 656 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { |
657 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
657 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
658 | 658 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
... | ... |
@@ -680,3 +680,3 @@ |
680 | 680 |
template <typename V> |
681 |
class ArcMap |
|
681 |
class ArcMap |
|
682 | 682 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
... | ... |
@@ -1023,6 +1023,6 @@ |
1023 | 1023 |
template <typename V> |
1024 |
class NodeMap |
|
1024 |
class NodeMap |
|
1025 | 1025 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
1026 | 1026 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { |
1027 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1027 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1028 | 1028 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
... | ... |
@@ -1050,6 +1050,6 @@ |
1050 | 1050 |
template <typename V> |
1051 |
class ArcMap |
|
1051 |
class ArcMap |
|
1052 | 1052 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
1053 | 1053 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { |
1054 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1054 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1055 | 1055 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
... | ... |
@@ -1077,6 +1077,6 @@ |
1077 | 1077 |
template <typename V> |
1078 |
class EdgeMap |
|
1078 |
class EdgeMap |
|
1079 | 1079 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
1080 | 1080 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { |
1081 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1081 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
1082 | 1082 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
... | ... |
@@ -1119,4 +1119,4 @@ |
1119 | 1119 |
EF* _edge_filter; |
1120 |
SubGraphBase() |
|
1121 |
: Parent(), _node_filter(0), _edge_filter(0) { } |
|
1120 |
SubGraphBase() |
|
1121 |
: Parent(), _node_filter(0), _edge_filter(0) { } |
|
1122 | 1122 |
|
... | ... |
@@ -1221,6 +1221,6 @@ |
1221 | 1221 |
template <typename V> |
1222 |
class NodeMap |
|
1222 |
class NodeMap |
|
1223 | 1223 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
1224 | 1224 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { |
1225 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1225 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1226 | 1226 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
... | ... |
@@ -1248,6 +1248,6 @@ |
1248 | 1248 |
template <typename V> |
1249 |
class ArcMap |
|
1249 |
class ArcMap |
|
1250 | 1250 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
1251 | 1251 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { |
1252 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1252 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1253 | 1253 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
... | ... |
@@ -1275,7 +1275,7 @@ |
1275 | 1275 |
template <typename V> |
1276 |
class EdgeMap |
|
1276 |
class EdgeMap |
|
1277 | 1277 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
1278 | 1278 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { |
1279 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1280 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
1279 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
1280 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
1281 | 1281 |
|
... | ... |
@@ -1506,3 +1506,3 @@ |
1506 | 1506 |
typedef DigraphAdaptorExtender< |
1507 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, |
|
1507 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, |
|
1508 | 1508 |
true> > Parent; |
... | ... |
@@ -1527,3 +1527,3 @@ |
1527 | 1527 |
/// given node filter map. |
1528 |
FilterNodes(GR& graph, NF& node_filter) |
|
1528 |
FilterNodes(GR& graph, NF& node_filter) |
|
1529 | 1529 |
: Parent(), const_true_map() |
... | ... |
@@ -1565,3 +1565,3 @@ |
1565 | 1565 |
public GraphAdaptorExtender< |
1566 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
|
1566 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
|
1567 | 1567 |
true> > { |
... | ... |
@@ -1569,3 +1569,3 @@ |
1569 | 1569 |
typedef GraphAdaptorExtender< |
1570 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
|
1570 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
|
1571 | 1571 |
true> > Parent; |
... | ... |
@@ -1655,3 +1655,3 @@ |
1655 | 1655 |
typedef DigraphAdaptorExtender< |
1656 |
SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, |
|
1656 |
SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, |
|
1657 | 1657 |
AF, false> > Parent; |
... | ... |
@@ -1763,3 +1763,3 @@ |
1763 | 1763 |
public GraphAdaptorExtender< |
1764 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, |
|
1764 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, |
|
1765 | 1765 |
EF, false> > { |
... | ... |
@@ -1767,3 +1767,3 @@ |
1767 | 1767 |
typedef GraphAdaptorExtender< |
1768 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, |
|
1768 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, |
|
1769 | 1769 |
EF, false> > Parent; |
... | ... |
@@ -1792,3 +1792,3 @@ |
1792 | 1792 |
/// filter map. |
1793 |
FilterEdges(GR& graph, EF& edge_filter) |
|
1793 |
FilterEdges(GR& graph, EF& edge_filter) |
|
1794 | 1794 |
: Parent(), const_true_map() { |
... | ... |
@@ -1860,3 +1860,3 @@ |
1860 | 1860 |
|
1861 |
Arc(const Edge& edge, bool forward) |
|
1861 |
Arc(const Edge& edge, bool forward) |
|
1862 | 1862 |
: _edge(edge), _forward(forward) {} |
... | ... |
@@ -2100,3 +2100,3 @@ |
2100 | 2100 |
ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) |
2101 |
: _forward(*adaptor._digraph, value), |
|
2101 |
: _forward(*adaptor._digraph, value), |
|
2102 | 2102 |
_backward(*adaptor._digraph, value) {} |
... | ... |
@@ -2218,3 +2218,3 @@ |
2218 | 2218 |
EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } |
2219 |
|
|
2219 |
|
|
2220 | 2220 |
typedef EdgeNotifier ArcNotifier; |
... | ... |
@@ -2730,3 +2730,3 @@ |
2730 | 2730 |
typename TL = Tolerance<typename CM::Value> > |
2731 |
class ResidualDigraph |
|
2731 |
class ResidualDigraph |
|
2732 | 2732 |
: public SubDigraph< |
... | ... |
@@ -2787,3 +2787,3 @@ |
2787 | 2787 |
FM& flow, const TL& tolerance = Tolerance()) |
2788 |
: Parent(), _capacity(&capacity), _flow(&flow), |
|
2788 |
: Parent(), _capacity(&capacity), _flow(&flow), |
|
2789 | 2789 |
_graph(digraph), _node_filter(), |
... | ... |
@@ -2869,3 +2869,3 @@ |
2869 | 2869 |
/// Constructor |
2870 |
ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) |
|
2870 |
ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) |
|
2871 | 2871 |
: _adaptor(&adaptor) {} |
... | ... |
@@ -3449,3 +3449,3 @@ |
3449 | 3449 |
/// Its value type is inherited from the first node map type (\c IN). |
3450 |
/// \tparam IN The type of the node map for the in-nodes. |
|
3450 |
/// \tparam IN The type of the node map for the in-nodes. |
|
3451 | 3451 |
/// \tparam OUT The type of the node map for the out-nodes. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -44,6 +44,6 @@ |
44 | 44 |
}; |
45 |
|
|
45 |
|
|
46 | 46 |
private: |
47 | 47 |
Reason _reason; |
48 |
|
|
48 |
|
|
49 | 49 |
public: |
... | ... |
@@ -143,3 +143,3 @@ |
143 | 143 |
|
144 |
|
|
144 |
|
|
145 | 145 |
private: |
... | ... |
@@ -157,3 +157,3 @@ |
157 | 157 |
bool _exit_on_problems; |
158 |
|
|
158 |
|
|
159 | 159 |
void _terminate(ArgParserException::Reason reason) const; |
... | ... |
@@ -425,3 +425,3 @@ |
425 | 425 |
///Throw instead of exit in case of problems |
426 |
void throwOnProblems() |
|
426 |
void throwOnProblems() |
|
427 | 427 |
{ |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -38,3 +38,3 @@ |
38 | 38 |
/// \brief Default operation traits for the BellmanFord algorithm class. |
39 |
/// |
|
39 |
/// |
|
40 | 40 |
/// This operation traits class defines all computational operations |
... | ... |
@@ -47,3 +47,3 @@ |
47 | 47 |
template < |
48 |
typename V, |
|
48 |
typename V, |
|
49 | 49 |
bool has_inf = std::numeric_limits<V>::has_infinity> |
... | ... |
@@ -88,3 +88,3 @@ |
88 | 88 |
}; |
89 |
|
|
89 |
|
|
90 | 90 |
/// \brief Operation traits for the BellmanFord algorithm class |
... | ... |
@@ -141,3 +141,3 @@ |
141 | 141 |
struct BellmanFordDefaultTraits { |
142 |
/// The type of the digraph the algorithm runs on. |
|
142 |
/// The type of the digraph the algorithm runs on. |
|
143 | 143 |
typedef GR Digraph; |
... | ... |
@@ -160,6 +160,6 @@ |
160 | 160 |
typedef BellmanFordDefaultOperationTraits<Value> OperationTraits; |
161 |
|
|
162 |
/// \brief The type of the map that stores the last arcs of the |
|
161 |
|
|
162 |
/// \brief The type of the map that stores the last arcs of the |
|
163 | 163 |
/// shortest paths. |
164 |
/// |
|
164 |
/// |
|
165 | 165 |
/// The type of the map that stores the last |
... | ... |
@@ -170,4 +170,4 @@ |
170 | 170 |
/// \brief Instantiates a \c PredMap. |
171 |
/// |
|
172 |
/// This function instantiates a \ref PredMap. |
|
171 |
/// |
|
172 |
/// This function instantiates a \ref PredMap. |
|
173 | 173 |
/// \param g is the digraph to which we would like to define the |
... | ... |
@@ -186,4 +186,4 @@ |
186 | 186 |
/// |
187 |
/// This function instantiates a \ref DistMap. |
|
188 |
/// \param g is the digraph to which we would like to define the |
|
187 |
/// This function instantiates a \ref DistMap. |
|
188 |
/// \param g is the digraph to which we would like to define the |
|
189 | 189 |
/// \ref DistMap. |
... | ... |
@@ -194,3 +194,3 @@ |
194 | 194 |
}; |
195 |
|
|
195 |
|
|
196 | 196 |
/// \brief %BellmanFord algorithm class. |
... | ... |
@@ -198,3 +198,3 @@ |
198 | 198 |
/// \ingroup shortest_path |
199 |
/// This class provides an efficient implementation of the Bellman-Ford |
|
199 |
/// This class provides an efficient implementation of the Bellman-Ford |
|
200 | 200 |
/// algorithm. The maximum time complexity of the algorithm is |
... | ... |
@@ -209,3 +209,3 @@ |
209 | 209 |
/// The arc lengths are passed to the algorithm using a |
210 |
/// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any |
|
210 |
/// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any |
|
211 | 211 |
/// kind of length. The type of the length values is determined by the |
... | ... |
@@ -239,3 +239,3 @@ |
239 | 239 |
typedef typename TR::Digraph Digraph; |
240 |
|
|
240 |
|
|
241 | 241 |
/// \brief The type of the arc lengths. |
... | ... |
@@ -286,8 +286,8 @@ |
286 | 286 |
if(!_pred) { |
287 |
_local_pred = true; |
|
288 |
_pred = Traits::createPredMap(*_gr); |
|
287 |
_local_pred = true; |
|
288 |
_pred = Traits::createPredMap(*_gr); |
|
289 | 289 |
} |
290 | 290 |
if(!_dist) { |
291 |
_local_dist = true; |
|
292 |
_dist = Traits::createDistMap(*_gr); |
|
291 |
_local_dist = true; |
|
292 |
_dist = Traits::createDistMap(*_gr); |
|
293 | 293 |
} |
... | ... |
@@ -297,5 +297,5 @@ |
297 | 297 |
} |
298 |
|
|
298 |
|
|
299 | 299 |
public : |
300 |
|
|
300 |
|
|
301 | 301 |
typedef BellmanFord Create; |
... | ... |
@@ -322,3 +322,3 @@ |
322 | 322 |
template <class T> |
323 |
struct SetPredMap |
|
323 |
struct SetPredMap |
|
324 | 324 |
: public BellmanFord< Digraph, LengthMap, SetPredMapTraits<T> > { |
... | ... |
@@ -326,3 +326,3 @@ |
326 | 326 |
}; |
327 |
|
|
327 |
|
|
328 | 328 |
template <class T> |
... | ... |
@@ -343,3 +343,3 @@ |
343 | 343 |
template <class T> |
344 |
struct SetDistMap |
|
344 |
struct SetDistMap |
|
345 | 345 |
: public BellmanFord< Digraph, LengthMap, SetDistMapTraits<T> > { |
... | ... |
@@ -352,4 +352,4 @@ |
352 | 352 |
}; |
353 |
|
|
354 |
/// \brief \ref named-templ-param "Named parameter" for setting |
|
353 |
|
|
354 |
/// \brief \ref named-templ-param "Named parameter" for setting |
|
355 | 355 |
/// \c OperationTraits type. |
... | ... |
@@ -365,3 +365,3 @@ |
365 | 365 |
}; |
366 |
|
|
366 |
|
|
367 | 367 |
///@} |
... | ... |
@@ -369,7 +369,7 @@ |
369 | 369 |
protected: |
370 |
|
|
370 |
|
|
371 | 371 |
BellmanFord() {} |
372 | 372 |
|
373 |
public: |
|
374 |
|
|
373 |
public: |
|
374 |
|
|
375 | 375 |
/// \brief Constructor. |
... | ... |
@@ -383,3 +383,3 @@ |
383 | 383 |
_dist(0), _local_dist(false), _mask(0) {} |
384 |
|
|
384 |
|
|
385 | 385 |
///Destructor. |
... | ... |
@@ -410,4 +410,4 @@ |
410 | 410 |
if(_local_pred) { |
411 |
delete _pred; |
|
412 |
_local_pred=false; |
|
411 |
delete _pred; |
|
412 |
_local_pred=false; |
|
413 | 413 |
} |
... | ... |
@@ -428,4 +428,4 @@ |
428 | 428 |
if(_local_dist) { |
429 |
delete _dist; |
|
430 |
_local_dist=false; |
|
429 |
delete _dist; |
|
430 |
_local_dist=false; |
|
431 | 431 |
} |
... | ... |
@@ -447,3 +447,3 @@ |
447 | 447 |
/// \brief Initializes the internal data structures. |
448 |
/// |
|
448 |
/// |
|
449 | 449 |
/// Initializes the internal data structures. The optional parameter |
... | ... |
@@ -453,4 +453,4 @@ |
453 | 453 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
454 |
_pred->set(it, INVALID); |
|
455 |
_dist->set(it, value); |
|
454 |
_pred->set(it, INVALID); |
|
455 |
_dist->set(it, value); |
|
456 | 456 |
} |
... | ... |
@@ -458,13 +458,13 @@ |
458 | 458 |
if (OperationTraits::less(value, OperationTraits::infinity())) { |
459 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
|
460 |
_process.push_back(it); |
|
461 |
_mask->set(it, true); |
|
462 |
} |
|
459 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
|
460 |
_process.push_back(it); |
|
461 |
_mask->set(it, true); |
|
462 |
} |
|
463 | 463 |
} else { |
464 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
|
465 |
_mask->set(it, false); |
|
466 |
|
|
464 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
|
465 |
_mask->set(it, false); |
|
466 |
} |
|
467 | 467 |
} |
468 | 468 |
} |
469 |
|
|
469 |
|
|
470 | 470 |
/// \brief Adds a new source node. |
... | ... |
@@ -476,4 +476,4 @@ |
476 | 476 |
if (!(*_mask)[source]) { |
477 |
_process.push_back(source); |
|
478 |
_mask->set(source, true); |
|
477 |
_process.push_back(source); |
|
478 |
_mask->set(source, true); |
|
479 | 479 |
} |
... | ... |
@@ -502,3 +502,3 @@ |
502 | 502 |
for (int i = 0; i < int(_process.size()); ++i) { |
503 |
|
|
503 |
_mask->set(_process[i], false); |
|
504 | 504 |
} |
... | ... |
@@ -507,17 +507,17 @@ |
507 | 507 |
for (int i = 0; i < int(_process.size()); ++i) { |
508 |
|
|
508 |
values[i] = (*_dist)[_process[i]]; |
|
509 | 509 |
} |
510 | 510 |
for (int i = 0; i < int(_process.size()); ++i) { |
511 |
for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) { |
|
512 |
Node target = _gr->target(it); |
|
513 |
Value relaxed = OperationTraits::plus(values[i], (*_length)[it]); |
|
514 |
if (OperationTraits::less(relaxed, (*_dist)[target])) { |
|
515 |
_pred->set(target, it); |
|
516 |
_dist->set(target, relaxed); |
|
517 |
if (!(*_mask)[target]) { |
|
518 |
_mask->set(target, true); |
|
519 |
nextProcess.push_back(target); |
|
520 |
} |
|
521 |
} |
|
522 |
} |
|
511 |
for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) { |
|
512 |
Node target = _gr->target(it); |
|
513 |
Value relaxed = OperationTraits::plus(values[i], (*_length)[it]); |
|
514 |
if (OperationTraits::less(relaxed, (*_dist)[target])) { |
|
515 |
_pred->set(target, it); |
|
516 |
_dist->set(target, relaxed); |
|
517 |
if (!(*_mask)[target]) { |
|
518 |
_mask->set(target, true); |
|
519 |
nextProcess.push_back(target); |
|
520 |
} |
|
521 |
} |
|
522 |
} |
|
523 | 523 |
} |
... | ... |
@@ -543,3 +543,3 @@ |
543 | 543 |
for (int i = 0; i < int(_process.size()); ++i) { |
544 |
|
|
544 |
_mask->set(_process[i], false); |
|
545 | 545 |
} |
... | ... |
@@ -547,15 +547,15 @@ |
547 | 547 |
for (int i = 0; i < int(_process.size()); ++i) { |
548 |
for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) { |
|
549 |
Node target = _gr->target(it); |
|
550 |
Value relaxed = |
|
551 |
OperationTraits::plus((*_dist)[_process[i]], (*_length)[it]); |
|
552 |
if (OperationTraits::less(relaxed, (*_dist)[target])) { |
|
553 |
_pred->set(target, it); |
|
554 |
_dist->set(target, relaxed); |
|
555 |
if (!(*_mask)[target]) { |
|
556 |
_mask->set(target, true); |
|
557 |
nextProcess.push_back(target); |
|
558 |
} |
|
559 |
} |
|
560 |
|
|
548 |
for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) { |
|
549 |
Node target = _gr->target(it); |
|
550 |
Value relaxed = |
|
551 |
OperationTraits::plus((*_dist)[_process[i]], (*_length)[it]); |
|
552 |
if (OperationTraits::less(relaxed, (*_dist)[target])) { |
|
553 |
_pred->set(target, it); |
|
554 |
_dist->set(target, relaxed); |
|
555 |
if (!(*_mask)[target]) { |
|
556 |
_mask->set(target, true); |
|
557 |
nextProcess.push_back(target); |
|
558 |
} |
|
559 |
} |
|
560 |
} |
|
561 | 561 |
} |
... | ... |
@@ -581,3 +581,3 @@ |
581 | 581 |
for (int i = 0; i < num; ++i) { |
582 |
|
|
582 |
if (processNextWeakRound()) break; |
|
583 | 583 |
} |
... | ... |
@@ -593,6 +593,6 @@ |
593 | 593 |
/// |
594 |
/// The algorithm computes |
|
594 |
/// The algorithm computes |
|
595 | 595 |
/// - the shortest path tree (forest), |
596 | 596 |
/// - the distance of each node from the root(s). |
597 |
/// |
|
597 |
/// |
|
598 | 598 |
/// \return \c false if there is a negative cycle in the digraph. |
... | ... |
@@ -600,3 +600,3 @@ |
600 | 600 |
/// \pre init() must be called and at least one root node should be |
601 |
/// added with addSource() before using this function. |
|
601 |
/// added with addSource() before using this function. |
|
602 | 602 |
bool checkedStart() { |
... | ... |
@@ -604,3 +604,3 @@ |
604 | 604 |
for (int i = 0; i < num; ++i) { |
605 |
|
|
605 |
if (processNextWeakRound()) return true; |
|
606 | 606 |
} |
... | ... |
@@ -628,11 +628,11 @@ |
628 | 628 |
/// \pre init() must be called and at least one root node should be |
629 |
/// added with addSource() before using this function. |
|
629 |
/// added with addSource() before using this function. |
|
630 | 630 |
void limitedStart(int num) { |
631 | 631 |
for (int i = 0; i < num; ++i) { |
632 |
|
|
632 |
if (processNextRound()) break; |
|
633 | 633 |
} |
634 | 634 |
} |
635 |
|
|
635 |
|
|
636 | 636 |
/// \brief Runs the algorithm from the given root node. |
637 |
/// |
|
637 |
/// |
|
638 | 638 |
/// This method runs the Bellman-Ford algorithm from the given root |
... | ... |
@@ -655,6 +655,6 @@ |
655 | 655 |
} |
656 |
|
|
656 |
|
|
657 | 657 |
/// \brief Runs the algorithm from the given root node with arc |
658 | 658 |
/// number limit. |
659 |
/// |
|
659 |
/// |
|
660 | 660 |
/// This method runs the Bellman-Ford algorithm from the given root |
... | ... |
@@ -684,3 +684,3 @@ |
684 | 684 |
} |
685 |
|
|
685 |
|
|
686 | 686 |
///@} |
... | ... |
@@ -699,3 +699,3 @@ |
699 | 699 |
/// Constructor for getting the active nodes of the given BellmanFord |
700 |
/// instance. |
|
700 |
/// instance. |
|
701 | 701 |
ActiveIt(const BellmanFord& algorithm) : _algorithm(&algorithm) |
... | ... |
@@ -713,3 +713,3 @@ |
713 | 713 |
/// Conversion to \c Node. |
714 |
operator Node() const { |
|
714 |
operator Node() const { |
|
715 | 715 |
return _index >= 0 ? _algorithm->_process[_index] : INVALID; |
... | ... |
@@ -722,15 +722,15 @@ |
722 | 722 |
--_index; |
723 |
return *this; |
|
723 |
return *this; |
|
724 | 724 |
} |
725 | 725 |
|
726 |
bool operator==(const ActiveIt& it) const { |
|
727 |
return static_cast<Node>(*this) == static_cast<Node>(it); |
|
726 |
bool operator==(const ActiveIt& it) const { |
|
727 |
return static_cast<Node>(*this) == static_cast<Node>(it); |
|
728 | 728 |
} |
729 |
bool operator!=(const ActiveIt& it) const { |
|
730 |
return static_cast<Node>(*this) != static_cast<Node>(it); |
|
729 |
bool operator!=(const ActiveIt& it) const { |
|
730 |
return static_cast<Node>(*this) != static_cast<Node>(it); |
|
731 | 731 |
} |
732 |
bool operator<(const ActiveIt& it) const { |
|
733 |
return static_cast<Node>(*this) < static_cast<Node>(it); |
|
732 |
bool operator<(const ActiveIt& it) const { |
|
733 |
return static_cast<Node>(*this) < static_cast<Node>(it); |
|
734 | 734 |
} |
735 |
|
|
735 |
|
|
736 | 736 |
private: |
... | ... |
@@ -739,3 +739,3 @@ |
739 | 739 |
}; |
740 |
|
|
740 |
|
|
741 | 741 |
/// \name Query Functions |
... | ... |
@@ -744,3 +744,3 @@ |
744 | 744 |
/// Either \ref run() or \ref init() should be called before using them. |
745 |
|
|
745 |
|
|
746 | 746 |
///@{ |
... | ... |
@@ -748,3 +748,3 @@ |
748 | 748 |
/// \brief The shortest path to the given node. |
749 |
/// |
|
749 |
/// |
|
750 | 750 |
/// Gives back the shortest path to the given node from the root(s). |
... | ... |
@@ -759,3 +759,3 @@ |
759 | 759 |
} |
760 |
|
|
760 |
|
|
761 | 761 |
/// \brief The distance of the given node from the root(s). |
... | ... |
@@ -799,6 +799,6 @@ |
799 | 799 |
/// using this function. |
800 |
Node predNode(Node v) const { |
|
801 |
return (*_pred)[v] == INVALID ? INVALID : _gr->source((*_pred)[v]); |
|
800 |
Node predNode(Node v) const { |
|
801 |
return (*_pred)[v] == INVALID ? INVALID : _gr->source((*_pred)[v]); |
|
802 | 802 |
} |
803 |
|
|
803 |
|
|
804 | 804 |
/// \brief Returns a const reference to the node map that stores the |
... | ... |
@@ -812,3 +812,3 @@ |
812 | 812 |
const DistMap &distMap() const { return *_dist;} |
813 |
|
|
813 |
|
|
814 | 814 |
/// \brief Returns a const reference to the node map that stores the |
... | ... |
@@ -822,3 +822,3 @@ |
822 | 822 |
const PredMap &predMap() const { return *_pred; } |
823 |
|
|
823 |
|
|
824 | 824 |
/// \brief Checks if a node is reached from the root(s). |
... | ... |
@@ -834,3 +834,3 @@ |
834 | 834 |
/// \brief Gives back a negative cycle. |
835 |
/// |
|
835 |
/// |
|
836 | 836 |
/// This function gives back a directed cycle with negative total |
... | ... |
@@ -861,6 +861,6 @@ |
861 | 861 |
} |
862 |
|
|
862 |
|
|
863 | 863 |
///@} |
864 | 864 |
}; |
865 |
|
|
865 |
|
|
866 | 866 |
/// \brief Default traits class of bellmanFord() function. |
... | ... |
@@ -872,3 +872,3 @@ |
872 | 872 |
struct BellmanFordWizardDefaultTraits { |
873 |
/// The type of the digraph the algorithm runs on. |
|
873 |
/// The type of the digraph the algorithm runs on. |
|
874 | 874 |
typedef GR Digraph; |
... | ... |
@@ -894,3 +894,3 @@ |
894 | 894 |
/// arcs of the shortest paths. |
895 |
/// |
|
895 |
/// |
|
896 | 896 |
/// The type of the map that stores the last arcs of the shortest paths. |
... | ... |
@@ -900,3 +900,3 @@ |
900 | 900 |
/// \brief Instantiates a \c PredMap. |
901 |
/// |
|
901 |
/// |
|
902 | 902 |
/// This function instantiates a \ref PredMap. |
... | ... |
@@ -916,3 +916,3 @@ |
916 | 916 |
/// |
917 |
/// This function instantiates a \ref DistMap. |
|
917 |
/// This function instantiates a \ref DistMap. |
|
918 | 918 |
/// \param g is the digraph to which we would like to define the |
... | ... |
@@ -929,3 +929,3 @@ |
929 | 929 |
}; |
930 |
|
|
930 |
|
|
931 | 931 |
/// \brief Default traits class used by BellmanFordWizard. |
... | ... |
@@ -936,3 +936,3 @@ |
936 | 936 |
template <typename GR, typename LEN> |
937 |
class BellmanFordWizardBase |
|
937 |
class BellmanFordWizardBase |
|
938 | 938 |
: public BellmanFordWizardDefaultTraits<GR, LEN> { |
... | ... |
@@ -959,3 +959,3 @@ |
959 | 959 |
/// Constructor. |
960 |
|
|
960 |
|
|
961 | 961 |
/// This constructor does not require parameters, it initiates |
... | ... |
@@ -966,3 +966,3 @@ |
966 | 966 |
/// Constructor. |
967 |
|
|
967 |
|
|
968 | 968 |
/// This constructor requires two parameters, |
... | ... |
@@ -971,6 +971,6 @@ |
971 | 971 |
/// \param len The length map. |
972 |
BellmanFordWizardBase(const GR& gr, |
|
973 |
const LEN& len) : |
|
974 |
_graph(reinterpret_cast<void*>(const_cast<GR*>(&gr))), |
|
975 |
_length(reinterpret_cast<void*>(const_cast<LEN*>(&len))), |
|
972 |
BellmanFordWizardBase(const GR& gr, |
|
973 |
const LEN& len) : |
|
974 |
_graph(reinterpret_cast<void*>(const_cast<GR*>(&gr))), |
|
975 |
_length(reinterpret_cast<void*>(const_cast<LEN*>(&len))), |
|
976 | 976 |
_pred(0), _dist(0), _path(0), _di(0) {} |
... | ... |
@@ -978,3 +978,3 @@ |
978 | 978 |
}; |
979 |
|
|
979 |
|
|
980 | 980 |
/// \brief Auxiliary class for the function-type interface of the |
... | ... |
@@ -1003,3 +1003,3 @@ |
1003 | 1003 |
typedef typename Digraph::OutArcIt ArcIt; |
1004 |
|
|
1004 |
|
|
1005 | 1005 |
typedef typename TR::LengthMap LengthMap; |
... | ... |
@@ -1020,3 +1020,3 @@ |
1020 | 1020 |
/// \param len The length map. |
1021 |
BellmanFordWizard(const Digraph& gr, const LengthMap& len) |
|
1021 |
BellmanFordWizard(const Digraph& gr, const LengthMap& len) |
|
1022 | 1022 |
: TR(gr, len) {} |
... | ... |
@@ -1029,3 +1029,3 @@ |
1029 | 1029 |
/// \brief Runs the Bellman-Ford algorithm from the given source node. |
1030 |
/// |
|
1030 |
/// |
|
1031 | 1031 |
/// This method runs the Bellman-Ford algorithm from the given source |
... | ... |
@@ -1033,4 +1033,4 @@ |
1033 | 1033 |
void run(Node s) { |
1034 |
BellmanFord<Digraph,LengthMap,TR> |
|
1035 |
bf(*reinterpret_cast<const Digraph*>(Base::_graph), |
|
1034 |
BellmanFord<Digraph,LengthMap,TR> |
|
1035 |
bf(*reinterpret_cast<const Digraph*>(Base::_graph), |
|
1036 | 1036 |
*reinterpret_cast<const LengthMap*>(Base::_length)); |
... | ... |
@@ -1069,3 +1069,3 @@ |
1069 | 1069 |
}; |
1070 |
|
|
1070 |
|
|
1071 | 1071 |
/// \brief \ref named-templ-param "Named parameter" for setting |
... | ... |
@@ -1080,3 +1080,3 @@ |
1080 | 1080 |
} |
1081 |
|
|
1081 |
|
|
1082 | 1082 |
template<class T> |
... | ... |
@@ -1087,3 +1087,3 @@ |
1087 | 1087 |
}; |
1088 |
|
|
1088 |
|
|
1089 | 1089 |
/// \brief \ref named-templ-param "Named parameter" for setting |
... | ... |
@@ -1128,5 +1128,5 @@ |
1128 | 1128 |
} |
1129 |
|
|
1129 |
|
|
1130 | 1130 |
}; |
1131 |
|
|
1131 |
|
|
1132 | 1132 |
/// \brief Function type interface for the \ref BellmanFord "Bellman-Ford" |
... | ... |
@@ -1138,4 +1138,4 @@ |
1138 | 1138 |
/// |
1139 |
/// This function also has several \ref named-templ-func-param |
|
1140 |
/// "named parameters", they are declared as the members of class |
|
1139 |
/// This function also has several \ref named-templ-func-param |
|
1140 |
/// "named parameters", they are declared as the members of class |
|
1141 | 1141 |
/// \ref BellmanFordWizard. |
... | ... |
@@ -1156,3 +1156,3 @@ |
1156 | 1156 |
bellmanFord(const GR& digraph, |
1157 |
|
|
1157 |
const LEN& length) |
|
1158 | 1158 |
{ |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -84,3 +84,4 @@ |
84 | 84 |
///The type of the map that indicates which nodes are reached. |
85 |
///It must conform to |
|
85 |
///It must conform to |
|
86 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
86 | 87 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -273,3 +274,4 @@ |
273 | 274 |
///\c ReachedMap type. |
274 |
///It must conform to |
|
275 |
///It must conform to |
|
276 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
275 | 277 |
template <class T> |
... | ... |
@@ -874,3 +876,4 @@ |
874 | 876 |
///The type of the map that indicates which nodes are reached. |
875 |
///It must conform to |
|
877 |
///It must conform to |
|
878 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
876 | 879 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -1267,3 +1270,4 @@ |
1267 | 1270 |
/// The type of the map that indicates which nodes are reached. |
1268 |
/// It must conform to |
|
1271 |
/// It must conform to |
|
1272 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
1269 | 1273 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -260,3 +260,3 @@ |
260 | 260 |
_data[i].prio=value; |
261 |
|
|
261 |
|
|
262 | 262 |
while( p!=-1 && _comp(value, _data[p].prio) ) { |
... | ... |
@@ -324,3 +324,3 @@ |
324 | 324 |
private: |
325 |
|
|
325 |
|
|
326 | 326 |
// Find the minimum of the roots |
... | ... |
@@ -352,3 +352,3 @@ |
352 | 352 |
if( _data[_head].right_neighbor==-1 ) return; |
353 |
|
|
353 |
|
|
354 | 354 |
int x=_head; |
... | ... |
@@ -386,3 +386,3 @@ |
386 | 386 |
_data.push_back(Store()); |
387 |
|
|
387 |
|
|
388 | 388 |
while( p!=-1 || q!=-1 ) { |
... | ... |
@@ -399,3 +399,3 @@ |
399 | 399 |
} |
400 |
|
|
400 |
|
|
401 | 401 |
_head=_data.back().right_neighbor; |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -65,7 +65,7 @@ |
65 | 65 |
if (n == Parent::source(e)) |
66 |
|
|
66 |
return Parent::target(e); |
|
67 | 67 |
else if(n==Parent::target(e)) |
68 |
|
|
68 |
return Parent::source(e); |
|
69 | 69 |
else |
70 |
|
|
70 |
return INVALID; |
|
71 | 71 |
} |
... | ... |
@@ -93,3 +93,3 @@ |
93 | 93 |
|
94 |
class NodeIt : public Node { |
|
94 |
class NodeIt : public Node { |
|
95 | 95 |
const Digraph* digraph; |
... | ... |
@@ -102,11 +102,11 @@ |
102 | 102 |
explicit NodeIt(const Digraph& _graph) : digraph(&_graph) { |
103 |
|
|
103 |
_graph.first(static_cast<Node&>(*this)); |
|
104 | 104 |
} |
105 | 105 |
|
106 |
NodeIt(const Digraph& _graph, const Node& node) |
|
107 |
: Node(node), digraph(&_graph) {} |
|
106 |
NodeIt(const Digraph& _graph, const Node& node) |
|
107 |
: Node(node), digraph(&_graph) {} |
|
108 | 108 |
|
109 |
NodeIt& operator++() { |
|
110 |
digraph->next(*this); |
|
111 |
|
|
109 |
NodeIt& operator++() { |
|
110 |
digraph->next(*this); |
|
111 |
return *this; |
|
112 | 112 |
} |
... | ... |
@@ -116,3 +116,3 @@ |
116 | 116 |
|
117 |
class ArcIt : public Arc { |
|
117 |
class ArcIt : public Arc { |
|
118 | 118 |
const Digraph* digraph; |
... | ... |
@@ -125,11 +125,11 @@ |
125 | 125 |
explicit ArcIt(const Digraph& _graph) : digraph(&_graph) { |
126 |
|
|
126 |
_graph.first(static_cast<Arc&>(*this)); |
|
127 | 127 |
} |
128 | 128 |
|
129 |
ArcIt(const Digraph& _graph, const Arc& e) : |
|
130 |
Arc(e), digraph(&_graph) { } |
|
129 |
ArcIt(const Digraph& _graph, const Arc& e) : |
|
130 |
Arc(e), digraph(&_graph) { } |
|
131 | 131 |
|
132 |
ArcIt& operator++() { |
|
133 |
digraph->next(*this); |
|
134 |
|
|
132 |
ArcIt& operator++() { |
|
133 |
digraph->next(*this); |
|
134 |
return *this; |
|
135 | 135 |
} |
... | ... |
@@ -139,3 +139,3 @@ |
139 | 139 |
|
140 |
class OutArcIt : public Arc { |
|
140 |
class OutArcIt : public Arc { |
|
141 | 141 |
const Digraph* digraph; |
... | ... |
@@ -147,13 +147,13 @@ |
147 | 147 |
|
148 |
OutArcIt(const Digraph& _graph, const Node& node) |
|
149 |
: digraph(&_graph) { |
|
150 |
|
|
148 |
OutArcIt(const Digraph& _graph, const Node& node) |
|
149 |
: digraph(&_graph) { |
|
150 |
_graph.firstOut(*this, node); |
|
151 | 151 |
} |
152 | 152 |
|
153 |
OutArcIt(const Digraph& _graph, const Arc& arc) |
|
154 |
: Arc(arc), digraph(&_graph) {} |
|
153 |
OutArcIt(const Digraph& _graph, const Arc& arc) |
|
154 |
: Arc(arc), digraph(&_graph) {} |
|
155 | 155 |
|
156 |
OutArcIt& operator++() { |
|
157 |
digraph->nextOut(*this); |
|
158 |
|
|
156 |
OutArcIt& operator++() { |
|
157 |
digraph->nextOut(*this); |
|
158 |
return *this; |
|
159 | 159 |
} |
... | ... |
@@ -163,3 +163,3 @@ |
163 | 163 |
|
164 |
class InArcIt : public Arc { |
|
164 |
class InArcIt : public Arc { |
|
165 | 165 |
const Digraph* digraph; |
... | ... |
@@ -171,13 +171,13 @@ |
171 | 171 |
|
172 |
InArcIt(const Digraph& _graph, const Node& node) |
|
173 |
: digraph(&_graph) { |
|
174 |
|
|
172 |
InArcIt(const Digraph& _graph, const Node& node) |
|
173 |
: digraph(&_graph) { |
|
174 |
_graph.firstIn(*this, node); |
|
175 | 175 |
} |
176 | 176 |
|
177 |
InArcIt(const Digraph& _graph, const Arc& arc) : |
|
178 |
Arc(arc), digraph(&_graph) {} |
|
177 |
InArcIt(const Digraph& _graph, const Arc& arc) : |
|
178 |
Arc(arc), digraph(&_graph) {} |
|
179 | 179 |
|
180 |
InArcIt& operator++() { |
|
181 |
digraph->nextIn(*this); |
|
182 |
|
|
180 |
InArcIt& operator++() { |
|
181 |
digraph->nextIn(*this); |
|
182 |
return *this; |
|
183 | 183 |
} |
... | ... |
@@ -217,5 +217,5 @@ |
217 | 217 |
// Mappable extension |
218 |
|
|
218 |
|
|
219 | 219 |
template <typename _Value> |
220 |
class ArcMap |
|
220 |
class ArcMap |
|
221 | 221 |
: public MapExtender<DefaultMap<Digraph, Arc, _Value> > { |
... | ... |
@@ -224,9 +224,9 @@ |
224 | 224 |
public: |
225 |
explicit ArcMap(const Digraph& _g) |
|
226 |
: Parent(_g) {} |
|
227 |
ArcMap(const Digraph& _g, const _Value& _v) |
|
228 |
: Parent(_g, _v) {} |
|
225 |
explicit ArcMap(const Digraph& _g) |
|
226 |
: Parent(_g) {} |
|
227 |
ArcMap(const Digraph& _g, const _Value& _v) |
|
228 |
: Parent(_g, _v) {} |
|
229 | 229 |
|
230 | 230 |
ArcMap& operator=(const ArcMap& cmap) { |
231 |
|
|
231 |
return operator=<ArcMap>(cmap); |
|
232 | 232 |
} |
... | ... |
@@ -236,3 +236,3 @@ |
236 | 236 |
Parent::operator=(cmap); |
237 |
|
|
237 |
return *this; |
|
238 | 238 |
} |
... | ... |
@@ -249,3 +249,3 @@ |
249 | 249 |
} |
250 |
|
|
250 |
|
|
251 | 251 |
void clear() { |
... | ... |
@@ -312,7 +312,7 @@ |
312 | 312 |
if( n == Parent::u(e)) |
313 |
|
|
313 |
return Parent::v(e); |
|
314 | 314 |
else if( n == Parent::v(e)) |
315 |
|
|
315 |
return Parent::u(e); |
|
316 | 316 |
else |
317 |
|
|
317 |
return INVALID; |
|
318 | 318 |
} |
... | ... |
@@ -340,3 +340,3 @@ |
340 | 340 |
using Parent::notifier; |
341 |
|
|
341 |
|
|
342 | 342 |
ArcNotifier& notifier(Arc) const { |
... | ... |
@@ -350,3 +350,3 @@ |
350 | 350 |
|
351 |
class NodeIt : public Node { |
|
351 |
class NodeIt : public Node { |
|
352 | 352 |
const Graph* graph; |
... | ... |
@@ -359,11 +359,11 @@ |
359 | 359 |
explicit NodeIt(const Graph& _graph) : graph(&_graph) { |
360 |
|
|
360 |
_graph.first(static_cast<Node&>(*this)); |
|
361 | 361 |
} |
362 | 362 |
|
363 |
NodeIt(const Graph& _graph, const Node& node) |
|
364 |
: Node(node), graph(&_graph) {} |
|
363 |
NodeIt(const Graph& _graph, const Node& node) |
|
364 |
: Node(node), graph(&_graph) {} |
|
365 | 365 |
|
366 |
NodeIt& operator++() { |
|
367 |
graph->next(*this); |
|
368 |
|
|
366 |
NodeIt& operator++() { |
|
367 |
graph->next(*this); |
|
368 |
return *this; |
|
369 | 369 |
} |
... | ... |
@@ -373,3 +373,3 @@ |
373 | 373 |
|
374 |
class ArcIt : public Arc { |
|
374 |
class ArcIt : public Arc { |
|
375 | 375 |
const Graph* graph; |
... | ... |
@@ -382,11 +382,11 @@ |
382 | 382 |
explicit ArcIt(const Graph& _graph) : graph(&_graph) { |
383 |
|
|
383 |
_graph.first(static_cast<Arc&>(*this)); |
|
384 | 384 |
} |
385 | 385 |
|
386 |
ArcIt(const Graph& _graph, const Arc& e) : |
|
387 |
Arc(e), graph(&_graph) { } |
|
386 |
ArcIt(const Graph& _graph, const Arc& e) : |
|
387 |
Arc(e), graph(&_graph) { } |
|
388 | 388 |
|
389 |
ArcIt& operator++() { |
|
390 |
graph->next(*this); |
|
391 |
|
|
389 |
ArcIt& operator++() { |
|
390 |
graph->next(*this); |
|
391 |
return *this; |
|
392 | 392 |
} |
... | ... |
@@ -396,3 +396,3 @@ |
396 | 396 |
|
397 |
class OutArcIt : public Arc { |
|
397 |
class OutArcIt : public Arc { |
|
398 | 398 |
const Graph* graph; |
... | ... |
@@ -404,13 +404,13 @@ |
404 | 404 |
|
405 |
OutArcIt(const Graph& _graph, const Node& node) |
|
406 |
: graph(&_graph) { |
|
407 |
|
|
405 |
OutArcIt(const Graph& _graph, const Node& node) |
|
406 |
: graph(&_graph) { |
|
407 |
_graph.firstOut(*this, node); |
|
408 | 408 |
} |
409 | 409 |
|
410 |
OutArcIt(const Graph& _graph, const Arc& arc) |
|
411 |
: Arc(arc), graph(&_graph) {} |
|
410 |
OutArcIt(const Graph& _graph, const Arc& arc) |
|
411 |
: Arc(arc), graph(&_graph) {} |
|
412 | 412 |
|
413 |
OutArcIt& operator++() { |
|
414 |
graph->nextOut(*this); |
|
415 |
|
|
413 |
OutArcIt& operator++() { |
|
414 |
graph->nextOut(*this); |
|
415 |
return *this; |
|
416 | 416 |
} |
... | ... |
@@ -420,3 +420,3 @@ |
420 | 420 |
|
421 |
class InArcIt : public Arc { |
|
421 |
class InArcIt : public Arc { |
|
422 | 422 |
const Graph* graph; |
... | ... |
@@ -428,13 +428,13 @@ |
428 | 428 |
|
429 |
InArcIt(const Graph& _graph, const Node& node) |
|
430 |
: graph(&_graph) { |
|
431 |
|
|
429 |
InArcIt(const Graph& _graph, const Node& node) |
|
430 |
: graph(&_graph) { |
|
431 |
_graph.firstIn(*this, node); |
|
432 | 432 |
} |
433 | 433 |
|
434 |
InArcIt(const Graph& _graph, const Arc& arc) : |
|
435 |
Arc(arc), graph(&_graph) {} |
|
434 |
InArcIt(const Graph& _graph, const Arc& arc) : |
|
435 |
Arc(arc), graph(&_graph) {} |
|
436 | 436 |
|
437 |
InArcIt& operator++() { |
|
438 |
graph->nextIn(*this); |
|
439 |
|
|
437 |
InArcIt& operator++() { |
|
438 |
graph->nextIn(*this); |
|
439 |
return *this; |
|
440 | 440 |
} |
... | ... |
@@ -444,3 +444,3 @@ |
444 | 444 |
|
445 |
class EdgeIt : public Parent::Edge { |
|
445 |
class EdgeIt : public Parent::Edge { |
|
446 | 446 |
const Graph* graph; |
... | ... |
@@ -453,11 +453,11 @@ |
453 | 453 |
explicit EdgeIt(const Graph& _graph) : graph(&_graph) { |
454 |
|
|
454 |
_graph.first(static_cast<Edge&>(*this)); |
|
455 | 455 |
} |
456 | 456 |
|
457 |
EdgeIt(const Graph& _graph, const Edge& e) : |
|
458 |
Edge(e), graph(&_graph) { } |
|
457 |
EdgeIt(const Graph& _graph, const Edge& e) : |
|
458 |
Edge(e), graph(&_graph) { } |
|
459 | 459 |
|
460 |
EdgeIt& operator++() { |
|
461 |
graph->next(*this); |
|
462 |
|
|
460 |
EdgeIt& operator++() { |
|
461 |
graph->next(*this); |
|
462 |
return *this; |
|
463 | 463 |
} |
... | ... |
@@ -477,3 +477,3 @@ |
477 | 477 |
IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { |
478 |
|
|
478 |
_graph.firstInc(*this, direction, n); |
|
479 | 479 |
} |
... | ... |
@@ -481,4 +481,4 @@ |
481 | 481 |
IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) |
482 |
: graph(&_graph), Edge(ue) { |
|
483 |
direction = (_graph.source(ue) == n); |
|
482 |
: graph(&_graph), Edge(ue) { |
|
483 |
direction = (_graph.source(ue) == n); |
|
484 | 484 |
} |
... | ... |
@@ -486,4 +486,4 @@ |
486 | 486 |
IncEdgeIt& operator++() { |
487 |
graph->nextInc(*this, direction); |
|
488 |
return *this; |
|
487 |
graph->nextInc(*this, direction); |
|
488 |
return *this; |
|
489 | 489 |
} |
... | ... |
@@ -534,3 +534,3 @@ |
534 | 534 |
template <typename _Value> |
535 |
class ArcMap |
|
535 |
class ArcMap |
|
536 | 536 |
: public MapExtender<DefaultMap<Graph, Arc, _Value> > { |
... | ... |
@@ -539,9 +539,9 @@ |
539 | 539 |
public: |
540 |
explicit ArcMap(const Graph& _g) |
|
541 |
: Parent(_g) {} |
|
542 |
ArcMap(const Graph& _g, const _Value& _v) |
|
543 |
: Parent(_g, _v) {} |
|
540 |
explicit ArcMap(const Graph& _g) |
|
541 |
: Parent(_g) {} |
|
542 |
ArcMap(const Graph& _g, const _Value& _v) |
|
543 |
: Parent(_g, _v) {} |
|
544 | 544 |
|
545 | 545 |
ArcMap& operator=(const ArcMap& cmap) { |
546 |
|
|
546 |
return operator=<ArcMap>(cmap); |
|
547 | 547 |
} |
... | ... |
@@ -551,3 +551,3 @@ |
551 | 551 |
Parent::operator=(cmap); |
552 |
|
|
552 |
return *this; |
|
553 | 553 |
} |
... | ... |
@@ -558,3 +558,3 @@ |
558 | 558 |
template <typename _Value> |
559 |
class EdgeMap |
|
559 |
class EdgeMap |
|
560 | 560 |
: public MapExtender<DefaultMap<Graph, Edge, _Value> > { |
... | ... |
@@ -563,10 +563,10 @@ |
563 | 563 |
public: |
564 |
explicit EdgeMap(const Graph& _g) |
|
565 |
: Parent(_g) {} |
|
564 |
explicit EdgeMap(const Graph& _g) |
|
565 |
: Parent(_g) {} |
|
566 | 566 |
|
567 |
EdgeMap(const Graph& _g, const _Value& _v) |
|
568 |
: Parent(_g, _v) {} |
|
567 |
EdgeMap(const Graph& _g, const _Value& _v) |
|
568 |
: Parent(_g, _v) {} |
|
569 | 569 |
|
570 | 570 |
EdgeMap& operator=(const EdgeMap& cmap) { |
571 |
|
|
571 |
return operator=<EdgeMap>(cmap); |
|
572 | 572 |
} |
... | ... |
@@ -576,3 +576,3 @@ |
576 | 576 |
Parent::operator=(cmap); |
577 |
|
|
577 |
return *this; |
|
578 | 578 |
} |
... | ... |
@@ -593,3 +593,3 @@ |
593 | 593 |
} |
594 |
|
|
594 |
|
|
595 | 595 |
void clear() { |
... | ... |
@@ -619,3 +619,3 @@ |
619 | 619 |
} |
620 |
|
|
620 |
|
|
621 | 621 |
}; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -98,3 +98,3 @@ |
98 | 98 |
char buf1[11], buf2[9], buf3[5]; |
99 |
|
|
99 |
if (GetDateFormat(MY_LOCALE, 0, &time, |
|
100 | 100 |
("ddd MMM dd"), buf1, 11) && |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -386,3 +386,3 @@ |
386 | 386 |
/// Note that this implementation does not conform to the |
387 |
/// \ref concepts::Heap "heap concept" due to the lack of some |
|
387 |
/// \ref concepts::Heap "heap concept" due to the lack of some |
|
388 | 388 |
/// functionality. |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -135,3 +135,3 @@ |
135 | 135 |
}; |
136 |
|
|
136 |
|
|
137 | 137 |
private: |
... | ... |
@@ -186,3 +186,3 @@ |
186 | 186 |
public: |
187 |
|
|
187 |
|
|
188 | 188 |
/// \brief Constant for infinite upper bounds (capacities). |
... | ... |
@@ -213,6 +213,6 @@ |
213 | 213 |
IntVector &_pred; |
214 |
|
|
214 |
|
|
215 | 215 |
IntVector _proc_nodes; |
216 | 216 |
CostVector _dist; |
217 |
|
|
217 |
|
|
218 | 218 |
public: |
... | ... |
@@ -441,3 +441,3 @@ |
441 | 441 |
} |
442 |
|
|
442 |
|
|
443 | 443 |
/// @} |
... | ... |
@@ -577,3 +577,3 @@ |
577 | 577 |
_supply.resize(_node_num); |
578 |
|
|
578 |
|
|
579 | 579 |
_res_cap.resize(_res_arc_num); |
... | ... |
@@ -621,3 +621,3 @@ |
621 | 621 |
} |
622 |
|
|
622 |
|
|
623 | 623 |
// Reset parameters |
... | ... |
@@ -730,3 +730,3 @@ |
730 | 730 |
if (_sum_supply > 0) return INFEASIBLE; |
731 |
|
|
731 |
|
|
732 | 732 |
// Initialize vectors |
... | ... |
@@ -778,3 +778,3 @@ |
778 | 778 |
} |
779 |
|
|
779 |
|
|
780 | 780 |
// Handle GEQ supply type |
... | ... |
@@ -846,5 +846,5 @@ |
846 | 846 |
_pi[i] -= pr; |
847 |
} |
|
847 |
} |
|
848 | 848 |
} |
849 |
|
|
849 |
|
|
850 | 850 |
return pt; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -61,4 +61,4 @@ |
61 | 61 |
/// |
62 |
/// The type of the map that stores the signed supply values of the |
|
63 |
/// nodes. |
|
62 |
/// The type of the map that stores the signed supply values of the |
|
63 |
/// nodes. |
|
64 | 64 |
/// It must conform to the \ref concepts::ReadMap "ReadMap" concept. |
... | ... |
@@ -143,3 +143,3 @@ |
143 | 143 |
\f[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A. \f] |
144 |
|
|
144 |
|
|
145 | 145 |
The sum of the supply values, i.e. \f$\sum_{u\in V} sup(u)\f$ must be |
... | ... |
@@ -153,3 +153,3 @@ |
153 | 153 |
have to be satisfied and all supplies have to be used. |
154 |
|
|
154 |
|
|
155 | 155 |
If you need the opposite inequalities in the supply/demand constraints |
... | ... |
@@ -339,3 +339,3 @@ |
339 | 339 |
/// \param lower The lower bounds for the flow values on the arcs. |
340 |
/// \param upper The upper bounds (capacities) for the flow values |
|
340 |
/// \param upper The upper bounds (capacities) for the flow values |
|
341 | 341 |
/// on the arcs. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -436,3 +436,3 @@ |
436 | 436 |
///Copy constructor |
437 |
NodeMap(const NodeMap& nm) : |
|
437 |
NodeMap(const NodeMap& nm) : |
|
438 | 438 |
ReferenceMap<Node, T, T&, const T&>(nm) { } |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -45,3 +45,3 @@ |
45 | 45 |
/// An actual graph implementation like \ref ListGraph or |
46 |
/// \ref SmartGraph may have additional functionality. |
|
46 |
/// \ref SmartGraph may have additional functionality. |
|
47 | 47 |
/// |
... | ... |
@@ -87,3 +87,3 @@ |
87 | 87 |
/// Undirected graphs should be tagged with \c UndirectedTag. |
88 |
/// |
|
88 |
/// |
|
89 | 89 |
/// This tag helps the \c enable_if technics to make compile time |
... | ... |
@@ -362,3 +362,3 @@ |
362 | 362 |
/// Converison to \c Edge |
363 |
|
|
363 |
|
|
364 | 364 |
/// Converison to \c Edge. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -40,3 +40,3 @@ |
40 | 40 |
/// create graph skeleton classes. The reason for this is that \c Node |
41 |
/// and \c Arc (or \c Edge) types should \e not derive from the same |
|
41 |
/// and \c Arc (or \c Edge) types should \e not derive from the same |
|
42 | 42 |
/// base class. For \c Node you should instantiate it with character |
... | ... |
@@ -91,3 +91,3 @@ |
91 | 91 |
/// This operator defines an ordering of the items. |
92 |
/// It makes possible to use graph item types as key types in |
|
92 |
/// It makes possible to use graph item types as key types in |
|
93 | 93 |
/// associative containers (e.g. \c std::map). |
... | ... |
@@ -124,3 +124,3 @@ |
124 | 124 |
/// All digraph %concepts have to conform to this class. |
125 |
/// It just provides types for nodes and arcs and functions |
|
125 |
/// It just provides types for nodes and arcs and functions |
|
126 | 126 |
/// to get the source and the target nodes of arcs. |
... | ... |
@@ -428,3 +428,3 @@ |
428 | 428 |
/// |
429 |
/// This class describes the concept of \c NodeIt, \c ArcIt and |
|
429 |
/// This class describes the concept of \c NodeIt, \c ArcIt and |
|
430 | 430 |
/// \c EdgeIt subtypes of digraph and graph types. |
... | ... |
@@ -468,3 +468,3 @@ |
468 | 468 |
GraphItemIt& operator++() { return *this; } |
469 |
|
|
469 |
|
|
470 | 470 |
/// \brief Equality operator |
... | ... |
@@ -503,6 +503,6 @@ |
503 | 503 |
|
504 |
/// \brief Concept class for \c InArcIt, \c OutArcIt and |
|
504 |
/// \brief Concept class for \c InArcIt, \c OutArcIt and |
|
505 | 505 |
/// \c IncEdgeIt types. |
506 | 506 |
/// |
507 |
/// This class describes the concept of \c InArcIt, \c OutArcIt |
|
507 |
/// This class describes the concept of \c InArcIt, \c OutArcIt |
|
508 | 508 |
/// and \c IncEdgeIt subtypes of digraph and graph types. |
... | ... |
@@ -511,3 +511,3 @@ |
511 | 511 |
/// base class, there is an additional template parameter (selector) |
512 |
/// \c sel. For \c InArcIt you should instantiate it with character |
|
512 |
/// \c sel. For \c InArcIt you should instantiate it with character |
|
513 | 513 |
/// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'. |
... | ... |
@@ -532,6 +532,6 @@ |
532 | 532 |
|
533 |
/// \brief Constructor that sets the iterator to the first |
|
533 |
/// \brief Constructor that sets the iterator to the first |
|
534 | 534 |
/// incoming or outgoing arc. |
535 | 535 |
/// |
536 |
/// Constructor that sets the iterator to the first arc |
|
536 |
/// Constructor that sets the iterator to the first arc |
|
537 | 537 |
/// incoming to or outgoing from the given node. |
... | ... |
@@ -806,5 +806,5 @@ |
806 | 806 |
/// |
807 |
/// This function gives back the first edge incident to the given |
|
807 |
/// This function gives back the first edge incident to the given |
|
808 | 808 |
/// node. The bool parameter gives back the direction for which the |
809 |
/// source node of the directed arc representing the edge is the |
|
809 |
/// source node of the directed arc representing the edge is the |
|
810 | 810 |
/// given node. |
... | ... |
@@ -815,3 +815,3 @@ |
815 | 815 |
/// |
816 |
/// This function gives back the next edge incident to the given |
|
816 |
/// This function gives back the next edge incident to the given |
|
817 | 817 |
/// node. The bool parameter should be used as \c firstInc() use it. |
... | ... |
@@ -992,3 +992,3 @@ |
992 | 992 |
/// This class describes the concept of standard graph maps, i.e. |
993 |
/// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and |
|
993 |
/// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and |
|
994 | 994 |
/// graph types, which can be used for associating data to graph items. |
... | ... |
@@ -1047,3 +1047,3 @@ |
1047 | 1047 |
_Map m2(g,t); |
1048 |
|
|
1048 |
|
|
1049 | 1049 |
// Copy constructor |
... | ... |
@@ -1070,3 +1070,3 @@ |
1070 | 1070 |
/// This class describes the interface of mappable directed graphs. |
1071 |
/// It extends \ref BaseDigraphComponent with the standard digraph |
|
1071 |
/// It extends \ref BaseDigraphComponent with the standard digraph |
|
1072 | 1072 |
/// map classes, namely \c NodeMap and \c ArcMap. |
... | ... |
@@ -1207,3 +1207,3 @@ |
1207 | 1207 |
/// This class describes the interface of mappable undirected graphs. |
1208 |
/// It extends \ref MappableDigraphComponent with the standard graph |
|
1208 |
/// It extends \ref MappableDigraphComponent with the standard graph |
|
1209 | 1209 |
/// map class for edges (\c EdgeMap). |
... | ... |
@@ -1292,3 +1292,3 @@ |
1292 | 1292 |
/// This class describes the interface of extendable directed graphs. |
1293 |
/// It extends \ref BaseDigraphComponent with functions for adding |
|
1293 |
/// It extends \ref BaseDigraphComponent with functions for adding |
|
1294 | 1294 |
/// nodes and arcs to the digraph. |
... | ... |
@@ -1336,3 +1336,3 @@ |
1336 | 1336 |
/// This class describes the interface of extendable undirected graphs. |
1337 |
/// It extends \ref BaseGraphComponent with functions for adding |
|
1337 |
/// It extends \ref BaseGraphComponent with functions for adding |
|
1338 | 1338 |
/// nodes and edges to the graph. |
... | ... |
@@ -1380,3 +1380,3 @@ |
1380 | 1380 |
/// This class describes the interface of erasable directed graphs. |
1381 |
/// It extends \ref BaseDigraphComponent with functions for removing |
|
1381 |
/// It extends \ref BaseDigraphComponent with functions for removing |
|
1382 | 1382 |
/// nodes and arcs from the digraph. |
... | ... |
@@ -1393,3 +1393,3 @@ |
1393 | 1393 |
/// |
1394 |
/// This function erases the given node from the digraph and all arcs |
|
1394 |
/// This function erases the given node from the digraph and all arcs |
|
1395 | 1395 |
/// connected to the node. |
... | ... |
@@ -1419,3 +1419,3 @@ |
1419 | 1419 |
/// This class describes the interface of erasable undirected graphs. |
1420 |
/// It extends \ref BaseGraphComponent with functions for removing |
|
1420 |
/// It extends \ref BaseGraphComponent with functions for removing |
|
1421 | 1421 |
/// nodes and edges from the graph. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -94,3 +94,3 @@ |
94 | 94 |
explicit Heap(ItemIntMap&) {} |
95 |
#endif |
|
95 |
#endif |
|
96 | 96 |
|
... | ... |
@@ -108,3 +108,3 @@ |
108 | 108 |
explicit Heap(ItemIntMap&, const CMP&) {} |
109 |
#endif |
|
109 |
#endif |
|
110 | 110 |
|
... | ... |
@@ -140,3 +140,3 @@ |
140 | 140 |
void push(const Item&, const Prio&) {} |
141 |
#endif |
|
141 |
#endif |
|
142 | 142 |
|
... | ... |
@@ -170,3 +170,3 @@ |
170 | 170 |
void erase(const Item&) {} |
171 |
#endif |
|
171 |
#endif |
|
172 | 172 |
|
... | ... |
@@ -181,3 +181,3 @@ |
181 | 181 |
Prio operator[](const Item&) const { return Prio(); } |
182 |
#endif |
|
182 |
#endif |
|
183 | 183 |
|
... | ... |
@@ -196,3 +196,3 @@ |
196 | 196 |
void set(const Item&, const Prio&) {} |
197 |
#endif |
|
197 |
#endif |
|
198 | 198 |
|
... | ... |
@@ -208,3 +208,3 @@ |
208 | 208 |
void decrease(const Item&, const Prio&) {} |
209 |
#endif |
|
209 |
#endif |
|
210 | 210 |
|
... | ... |
@@ -220,3 +220,3 @@ |
220 | 220 |
void increase(const Item&, const Prio&) {} |
221 |
#endif |
|
221 |
#endif |
|
222 | 222 |
|
... | ... |
@@ -234,3 +234,3 @@ |
234 | 234 |
State state(const Item&) const { return PRE_HEAP; } |
235 |
#endif |
|
235 |
#endif |
|
236 | 236 |
|
... | ... |
@@ -247,3 +247,3 @@ |
247 | 247 |
void state(const Item&, State) {} |
248 |
#endif |
|
248 |
#endif |
|
249 | 249 |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -260,3 +260,3 @@ |
260 | 260 |
/// \note By definition, the empty digraph is strongly connected. |
261 |
/// |
|
261 |
/// |
|
262 | 262 |
/// \see countStronglyConnectedComponents(), stronglyConnectedComponents() |
... | ... |
@@ -312,3 +312,3 @@ |
312 | 312 |
/// |
313 |
/// \brief Count the number of strongly connected components of a |
|
313 |
/// \brief Count the number of strongly connected components of a |
|
314 | 314 |
/// directed graph |
... | ... |
@@ -746,3 +746,3 @@ |
746 | 746 |
/// |
747 |
/// This function checks whether the given undirected graph is |
|
747 |
/// This function checks whether the given undirected graph is |
|
748 | 748 |
/// bi-node-connected, i.e. any two edges are on same circle. |
... | ... |
@@ -760,3 +760,3 @@ |
760 | 760 |
/// |
761 |
/// \brief Count the number of bi-node-connected components of an |
|
761 |
/// \brief Count the number of bi-node-connected components of an |
|
762 | 762 |
/// undirected graph. |
... | ... |
@@ -814,3 +814,3 @@ |
814 | 814 |
/// to the number of the bi-node-connected components minus one. Each |
815 |
/// value of the map will be set exactly once, and the values of a |
|
815 |
/// value of the map will be set exactly once, and the values of a |
|
816 | 816 |
/// certain component will be set continuously. |
... | ... |
@@ -860,3 +860,3 @@ |
860 | 860 |
/// \param graph The undirected graph. |
861 |
/// \retval cutMap A writable node map. The values will be set to |
|
861 |
/// \retval cutMap A writable node map. The values will be set to |
|
862 | 862 |
/// \c true for the nodes that separate two or more components |
... | ... |
@@ -1087,3 +1087,3 @@ |
1087 | 1087 |
/// |
1088 |
/// This function checks whether the given undirected graph is |
|
1088 |
/// This function checks whether the given undirected graph is |
|
1089 | 1089 |
/// bi-edge-connected, i.e. any two nodes are connected with at least |
... | ... |
@@ -1194,3 +1194,3 @@ |
1194 | 1194 |
/// This function finds the bi-edge-connected cut edges in the given |
1195 |
/// undirected graph. |
|
1195 |
/// undirected graph. |
|
1196 | 1196 |
/// |
... | ... |
@@ -1351,3 +1351,3 @@ |
1351 | 1351 |
/// \retval order A readable and writable node map. The values will be |
1352 |
/// set from 0 to the number of the nodes in the digraph minus one. |
|
1352 |
/// set from 0 to the number of the nodes in the digraph minus one. |
|
1353 | 1353 |
/// Each value of the map will be set exactly once, and the values will |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -1241,3 +1241,4 @@ |
1241 | 1241 |
|
1242 |
class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type |
|
1242 |
class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type |
|
1243 |
{ |
|
1243 | 1244 |
typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent; |
... | ... |
@@ -1280,3 +1281,3 @@ |
1280 | 1281 |
|
1281 |
protected: |
|
1282 |
protected: |
|
1282 | 1283 |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -94,3 +94,3 @@ |
94 | 94 |
/// "minimum cost flow" \ref amo93networkflows, \ref goldberg90approximation, |
95 |
/// \ref goldberg97efficient, \ref bunnagel98efficient. |
|
95 |
/// \ref goldberg97efficient, \ref bunnagel98efficient. |
|
96 | 96 |
/// It is a highly efficient primal-dual solution method, which |
... | ... |
@@ -191,3 +191,3 @@ |
191 | 191 |
AUGMENT, |
192 |
/// Partial augment operations are used, i.e. flow is moved on |
|
192 |
/// Partial augment operations are used, i.e. flow is moved on |
|
193 | 193 |
/// admissible paths started from a node with excess, but the |
... | ... |
@@ -210,3 +210,3 @@ |
210 | 210 |
private: |
211 |
|
|
211 |
|
|
212 | 212 |
template <typename KT, typename VT> |
... | ... |
@@ -216,5 +216,5 @@ |
216 | 216 |
typedef VT Value; |
217 |
|
|
217 |
|
|
218 | 218 |
StaticVectorMap(std::vector<Value>& v) : _v(v) {} |
219 |
|
|
219 |
|
|
220 | 220 |
const Value& operator[](const Key& key) const { |
... | ... |
@@ -226,3 +226,3 @@ |
226 | 226 |
} |
227 |
|
|
227 |
|
|
228 | 228 |
void set(const Key& key, const Value& val) { |
... | ... |
@@ -285,3 +285,3 @@ |
285 | 285 |
int _max_rank; |
286 |
|
|
286 |
|
|
287 | 287 |
// Data for a StaticDigraph structure |
... | ... |
@@ -293,5 +293,5 @@ |
293 | 293 |
LargeCostNodeMap _pi_map; |
294 |
|
|
294 |
|
|
295 | 295 |
public: |
296 |
|
|
296 |
|
|
297 | 297 |
/// \brief Constant for infinite upper bounds (capacities). |
... | ... |
@@ -350,3 +350,3 @@ |
350 | 350 |
"The cost type of CostScaling must be signed"); |
351 |
|
|
351 |
|
|
352 | 352 |
// Reset data structures |
... | ... |
@@ -466,3 +466,3 @@ |
466 | 466 |
} |
467 |
|
|
467 |
|
|
468 | 468 |
/// @} |
... | ... |
@@ -568,3 +568,3 @@ |
568 | 568 |
_scost[_reverse[j]] = 0; |
569 |
} |
|
569 |
} |
|
570 | 570 |
_have_lower = false; |
... | ... |
@@ -603,3 +603,3 @@ |
603 | 603 |
_supply.resize(_res_node_num); |
604 |
|
|
604 |
|
|
605 | 605 |
_res_cap.resize(_res_arc_num); |
... | ... |
@@ -651,3 +651,3 @@ |
651 | 651 |
} |
652 |
|
|
652 |
|
|
653 | 653 |
// Reset parameters |
... | ... |
@@ -760,3 +760,3 @@ |
760 | 760 |
if (_sum_supply > 0) return INFEASIBLE; |
761 |
|
|
761 |
|
|
762 | 762 |
|
... | ... |
@@ -767,3 +767,3 @@ |
767 | 767 |
} |
768 |
|
|
768 |
|
|
769 | 769 |
// Remove infinite upper bounds and check negative arcs |
... | ... |
@@ -887,3 +887,3 @@ |
887 | 887 |
} |
888 |
|
|
888 |
|
|
889 | 889 |
return OPTIMAL; |
... | ... |
@@ -896,3 +896,3 @@ |
896 | 896 |
|
897 |
// Initialize data structures for buckets |
|
897 |
// Initialize data structures for buckets |
|
898 | 898 |
_max_rank = _alpha * _res_node_num; |
... | ... |
@@ -902,3 +902,3 @@ |
902 | 902 |
_rank.resize(_res_node_num + 1); |
903 |
|
|
903 |
|
|
904 | 904 |
// Execute the algorithm |
... | ... |
@@ -941,3 +941,3 @@ |
941 | 941 |
} |
942 |
|
|
942 |
|
|
943 | 943 |
// Initialize a cost scaling phase |
... | ... |
@@ -959,3 +959,3 @@ |
959 | 959 |
} |
960 |
|
|
960 |
|
|
961 | 961 |
// Find active nodes (i.e. nodes with positive excess) |
... | ... |
@@ -970,3 +970,3 @@ |
970 | 970 |
} |
971 |
|
|
971 |
|
|
972 | 972 |
// Early termination heuristic |
... | ... |
@@ -1000,3 +1000,3 @@ |
1000 | 1000 |
int bucket_end = _root + 1; |
1001 |
|
|
1001 |
|
|
1002 | 1002 |
// Initialize buckets |
... | ... |
@@ -1026,3 +1026,3 @@ |
1026 | 1026 |
_buckets[r] = _bucket_next[u]; |
1027 |
|
|
1027 |
|
|
1028 | 1028 |
// Search the incomming arcs of u |
... | ... |
@@ -1041,3 +1041,3 @@ |
1041 | 1041 |
new_rank_v = r + 1 + int(nrc); |
1042 |
|
|
1042 |
|
|
1043 | 1043 |
// Change the rank of v |
... | ... |
@@ -1046,3 +1046,3 @@ |
1046 | 1046 |
_next_out[v] = _first_out[v]; |
1047 |
|
|
1047 |
|
|
1048 | 1048 |
// Remove v from its old bucket |
... | ... |
@@ -1056,3 +1056,3 @@ |
1056 | 1056 |
} |
1057 |
|
|
1057 |
|
|
1058 | 1058 |
// Insert v to its new bucket |
... | ... |
@@ -1074,3 +1074,3 @@ |
1074 | 1074 |
} |
1075 |
|
|
1075 |
|
|
1076 | 1076 |
// Relabel nodes |
... | ... |
@@ -1094,5 +1094,5 @@ |
1094 | 1094 |
int next_update_limit = global_update_freq; |
1095 |
|
|
1095 |
|
|
1096 | 1096 |
int relabel_cnt = 0; |
1097 |
|
|
1097 |
|
|
1098 | 1098 |
// Perform cost scaling phases |
... | ... |
@@ -1106,6 +1106,6 @@ |
1106 | 1106 |
} |
1107 |
|
|
1107 |
|
|
1108 | 1108 |
// Initialize current phase |
1109 | 1109 |
initPhase(); |
1110 |
|
|
1110 |
|
|
1111 | 1111 |
// Perform partial augment and relabel operations |
... | ... |
@@ -1198,3 +1198,3 @@ |
1198 | 1198 |
int relabel_cnt = 0; |
1199 |
|
|
1199 |
|
|
1200 | 1200 |
// Perform cost scaling phases |
... | ... |
@@ -1209,3 +1209,3 @@ |
1209 | 1209 |
} |
1210 |
|
|
1210 |
|
|
1211 | 1211 |
// Initialize current phase |
... | ... |
@@ -1224,3 +1224,3 @@ |
1224 | 1224 |
pi_n = _pi[n]; |
1225 |
|
|
1225 |
|
|
1226 | 1226 |
// Perform push operations if there are admissible arcs |
... | ... |
@@ -1238,3 +1238,3 @@ |
1238 | 1238 |
for (int ta = _next_out[t]; ta != last_out_t; ++ta) { |
1239 |
if (_res_cap[ta] > 0 && |
|
1239 |
if (_res_cap[ta] > 0 && |
|
1240 | 1240 |
_cost[ta] + pi_t - _pi[_target[ta]] < 0) |
... | ... |
@@ -1289,3 +1289,3 @@ |
1289 | 1289 |
} |
1290 |
|
|
1290 |
|
|
1291 | 1291 |
// Remove nodes that are not active nor hyper |
... | ... |
@@ -1297,3 +1297,3 @@ |
1297 | 1297 |
} |
1298 |
|
|
1298 |
|
|
1299 | 1299 |
// Global update heuristic |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -113,3 +113,3 @@ |
113 | 113 |
|
114 |
int CplexBase::_addRow(Value lb, ExprIterator b, |
|
114 |
int CplexBase::_addRow(Value lb, ExprIterator b, |
|
115 | 115 |
ExprIterator e, Value ub) { |
... | ... |
@@ -491,3 +491,3 @@ |
491 | 491 |
void CplexBase::_applyMessageLevel() { |
492 |
CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND, |
|
492 |
CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND, |
|
493 | 493 |
_message_enabled ? CPX_ON : CPX_OFF); |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -144,3 +144,3 @@ |
144 | 144 |
TEMPLATE_DIGRAPH_TYPEDEFS(GR); |
145 |
|
|
145 |
|
|
146 | 146 |
typedef std::vector<int> IntVector; |
... | ... |
@@ -153,3 +153,3 @@ |
153 | 153 |
private: |
154 |
|
|
154 |
|
|
155 | 155 |
template <typename KT, typename VT> |
... | ... |
@@ -159,5 +159,5 @@ |
159 | 159 |
typedef VT Value; |
160 |
|
|
160 |
|
|
161 | 161 |
StaticVectorMap(std::vector<Value>& v) : _v(v) {} |
162 |
|
|
162 |
|
|
163 | 163 |
const Value& operator[](const Key& key) const { |
... | ... |
@@ -169,3 +169,3 @@ |
169 | 169 |
} |
170 |
|
|
170 |
|
|
171 | 171 |
void set(const Key& key, const Value& val) { |
... | ... |
@@ -223,5 +223,5 @@ |
223 | 223 |
CostNodeMap _pi_map; |
224 |
|
|
224 |
|
|
225 | 225 |
public: |
226 |
|
|
226 |
|
|
227 | 227 |
/// \brief Constant for infinite upper bounds (capacities). |
... | ... |
@@ -368,3 +368,3 @@ |
368 | 368 |
} |
369 |
|
|
369 |
|
|
370 | 370 |
/// @} |
... | ... |
@@ -468,3 +468,3 @@ |
468 | 468 |
_cost[_reverse[j]] = 0; |
469 |
} |
|
469 |
} |
|
470 | 470 |
_have_lower = false; |
... | ... |
@@ -510,3 +510,3 @@ |
510 | 510 |
_supply.resize(_res_node_num); |
511 |
|
|
511 |
|
|
512 | 512 |
_res_cap.resize(_res_arc_num); |
... | ... |
@@ -556,3 +556,3 @@ |
556 | 556 |
} |
557 |
|
|
557 |
|
|
558 | 558 |
// Reset parameters |
... | ... |
@@ -665,3 +665,3 @@ |
665 | 665 |
if (_sum_supply > 0) return INFEASIBLE; |
666 |
|
|
666 |
|
|
667 | 667 |
|
... | ... |
@@ -672,3 +672,3 @@ |
672 | 672 |
ValueVector excess(_supply); |
673 |
|
|
673 |
|
|
674 | 674 |
// Remove infinite upper bounds and check negative arcs |
... | ... |
@@ -772,6 +772,6 @@ |
772 | 772 |
} |
773 |
|
|
773 |
|
|
774 | 774 |
return OPTIMAL; |
775 | 775 |
} |
776 |
|
|
776 |
|
|
777 | 777 |
// Build a StaticDigraph structure containing the current |
... | ... |
@@ -831,3 +831,3 @@ |
831 | 831 |
const double BF_LIMIT_FACTOR = 1.5; |
832 |
|
|
832 |
|
|
833 | 833 |
typedef StaticVectorMap<StaticDigraph::Arc, Value> FilterMap; |
... | ... |
@@ -838,3 +838,3 @@ |
838 | 838 |
::template SetPredMap<PredMap>::Create BF; |
839 |
|
|
839 |
|
|
840 | 840 |
// Build the residual network |
... | ... |
@@ -928,3 +928,3 @@ |
928 | 928 |
::template SetPath<SPath>::Create MMC; |
929 |
|
|
929 |
|
|
930 | 930 |
SPath cycle; |
... | ... |
@@ -951,3 +951,3 @@ |
951 | 951 |
|
952 |
// Rebuild the residual network |
|
952 |
// Rebuild the residual network |
|
953 | 953 |
buildResidualNetwork(); |
... | ... |
@@ -1145,3 +1145,3 @@ |
1145 | 1145 |
int cycle_size = mmc.cycleSize(); |
1146 |
|
|
1146 |
|
|
1147 | 1147 |
// Compute feasible potentials for the current epsilon |
... | ... |
@@ -1157,3 +1157,3 @@ |
1157 | 1157 |
} |
1158 |
|
|
1158 |
|
|
1159 | 1159 |
iter = limit; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -84,3 +84,4 @@ |
84 | 84 |
///The type of the map that indicates which nodes are reached. |
85 |
///It must conform to |
|
85 |
///It must conform to |
|
86 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
86 | 87 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -272,3 +273,4 @@ |
272 | 273 |
///\c ReachedMap type. |
273 |
///It must conform to |
|
274 |
///It must conform to |
|
275 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
274 | 276 |
template <class T> |
... | ... |
@@ -804,3 +806,4 @@ |
804 | 806 |
///The type of the map that indicates which nodes are reached. |
805 |
///It must conform to |
|
807 |
///It must conform to |
|
808 |
///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
806 | 809 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -1209,3 +1212,4 @@ |
1209 | 1212 |
/// The type of the map that indicates which nodes are reached. |
1210 |
/// It must conform to the |
|
1213 |
/// It must conform to the |
|
1214 |
/// \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
1211 | 1215 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -63,3 +63,3 @@ |
63 | 63 |
///This function starts seeking the beginning of the given file for the |
64 |
///problem type and size info. |
|
64 |
///problem type and size info. |
|
65 | 65 |
///The found data is returned in a special struct that can be evaluated |
... | ... |
@@ -214,3 +214,3 @@ |
214 | 214 |
std::numeric_limits<Capacity>::max(); |
215 |
|
|
215 |
|
|
216 | 216 |
while (is >> c) { |
... | ... |
@@ -239,3 +239,3 @@ |
239 | 239 |
capacity.set(e, _cap); |
240 |
} |
|
240 |
} |
|
241 | 241 |
else if (desc.type==DimacsDescriptor::MAX) { |
... | ... |
@@ -364,3 +364,3 @@ |
364 | 364 |
} |
365 |
|
|
365 |
|
|
366 | 366 |
/// \brief DIMACS plain (di)graph reader function. |
... | ... |
@@ -368,3 +368,3 @@ |
368 | 368 |
/// This function reads a plain (di)graph without any designated nodes |
369 |
/// and maps (e.g. a matching instance) from DIMACS format, i.e. from |
|
369 |
/// and maps (e.g. a matching instance) from DIMACS format, i.e. from |
|
370 | 370 |
/// DIMACS files having a line starting with |
... | ... |
@@ -394,3 +394,3 @@ |
394 | 394 |
} |
395 |
|
|
395 |
|
|
396 | 396 |
while (is >> c) { |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -28,3 +28,3 @@ |
28 | 28 |
/// \file |
29 |
/// \brief Euler tour iterators and a function for checking the \e Eulerian |
|
29 |
/// \brief Euler tour iterators and a function for checking the \e Eulerian |
|
30 | 30 |
/// property. |
... | ... |
@@ -43,3 +43,3 @@ |
43 | 43 |
///For example, if the given digraph has an Euler tour (i.e it has only one |
44 |
///non-trivial component and the in-degree is equal to the out-degree |
|
44 |
///non-trivial component and the in-degree is equal to the out-degree |
|
45 | 45 |
///for all nodes), then the following code will put the arcs of \c g |
... | ... |
@@ -140,3 +140,3 @@ |
140 | 140 |
/// |
141 |
///For example, if the given graph has an Euler tour (i.e it has only one |
|
141 |
///For example, if the given graph has an Euler tour (i.e it has only one |
|
142 | 142 |
///non-trivial component and the degree of each node is even), |
... | ... |
@@ -149,3 +149,3 @@ |
149 | 149 |
///\endcode |
150 |
///Although this iterator is for undirected graphs, it still returns |
|
150 |
///Although this iterator is for undirected graphs, it still returns |
|
151 | 151 |
///arcs in order to indicate the direction of the tour. |
... | ... |
@@ -235,3 +235,3 @@ |
235 | 235 |
/// |
236 |
///\warning This incrementation returns an \c Arc (which converts to |
|
236 |
///\warning This incrementation returns an \c Arc (which converts to |
|
237 | 237 |
///an \c Edge), not an \ref EulerIt, as one may expect. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -2011,3 +2011,3 @@ |
2011 | 2011 |
/// |
2012 |
/// This method runs the \c %MaxWeightedPerfectFractionalMatching |
|
2012 |
/// This method runs the \c %MaxWeightedPerfectFractionalMatching |
|
2013 | 2013 |
/// algorithm. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -205,3 +205,3 @@ |
205 | 205 |
/// |
206 |
/// Returns the node with the given index. Since this structure is |
|
206 |
/// Returns the node with the given index. Since this structure is |
|
207 | 207 |
/// completely static, the nodes can be indexed with integers from |
... | ... |
@@ -214,3 +214,3 @@ |
214 | 214 |
/// |
215 |
/// Returns the index of the given node. Since this structure is |
|
215 |
/// Returns the index of the given node. Since this structure is |
|
216 | 216 |
/// completely static, the nodes can be indexed with integers from |
... | ... |
@@ -584,3 +584,3 @@ |
584 | 584 |
/// |
585 |
/// Returns the node with the given index. Since this structure is |
|
585 |
/// Returns the node with the given index. Since this structure is |
|
586 | 586 |
/// completely static, the nodes can be indexed with integers from |
... | ... |
@@ -593,3 +593,3 @@ |
593 | 593 |
/// |
594 |
/// Returns the index of the given node. Since this structure is |
|
594 |
/// Returns the index of the given node. Since this structure is |
|
595 | 595 |
/// completely static, the nodes can be indexed with integers from |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -61,3 +61,3 @@ |
61 | 61 |
|
62 |
int GlpkBase::_addRow(Value lo, ExprIterator b, |
|
62 |
int GlpkBase::_addRow(Value lo, ExprIterator b, |
|
63 | 63 |
ExprIterator e, Value up) { |
... | ... |
@@ -70,3 +70,3 @@ |
70 | 70 |
glp_set_row_bnds(lp, i, GLP_UP, lo, up); |
71 |
} |
|
71 |
} |
|
72 | 72 |
} else { |
... | ... |
@@ -74,3 +74,3 @@ |
74 | 74 |
glp_set_row_bnds(lp, i, GLP_LO, lo, up); |
75 |
} else if (lo != up) { |
|
75 |
} else if (lo != up) { |
|
76 | 76 |
glp_set_row_bnds(lp, i, GLP_DB, lo, up); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -32,3 +32,3 @@ |
32 | 32 |
private: |
33 |
void *_ptr; |
|
33 |
void *_ptr; |
|
34 | 34 |
public: |
... | ... |
@@ -40,4 +40,4 @@ |
40 | 40 |
template <typename T> |
41 |
VoidPtr& operator=(T* ptr) { |
|
42 |
_ptr = reinterpret_cast<void*>(ptr); |
|
41 |
VoidPtr& operator=(T* ptr) { |
|
42 |
_ptr = reinterpret_cast<void*>(ptr); |
|
43 | 43 |
return *this; |
... | ... |
@@ -126,3 +126,3 @@ |
126 | 126 |
}; |
127 |
|
|
127 |
|
|
128 | 128 |
static FreeEnvHelper freeEnvHelper; |
... | ... |
@@ -130,5 +130,5 @@ |
130 | 130 |
protected: |
131 |
|
|
131 |
|
|
132 | 132 |
int _message_level; |
133 |
|
|
133 |
|
|
134 | 134 |
public: |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -29,3 +29,3 @@ |
29 | 29 |
/// \ingroup min_cut |
30 |
/// \file |
|
30 |
/// \file |
|
31 | 31 |
/// \brief Gomory-Hu cut tree in graphs. |
... | ... |
@@ -40,3 +40,3 @@ |
40 | 40 |
/// may contain edges which are not in the original graph. It has the |
41 |
/// property that the minimum capacity edge of the path between two nodes |
|
41 |
/// property that the minimum capacity edge of the path between two nodes |
|
42 | 42 |
/// in this tree has the same weight as the minimum cut in the graph |
... | ... |
@@ -46,3 +46,3 @@ |
46 | 46 |
/// of nodes can easily be obtained. |
47 |
/// |
|
47 |
/// |
|
48 | 48 |
/// The algorithm calculates \e n-1 distinct minimum cuts (currently with |
... | ... |
@@ -62,6 +62,6 @@ |
62 | 62 |
template <typename GR, |
63 |
|
|
63 |
typename CAP> |
|
64 | 64 |
#else |
65 | 65 |
template <typename GR, |
66 |
|
|
66 |
typename CAP = typename GR::template EdgeMap<int> > |
|
67 | 67 |
#endif |
... | ... |
@@ -76,3 +76,3 @@ |
76 | 76 |
typedef typename Capacity::Value Value; |
77 |
|
|
77 |
|
|
78 | 78 |
private: |
... | ... |
@@ -91,9 +91,9 @@ |
91 | 91 |
if (!_pred) { |
92 |
|
|
92 |
_pred = new typename Graph::template NodeMap<Node>(_graph); |
|
93 | 93 |
} |
94 | 94 |
if (!_weight) { |
95 |
|
|
95 |
_weight = new typename Graph::template NodeMap<Value>(_graph); |
|
96 | 96 |
} |
97 | 97 |
if (!_order) { |
98 |
|
|
98 |
_order = new typename Graph::template NodeMap<int>(_graph); |
|
99 | 99 |
} |
... | ... |
@@ -103,12 +103,12 @@ |
103 | 103 |
if (_pred) { |
104 |
|
|
104 |
delete _pred; |
|
105 | 105 |
} |
106 | 106 |
if (_weight) { |
107 |
|
|
107 |
delete _weight; |
|
108 | 108 |
} |
109 | 109 |
if (_order) { |
110 |
|
|
110 |
delete _order; |
|
111 | 111 |
} |
112 | 112 |
} |
113 |
|
|
113 |
|
|
114 | 114 |
public: |
... | ... |
@@ -120,5 +120,5 @@ |
120 | 120 |
/// \param capacity The edge capacity map. |
121 |
GomoryHu(const Graph& graph, const Capacity& capacity) |
|
121 |
GomoryHu(const Graph& graph, const Capacity& capacity) |
|
122 | 122 |
: _graph(graph), _capacity(capacity), |
123 |
|
|
123 |
_pred(0), _weight(0), _order(0) |
|
124 | 124 |
{ |
... | ... |
@@ -136,3 +136,3 @@ |
136 | 136 |
private: |
137 |
|
|
137 |
|
|
138 | 138 |
// Initialize the internal data structures |
... | ... |
@@ -147,3 +147,3 @@ |
147 | 147 |
(*_pred)[_root] = INVALID; |
148 |
(*_weight)[_root] = std::numeric_limits<Value>::max(); |
|
148 |
(*_weight)[_root] = std::numeric_limits<Value>::max(); |
|
149 | 149 |
} |
... | ... |
@@ -156,23 +156,23 @@ |
156 | 156 |
for (NodeIt n(_graph); n != INVALID; ++n) { |
157 |
|
|
157 |
if (n == _root) continue; |
|
158 | 158 |
|
159 |
Node pn = (*_pred)[n]; |
|
160 |
fa.source(n); |
|
161 |
|
|
159 |
Node pn = (*_pred)[n]; |
|
160 |
fa.source(n); |
|
161 |
fa.target(pn); |
|
162 | 162 |
|
163 |
|
|
163 |
fa.runMinCut(); |
|
164 | 164 |
|
165 |
|
|
165 |
(*_weight)[n] = fa.flowValue(); |
|
166 | 166 |
|
167 |
for (NodeIt nn(_graph); nn != INVALID; ++nn) { |
|
168 |
if (nn != n && fa.minCut(nn) && (*_pred)[nn] == pn) { |
|
169 |
(*_pred)[nn] = n; |
|
170 |
} |
|
171 |
} |
|
172 |
if ((*_pred)[pn] != INVALID && fa.minCut((*_pred)[pn])) { |
|
173 |
(*_pred)[n] = (*_pred)[pn]; |
|
174 |
(*_pred)[pn] = n; |
|
175 |
(*_weight)[n] = (*_weight)[pn]; |
|
176 |
(*_weight)[pn] = fa.flowValue(); |
|
177 |
|
|
167 |
for (NodeIt nn(_graph); nn != INVALID; ++nn) { |
|
168 |
if (nn != n && fa.minCut(nn) && (*_pred)[nn] == pn) { |
|
169 |
(*_pred)[nn] = n; |
|
170 |
} |
|
171 |
} |
|
172 |
if ((*_pred)[pn] != INVALID && fa.minCut((*_pred)[pn])) { |
|
173 |
(*_pred)[n] = (*_pred)[pn]; |
|
174 |
(*_pred)[pn] = n; |
|
175 |
(*_weight)[n] = (*_weight)[pn]; |
|
176 |
(*_weight)[pn] = fa.flowValue(); |
|
177 |
} |
|
178 | 178 |
} |
... | ... |
@@ -183,12 +183,12 @@ |
183 | 183 |
for (NodeIt n(_graph); n != INVALID; ++n) { |
184 |
std::vector<Node> st; |
|
185 |
Node nn = n; |
|
186 |
while ((*_order)[nn] == -1) { |
|
187 |
st.push_back(nn); |
|
188 |
nn = (*_pred)[nn]; |
|
189 |
} |
|
190 |
while (!st.empty()) { |
|
191 |
(*_order)[st.back()] = index++; |
|
192 |
st.pop_back(); |
|
193 |
} |
|
184 |
std::vector<Node> st; |
|
185 |
Node nn = n; |
|
186 |
while ((*_order)[nn] == -1) { |
|
187 |
st.push_back(nn); |
|
188 |
nn = (*_pred)[nn]; |
|
189 |
} |
|
190 |
while (!st.empty()) { |
|
191 |
(*_order)[st.back()] = index++; |
|
192 |
st.pop_back(); |
|
193 |
} |
|
194 | 194 |
} |
... | ... |
@@ -199,3 +199,3 @@ |
199 | 199 |
///\name Execution Control |
200 |
|
|
200 |
|
|
201 | 201 |
///@{ |
... | ... |
@@ -209,3 +209,3 @@ |
209 | 209 |
} |
210 |
|
|
210 |
|
|
211 | 211 |
/// @} |
... | ... |
@@ -234,3 +234,3 @@ |
234 | 234 |
/// |
235 |
/// This function returns the weight of the predecessor edge of the |
|
235 |
/// This function returns the weight of the predecessor edge of the |
|
236 | 236 |
/// given node in the Gomory-Hu tree. |
... | ... |
@@ -256,3 +256,3 @@ |
256 | 256 |
/// This function returns the minimum cut value between the nodes |
257 |
/// \c s and \c t. |
|
257 |
/// \c s and \c t. |
|
258 | 258 |
/// It finds the nearest common ancestor of the given nodes in the |
... | ... |
@@ -265,11 +265,11 @@ |
265 | 265 |
Value value = std::numeric_limits<Value>::max(); |
266 |
|
|
266 |
|
|
267 | 267 |
while (sn != tn) { |
268 |
if ((*_order)[sn] < (*_order)[tn]) { |
|
269 |
if ((*_weight)[tn] <= value) value = (*_weight)[tn]; |
|
270 |
tn = (*_pred)[tn]; |
|
271 |
} else { |
|
272 |
if ((*_weight)[sn] <= value) value = (*_weight)[sn]; |
|
273 |
sn = (*_pred)[sn]; |
|
274 |
|
|
268 |
if ((*_order)[sn] < (*_order)[tn]) { |
|
269 |
if ((*_weight)[tn] <= value) value = (*_weight)[tn]; |
|
270 |
tn = (*_pred)[tn]; |
|
271 |
} else { |
|
272 |
if ((*_weight)[sn] <= value) value = (*_weight)[sn]; |
|
273 |
sn = (*_pred)[sn]; |
|
274 |
} |
|
275 | 275 |
} |
... | ... |
@@ -304,19 +304,19 @@ |
304 | 304 |
Value value = std::numeric_limits<Value>::max(); |
305 |
|
|
305 |
|
|
306 | 306 |
while (sn != tn) { |
307 |
if ((*_order)[sn] < (*_order)[tn]) { |
|
308 |
if ((*_weight)[tn] <= value) { |
|
309 |
|
|
307 |
if ((*_order)[sn] < (*_order)[tn]) { |
|
308 |
if ((*_weight)[tn] <= value) { |
|
309 |
rn = tn; |
|
310 | 310 |
s_root = false; |
311 |
value = (*_weight)[tn]; |
|
312 |
} |
|
313 |
tn = (*_pred)[tn]; |
|
314 |
} else { |
|
315 |
if ((*_weight)[sn] <= value) { |
|
316 |
rn = sn; |
|
311 |
value = (*_weight)[tn]; |
|
312 |
} |
|
313 |
tn = (*_pred)[tn]; |
|
314 |
} else { |
|
315 |
if ((*_weight)[sn] <= value) { |
|
316 |
rn = sn; |
|
317 | 317 |
s_root = true; |
318 |
value = (*_weight)[sn]; |
|
319 |
} |
|
320 |
sn = (*_pred)[sn]; |
|
321 |
} |
|
318 |
value = (*_weight)[sn]; |
|
319 |
} |
|
320 |
sn = (*_pred)[sn]; |
|
321 |
} |
|
322 | 322 |
} |
... | ... |
@@ -331,14 +331,14 @@ |
331 | 331 |
for (NodeIt n(_graph); n != INVALID; ++n) { |
332 |
|
|
332 |
st.clear(); |
|
333 | 333 |
Node nn = n; |
334 |
while (!reached[nn]) { |
|
335 |
st.push_back(nn); |
|
336 |
nn = (*_pred)[nn]; |
|
337 |
} |
|
338 |
while (!st.empty()) { |
|
339 |
cutMap.set(st.back(), cutMap[nn]); |
|
340 |
st.pop_back(); |
|
341 |
} |
|
334 |
while (!reached[nn]) { |
|
335 |
st.push_back(nn); |
|
336 |
nn = (*_pred)[nn]; |
|
337 |
} |
|
338 |
while (!st.empty()) { |
|
339 |
cutMap.set(st.back(), cutMap[nn]); |
|
340 |
st.pop_back(); |
|
341 |
} |
|
342 | 342 |
} |
343 |
|
|
343 |
|
|
344 | 344 |
return value; |
... | ... |
@@ -351,3 +351,3 @@ |
351 | 351 |
/// Iterate on the nodes of a minimum cut |
352 |
|
|
352 |
|
|
353 | 353 |
/// This iterator class lists the nodes of a minimum cut found by |
... | ... |
@@ -444,7 +444,7 @@ |
444 | 444 |
}; |
445 |
|
|
445 |
|
|
446 | 446 |
friend class MinCutEdgeIt; |
447 |
|
|
447 |
|
|
448 | 448 |
/// Iterate on the edges of a minimum cut |
449 |
|
|
449 |
|
|
450 | 450 |
/// This iterator class lists the edges of a minimum cut found by |
... | ... |
@@ -481,3 +481,3 @@ |
481 | 481 |
} |
482 |
|
|
482 |
|
|
483 | 483 |
public: |
... | ... |
@@ -550,3 +550,3 @@ |
550 | 550 |
/// Postfix incrementation |
551 |
|
|
551 |
|
|
552 | 552 |
/// Postfix incrementation. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -33,3 +33,3 @@ |
33 | 33 |
/// |
34 |
/// Implementation of the Hao-Orlin algorithm for finding a minimum cut |
|
34 |
/// Implementation of the Hao-Orlin algorithm for finding a minimum cut |
|
35 | 35 |
/// in a digraph. |
... | ... |
@@ -43,3 +43,3 @@ |
43 | 43 |
/// This class implements the Hao-Orlin algorithm for finding a minimum |
44 |
/// value cut in a directed graph \f$D=(V,A)\f$. |
|
44 |
/// value cut in a directed graph \f$D=(V,A)\f$. |
|
45 | 45 |
/// It takes a fixed node \f$ source \in V \f$ and |
... | ... |
@@ -60,3 +60,3 @@ |
60 | 60 |
/// algorithm or you can use the algorithm of Nagamochi and Ibaraki, |
61 |
/// which solves the undirected problem in \f$ O(nm + n^2 \log n) \f$ |
|
61 |
/// which solves the undirected problem in \f$ O(nm + n^2 \log n) \f$ |
|
62 | 62 |
/// time. It is implemented in the NagamochiIbaraki algorithm class. |
... | ... |
@@ -78,3 +78,3 @@ |
78 | 78 |
public: |
79 |
|
|
79 |
|
|
80 | 80 |
/// The digraph type of the algorithm |
... | ... |
@@ -866,3 +866,3 @@ |
866 | 866 |
/// This function initializes the internal data structures. It creates |
867 |
/// the maps and some bucket structures for the algorithm. |
|
867 |
/// the maps and some bucket structures for the algorithm. |
|
868 | 868 |
/// The given node is used as the source node for the push-relabel |
... | ... |
@@ -946,3 +946,3 @@ |
946 | 946 |
/// |
947 |
/// This function runs the algorithm. It uses the given \c source node, |
|
947 |
/// This function runs the algorithm. It uses the given \c source node, |
|
948 | 948 |
/// finds a proper \c target node and then calls the \ref init(), |
... | ... |
@@ -960,3 +960,3 @@ |
960 | 960 |
/// can be obtained using these functions.\n |
961 |
/// \ref run(), \ref calculateOut() or \ref calculateIn() |
|
961 |
/// \ref run(), \ref calculateOut() or \ref calculateIn() |
|
962 | 962 |
/// should be called before using them. |
... | ... |
@@ -969,3 +969,3 @@ |
969 | 969 |
/// |
970 |
/// \pre \ref run(), \ref calculateOut() or \ref calculateIn() |
|
970 |
/// \pre \ref run(), \ref calculateOut() or \ref calculateIn() |
|
971 | 971 |
/// must be called before using this function. |
... | ... |
@@ -988,3 +988,3 @@ |
988 | 988 |
/// |
989 |
/// \pre \ref run(), \ref calculateOut() or \ref calculateIn() |
|
989 |
/// \pre \ref run(), \ref calculateOut() or \ref calculateIn() |
|
990 | 990 |
/// must be called before using this function. |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -345,3 +345,3 @@ |
345 | 345 |
findComponents(); |
346 |
|
|
346 |
|
|
347 | 347 |
// Find the minimum cycle mean in the components |
... | ... |
@@ -350,5 +350,5 @@ |
350 | 350 |
processRounds(); |
351 |
|
|
351 |
|
|
352 | 352 |
// Update the best cycle (global minimum mean cycle) |
353 |
if ( _curr_found && (!_best_found || |
|
353 |
if ( _curr_found && (!_best_found || |
|
354 | 354 |
_curr_cost * _best_size < _best_cost * _curr_size) ) { |
... | ... |
@@ -505,3 +505,3 @@ |
505 | 505 |
return false; |
506 |
} |
|
506 |
} |
|
507 | 507 |
for (int i = 0; i < n; ++i) { |
... | ... |
@@ -578,3 +578,3 @@ |
578 | 578 |
} |
579 |
|
|
579 |
|
|
580 | 580 |
// Check early termination |
... | ... |
@@ -588,3 +588,3 @@ |
588 | 588 |
Node u; |
589 |
|
|
589 |
|
|
590 | 590 |
// Search for cycles that are already found |
... | ... |
@@ -609,4 +609,4 @@ |
609 | 609 |
if (j != 0) { |
610 |
u = _gr.source(_data[u][j].pred); |
|
611 |
} |
|
610 |
u = _gr.source(_data[u][j].pred); |
|
611 |
} |
|
612 | 612 |
} |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -123,3 +123,3 @@ |
123 | 123 |
public: |
124 |
|
|
124 |
|
|
125 | 125 |
/// The type of the digraph |
... | ... |
@@ -154,3 +154,3 @@ |
154 | 154 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
155 |
|
|
155 |
|
|
156 | 156 |
// The digraph the algorithm runs on |
... | ... |
@@ -181,3 +181,3 @@ |
181 | 181 |
typename Digraph::template NodeMap<std::vector<Arc> > _in_arcs; |
182 |
|
|
182 |
|
|
183 | 183 |
// Queue used for BFS search |
... | ... |
@@ -187,3 +187,3 @@ |
187 | 187 |
Tolerance _tolerance; |
188 |
|
|
188 |
|
|
189 | 189 |
// Infinite constant |
... | ... |
@@ -192,3 +192,3 @@ |
192 | 192 |
public: |
193 |
|
|
193 |
|
|
194 | 194 |
/// \name Named Template Parameters |
... | ... |
@@ -230,3 +230,3 @@ |
230 | 230 |
}; |
231 |
|
|
231 |
|
|
232 | 232 |
/// @} |
... | ... |
@@ -336,3 +336,3 @@ |
336 | 336 |
findComponents(); |
337 |
|
|
337 |
|
|
338 | 338 |
// Find the minimum cycle mean in the components |
... | ... |
@@ -447,3 +447,3 @@ |
447 | 447 |
} |
448 |
|
|
448 |
|
|
449 | 449 |
// Find strongly connected components and initialize _comp_nodes |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -193,3 +193,3 @@ |
193 | 193 |
Tolerance _tolerance; |
194 |
|
|
194 |
|
|
195 | 195 |
// Infinite constant |
... | ... |
@@ -341,3 +341,3 @@ |
341 | 341 |
findComponents(); |
342 |
|
|
342 |
|
|
343 | 343 |
// Find the minimum cycle mean in the components |
... | ... |
@@ -491,3 +491,3 @@ |
491 | 491 |
return false; |
492 |
} |
|
492 |
} |
|
493 | 493 |
for (int i = 0; i < n; ++i) { |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -564,3 +564,3 @@ |
564 | 564 |
template <typename TDGR> |
565 |
friend DigraphReader<TDGR> digraphReader(TDGR& digraph, |
|
565 |
friend DigraphReader<TDGR> digraphReader(TDGR& digraph, |
|
566 | 566 |
const std::string& fn); |
... | ... |
@@ -1189,3 +1189,3 @@ |
1189 | 1189 |
}; |
1190 |
|
|
1190 |
|
|
1191 | 1191 |
/// \ingroup lemon_io |
... | ... |
@@ -1196,3 +1196,3 @@ |
1196 | 1196 |
/// |
1197 |
/// With this function a digraph can be read from an |
|
1197 |
/// With this function a digraph can be read from an |
|
1198 | 1198 |
/// \ref lgf-format "LGF" file or input stream with several maps and |
... | ... |
@@ -1251,3 +1251,3 @@ |
1251 | 1251 |
class GraphReader; |
1252 |
|
|
1252 |
|
|
1253 | 1253 |
template <typename TGR> |
... | ... |
@@ -1388,3 +1388,3 @@ |
1388 | 1388 |
template <typename TGR> |
1389 |
friend GraphReader<TGR> graphReader(TGR& graph, const std::string& fn); |
|
1389 |
friend GraphReader<TGR> graphReader(TGR& graph, const std::string& fn); |
|
1390 | 1390 |
template <typename TGR> |
... | ... |
@@ -2065,5 +2065,5 @@ |
2065 | 2065 |
/// |
2066 |
/// This function just returns a \ref GraphReader class. |
|
2066 |
/// This function just returns a \ref GraphReader class. |
|
2067 | 2067 |
/// |
2068 |
/// With this function a graph can be read from an |
|
2068 |
/// With this function a graph can be read from an |
|
2069 | 2069 |
/// \ref lgf-format "LGF" file or input stream with several maps and |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -353,3 +353,3 @@ |
353 | 353 |
template <typename TDGR> |
354 |
DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
354 |
DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
355 | 355 |
std::ostream& os = std::cout); |
... | ... |
@@ -506,3 +506,3 @@ |
506 | 506 |
template <typename TDGR> |
507 |
friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
507 |
friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
508 | 508 |
std::ostream& os); |
... | ... |
@@ -919,3 +919,3 @@ |
919 | 919 |
/// |
920 |
/// This function just returns a \ref DigraphWriter class. |
|
920 |
/// This function just returns a \ref DigraphWriter class. |
|
921 | 921 |
/// |
... | ... |
@@ -959,3 +959,3 @@ |
959 | 959 |
template <typename TDGR> |
960 |
DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
960 |
DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, |
|
961 | 961 |
const std::string& fn) { |
... | ... |
@@ -1103,3 +1103,3 @@ |
1103 | 1103 |
template <typename TGR> |
1104 |
friend GraphWriter<TGR> graphWriter(const TGR& graph, |
|
1104 |
friend GraphWriter<TGR> graphWriter(const TGR& graph, |
|
1105 | 1105 |
const std::string& fn); |
... | ... |
@@ -1107,3 +1107,3 @@ |
1107 | 1107 |
friend GraphWriter<TGR> graphWriter(const TGR& graph, const char *fn); |
1108 |
|
|
1108 |
|
|
1109 | 1109 |
GraphWriter(GraphWriter& other) |
... | ... |
@@ -1558,3 +1558,3 @@ |
1558 | 1558 |
/// |
1559 |
/// This function just returns a \ref GraphWriter class. |
|
1559 |
/// This function just returns a \ref GraphWriter class. |
|
1560 | 1560 |
/// |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -448,3 +448,3 @@ |
448 | 448 |
///iterators are invalidated for the incomming arcs of \c v. |
449 |
///Moreover all iterators referencing node \c v or the removed |
|
449 |
///Moreover all iterators referencing node \c v or the removed |
|
450 | 450 |
///loops are also invalidated. Other iterators remain valid. |
... | ... |
@@ -554,3 +554,3 @@ |
554 | 554 |
/// |
555 |
/// \note After a state is restored, you cannot restore a later state, |
|
555 |
/// \note After a state is restored, you cannot restore a later state, |
|
556 | 556 |
/// i.e. you cannot add the removed nodes and arcs again using |
... | ... |
@@ -1309,3 +1309,3 @@ |
1309 | 1309 |
/// \c b are invalidated. |
1310 |
/// Moreover all iterators referencing node \c b or the removed |
|
1310 |
/// Moreover all iterators referencing node \c b or the removed |
|
1311 | 1311 |
/// loops are also invalidated. Other iterators remain valid. |
... | ... |
@@ -1366,3 +1366,3 @@ |
1366 | 1366 |
/// |
1367 |
/// \note After a state is restored, you cannot restore a later state, |
|
1367 |
/// \note After a state is restored, you cannot restore a later state, |
|
1368 | 1368 |
/// i.e. you cannot add the removed nodes and edges again using |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -84,3 +84,3 @@ |
84 | 84 |
}; |
85 |
|
|
85 |
|
|
86 | 86 |
|
... | ... |
@@ -116,3 +116,3 @@ |
116 | 116 |
/// Default constructor |
117 |
|
|
117 |
|
|
118 | 118 |
/// \warning The default constructor sets the Col to an |
... | ... |
@@ -121,5 +121,5 @@ |
121 | 121 |
/// Invalid constructor \& conversion. |
122 |
|
|
122 |
|
|
123 | 123 |
/// This constructor initializes the Col to be invalid. |
124 |
/// \sa Invalid for more details. |
|
124 |
/// \sa Invalid for more details. |
|
125 | 125 |
Col(const Invalid&) : _id(-1) {} |
... | ... |
@@ -158,3 +158,3 @@ |
158 | 158 |
/// Default constructor |
159 |
|
|
159 |
|
|
160 | 160 |
/// \warning The default constructor sets the iterator |
... | ... |
@@ -163,3 +163,3 @@ |
163 | 163 |
/// Sets the iterator to the first Col |
164 |
|
|
164 |
|
|
165 | 165 |
/// Sets the iterator to the first Col. |
... | ... |
@@ -171,3 +171,3 @@ |
171 | 171 |
/// Invalid constructor \& conversion |
172 |
|
|
172 |
|
|
173 | 173 |
/// Initialize the iterator to be invalid. |
... | ... |
@@ -176,3 +176,3 @@ |
176 | 176 |
/// Next column |
177 |
|
|
177 |
|
|
178 | 178 |
/// Assign the iterator to the next column. |
... | ... |
@@ -211,3 +211,3 @@ |
211 | 211 |
/// Default constructor |
212 |
|
|
212 |
|
|
213 | 213 |
/// \warning The default constructor sets the Row to an |
... | ... |
@@ -216,5 +216,5 @@ |
216 | 216 |
/// Invalid constructor \& conversion. |
217 |
|
|
217 |
|
|
218 | 218 |
/// This constructor initializes the Row to be invalid. |
219 |
/// \sa Invalid for more details. |
|
219 |
/// \sa Invalid for more details. |
|
220 | 220 |
Row(const Invalid&) : _id(-1) {} |
... | ... |
@@ -226,3 +226,3 @@ |
226 | 226 |
/// Inequality operator |
227 |
|
|
227 |
|
|
228 | 228 |
/// \sa operator==(Row r) |
... | ... |
@@ -253,3 +253,3 @@ |
253 | 253 |
/// Default constructor |
254 |
|
|
254 |
|
|
255 | 255 |
/// \warning The default constructor sets the iterator |
... | ... |
@@ -258,3 +258,3 @@ |
258 | 258 |
/// Sets the iterator to the first Row |
259 |
|
|
259 |
|
|
260 | 260 |
/// Sets the iterator to the first Row. |
... | ... |
@@ -266,3 +266,3 @@ |
266 | 266 |
/// Invalid constructor \& conversion |
267 |
|
|
267 |
|
|
268 | 268 |
/// Initialize the iterator to be invalid. |
... | ... |
@@ -271,3 +271,3 @@ |
271 | 271 |
/// Next row |
272 |
|
|
272 |
|
|
273 | 273 |
/// Assign the iterator to the next row. |
... | ... |
@@ -349,3 +349,3 @@ |
349 | 349 |
/// Default constructor |
350 |
|
|
350 |
|
|
351 | 351 |
/// Construct an empty expression, the coefficients and |
... | ... |
@@ -450,5 +450,5 @@ |
450 | 450 |
///Iterator over the expression |
451 |
|
|
452 |
///The iterator iterates over the terms of the expression. |
|
453 |
|
|
451 |
|
|
452 |
///The iterator iterates over the terms of the expression. |
|
453 |
/// |
|
454 | 454 |
///\code |
... | ... |
@@ -466,3 +466,3 @@ |
466 | 466 |
/// Sets the iterator to the first term |
467 |
|
|
467 |
|
|
468 | 468 |
/// Sets the iterator to the first term of the expression. |
... | ... |
@@ -483,3 +483,3 @@ |
483 | 483 |
/// Next term |
484 |
|
|
484 |
|
|
485 | 485 |
/// Assign the iterator to the next term. |
... | ... |
@@ -495,5 +495,5 @@ |
495 | 495 |
/// Const iterator over the expression |
496 |
|
|
497 |
///The iterator iterates over the terms of the expression. |
|
498 |
|
|
496 |
|
|
497 |
///The iterator iterates over the terms of the expression. |
|
498 |
/// |
|
499 | 499 |
///\code |
... | ... |
@@ -511,3 +511,3 @@ |
511 | 511 |
/// Sets the iterator to the first term |
512 |
|
|
512 |
|
|
513 | 513 |
/// Sets the iterator to the first term of the expression. |
... | ... |
@@ -526,3 +526,3 @@ |
526 | 526 |
/// Next term |
527 |
|
|
527 |
|
|
528 | 528 |
/// Assign the iterator to the next term. |
... | ... |
@@ -675,3 +675,3 @@ |
675 | 675 |
/// Default constructor |
676 |
|
|
676 |
|
|
677 | 677 |
/// Construct an empty expression, the coefficients are |
... | ... |
@@ -710,3 +710,3 @@ |
710 | 710 |
/// \brief Removes the coefficients which's absolute value does |
711 |
/// not exceed \c epsilon. |
|
711 |
/// not exceed \c epsilon. |
|
712 | 712 |
void simplify(Value epsilon = 0.0) { |
... | ... |
@@ -759,5 +759,5 @@ |
759 | 759 |
///Iterator over the expression |
760 |
|
|
761 |
///The iterator iterates over the terms of the expression. |
|
762 |
|
|
760 |
|
|
761 |
///The iterator iterates over the terms of the expression. |
|
762 |
/// |
|
763 | 763 |
///\code |
... | ... |
@@ -775,3 +775,3 @@ |
775 | 775 |
/// Sets the iterator to the first term |
776 |
|
|
776 |
|
|
777 | 777 |
/// Sets the iterator to the first term of the expression. |
... | ... |
@@ -793,3 +793,3 @@ |
793 | 793 |
/// Next term |
794 |
|
|
794 |
|
|
795 | 795 |
/// Assign the iterator to the next term. |
... | ... |
@@ -805,5 +805,5 @@ |
805 | 805 |
///Iterator over the expression |
806 |
|
|
807 |
///The iterator iterates over the terms of the expression. |
|
808 |
|
|
806 |
|
|
807 |
///The iterator iterates over the terms of the expression. |
|
808 |
/// |
|
809 | 809 |
///\code |
... | ... |
@@ -821,3 +821,3 @@ |
821 | 821 |
/// Sets the iterator to the first term |
822 |
|
|
822 |
|
|
823 | 823 |
/// Sets the iterator to the first term of the expression. |
... | ... |
@@ -836,3 +836,3 @@ |
836 | 836 |
/// Next term |
837 |
|
|
837 |
|
|
838 | 838 |
/// Assign the iterator to the next term. |
... | ... |
@@ -1231,3 +1231,3 @@ |
1231 | 1231 |
c.expr().simplify(); |
1232 |
r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()-*c.expr():-INF, |
|
1232 |
r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()-*c.expr():-INF, |
|
1233 | 1233 |
ExprIterator(c.expr().comps.begin(), cols), |
... | ... |
@@ -1819,6 +1819,6 @@ |
1819 | 1819 |
/// The variable is in the basis |
1820 |
BASIC, |
|
1820 |
BASIC, |
|
1821 | 1821 |
/// The variable is free, but not basic |
1822 | 1822 |
FREE, |
1823 |
/// The variable has active lower bound |
|
1823 |
/// The variable has active lower bound |
|
1824 | 1824 |
LOWER, |
... | ... |
@@ -1901,3 +1901,3 @@ |
1901 | 1901 |
/// Returns a component of the primal ray |
1902 |
|
|
1902 |
|
|
1903 | 1903 |
/// The primal ray is solution of the modified primal problem, |
... | ... |
@@ -1935,3 +1935,3 @@ |
1935 | 1935 |
/// Returns a component of the dual ray |
1936 |
|
|
1936 |
|
|
1937 | 1937 |
/// The dual ray is solution of the modified primal problem, where |
... | ... |
@@ -2077,3 +2077,3 @@ |
2077 | 2077 |
///The value of the objective function |
2078 |
|
|
2078 |
|
|
2079 | 2079 |
///\return |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -25,3 +25,3 @@ |
25 | 25 |
///\brief Skeleton file to implement LP/MIP solver interfaces |
26 |
/// |
|
26 |
/// |
|
27 | 27 |
///The classes in this file do nothing, but they can serve as skeletons when |
... | ... |
@@ -31,3 +31,3 @@ |
31 | 31 |
///A skeleton class to implement LP/MIP solver base interface |
32 |
|
|
32 |
|
|
33 | 33 |
///This class does nothing, but it can serve as a skeleton when |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -235,3 +235,3 @@ |
235 | 235 |
/// integers. This map conforms to the \ref concepts::ReferenceMap |
236 |
/// "ReferenceMap" concept. |
|
236 |
/// "ReferenceMap" concept. |
|
237 | 237 |
/// |
... | ... |
@@ -1918,3 +1918,3 @@ |
1918 | 1918 |
/// accessed with an STL compatible forward iterator (\c ValueIt). |
1919 |
/// |
|
1919 |
/// |
|
1920 | 1920 |
/// This map is intended to be used when all associated values are |
... | ... |
@@ -1922,3 +1922,3 @@ |
1922 | 1922 |
/// items with the same value. |
1923 |
/// Otherwise consider to use \c IterableValueMap, which is more |
|
1923 |
/// Otherwise consider to use \c IterableValueMap, which is more |
|
1924 | 1924 |
/// suitable and more efficient for such cases. It provides iterators |
... | ... |
@@ -2004,3 +2004,3 @@ |
2004 | 2004 |
}; |
2005 |
|
|
2005 |
|
|
2006 | 2006 |
/// Alias for \c ValueIt |
... | ... |
@@ -2063,3 +2063,3 @@ |
2063 | 2063 |
} |
2064 |
|
|
2064 |
|
|
2065 | 2065 |
/// \brief Returns the number of items with the given value. |
... | ... |
@@ -2380,3 +2380,3 @@ |
2380 | 2380 |
} |
2381 |
|
|
2381 |
|
|
2382 | 2382 |
/// \brief Dynamic iterable \c bool map. |
... | ... |
@@ -2640,3 +2640,3 @@ |
2640 | 2640 |
ItemIt(const IterableBoolMap& map, bool value) |
2641 |
: Parent(value ? |
|
2641 |
: Parent(value ? |
|
2642 | 2642 |
(map._sep > 0 ? |
... | ... |
@@ -3788,3 +3788,3 @@ |
3788 | 3788 |
typedef typename ItemSetTraits<GR, Item>::ItemIt ItemIt; |
3789 |
|
|
3789 |
|
|
3790 | 3790 |
for (ItemIt it(gr); it != INVALID; ++it) { |
... | ... |
@@ -3796,3 +3796,3 @@ |
3796 | 3796 |
/// |
3797 |
/// This function compares the values of two graph maps. It returns |
|
3797 |
/// This function compares the values of two graph maps. It returns |
|
3798 | 3798 |
/// \c true if the maps assign the same value for all items in the graph. |
... | ... |
@@ -3808,3 +3808,3 @@ |
3808 | 3808 |
typedef typename ItemSetTraits<GR, Item>::ItemIt ItemIt; |
3809 |
|
|
3809 |
|
|
3810 | 3810 |
for (ItemIt it(gr); it != INVALID; ++it) { |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -1625,3 +1625,3 @@ |
1625 | 1625 |
} |
1626 |
|
|
1626 |
|
|
1627 | 1627 |
_unmatched = _node_num; |
... | ... |
@@ -1680,3 +1680,3 @@ |
1680 | 1680 |
_blossom_potential.clear(); |
1681 |
|
|
1681 |
|
|
1682 | 1682 |
if (_fractional == 0) { |
... | ... |
@@ -1752,6 +1752,6 @@ |
1752 | 1752 |
_delta1->push(v, _fractional->nodeValue(v)); |
1753 |
v = _graph.target(_fractional->matching(v)); |
|
1753 |
v = _graph.target(_fractional->matching(v)); |
|
1754 | 1754 |
} |
1755 |
|
|
1756 |
int surface = |
|
1755 |
|
|
1756 |
int surface = |
|
1757 | 1757 |
_blossom_set->join(subblossoms.begin(), subblossoms.end()); |
... | ... |
@@ -1762,3 +1762,3 @@ |
1762 | 1762 |
(*_blossom_data)[surface].offset = 0; |
1763 |
|
|
1763 |
|
|
1764 | 1764 |
_tree_set->insert(surface); |
... | ... |
@@ -1812,3 +1812,3 @@ |
1812 | 1812 |
} |
1813 |
|
|
1813 |
|
|
1814 | 1814 |
if (!(*_node_data)[ni].heap.empty()) { |
... | ... |
@@ -2271,3 +2271,3 @@ |
2271 | 2271 |
|
2272 |
typedef MaxWeightedPerfectFractionalMatching<Graph, WeightMap> |
|
2272 |
typedef MaxWeightedPerfectFractionalMatching<Graph, WeightMap> |
|
2273 | 2273 |
FractionalMatching; |
... | ... |
@@ -3097,3 +3097,3 @@ |
3097 | 3097 |
_blossom_potential.clear(); |
3098 |
|
|
3098 |
|
|
3099 | 3099 |
if (_fractional == 0) { |
... | ... |
@@ -3163,6 +3163,6 @@ |
3163 | 3163 |
subblossoms[--num] = _blossom_set->find(v); |
3164 |
v = _graph.target(_fractional->matching(v)); |
|
3164 |
v = _graph.target(_fractional->matching(v)); |
|
3165 | 3165 |
} |
3166 |
|
|
3167 |
int surface = |
|
3166 |
|
|
3167 |
int surface = |
|
3168 | 3168 |
_blossom_set->join(subblossoms.begin(), subblossoms.end()); |
... | ... |
@@ -3173,3 +3173,3 @@ |
3173 | 3173 |
(*_blossom_data)[surface].offset = 0; |
3174 |
|
|
3174 |
|
|
3175 | 3175 |
_tree_set->insert(surface); |
... | ... |
@@ -3223,3 +3223,3 @@ |
3223 | 3223 |
} |
3224 |
|
|
3224 |
|
|
3225 | 3225 |
if (!(*_node_data)[ni].heap.empty()) { |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -130,4 +130,4 @@ |
130 | 130 |
|
131 |
/// \brief The \ref MinCostArborescenceDefaultTraits "traits class" |
|
132 |
/// of the algorithm. |
|
131 |
/// \brief The \ref MinCostArborescenceDefaultTraits "traits class" |
|
132 |
/// of the algorithm. |
|
133 | 133 |
typedef TR Traits; |
... | ... |
@@ -438,3 +438,3 @@ |
438 | 438 |
/// \c PredMap type. |
439 |
/// It must meet the \ref concepts::WriteMap "WriteMap" concept, |
|
439 |
/// It must meet the \ref concepts::WriteMap "WriteMap" concept, |
|
440 | 440 |
/// and its value type must be the \c Arc type of the digraph. |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -99,3 +99,3 @@ |
99 | 99 |
}; |
100 |
|
|
100 |
|
|
101 | 101 |
/// \brief Constants for selecting the type of the supply constraints. |
... | ... |
@@ -117,3 +117,3 @@ |
117 | 117 |
}; |
118 |
|
|
118 |
|
|
119 | 119 |
/// \brief Constants for selecting the pivot rule. |
... | ... |
@@ -160,3 +160,3 @@ |
160 | 160 |
}; |
161 |
|
|
161 |
|
|
162 | 162 |
private: |
... | ... |
@@ -229,3 +229,3 @@ |
229 | 229 |
Value delta; |
230 |
|
|
230 |
|
|
231 | 231 |
const Value MAX; |
... | ... |
@@ -233,3 +233,3 @@ |
233 | 233 |
public: |
234 |
|
|
234 |
|
|
235 | 235 |
/// \brief Constant for infinite upper bounds (capacities). |
... | ... |
@@ -500,4 +500,4 @@ |
500 | 500 |
if (_curr_length == 0) return false; |
501 |
|
|
502 |
search_end: |
|
501 |
|
|
502 |
search_end: |
|
503 | 503 |
_minor_count = 1; |
... | ... |
@@ -610,3 +610,3 @@ |
610 | 610 |
if (_curr_length == 0) return false; |
611 |
|
|
611 |
|
|
612 | 612 |
search_end: |
... | ... |
@@ -636,3 +636,3 @@ |
636 | 636 |
/// \param arc_mixing Indicate if the arcs have to be stored in a |
637 |
/// mixed order in the internal data structure. |
|
637 |
/// mixed order in the internal data structure. |
|
638 | 638 |
/// In special cases, it could lead to better overall performance, |
... | ... |
@@ -651,3 +651,3 @@ |
651 | 651 |
"The cost type of NetworkSimplex must be signed"); |
652 |
|
|
652 |
|
|
653 | 653 |
// Reset data structures |
... | ... |
@@ -765,3 +765,3 @@ |
765 | 765 |
} |
766 |
|
|
766 |
|
|
767 | 767 |
/// \brief Set the type of the supply constraints. |
... | ... |
@@ -791,3 +791,3 @@ |
791 | 791 |
/// The paramters can be specified using functions \ref lowerMap(), |
792 |
/// \ref upperMap(), \ref costMap(), \ref supplyMap(), \ref stSupply(), |
|
792 |
/// \ref upperMap(), \ref costMap(), \ref supplyMap(), \ref stSupply(), |
|
793 | 793 |
/// \ref supplyType(). |
... | ... |
@@ -946,3 +946,3 @@ |
946 | 946 |
} |
947 |
|
|
947 |
|
|
948 | 948 |
// Reset parameters |
... | ... |
@@ -951,3 +951,3 @@ |
951 | 951 |
} |
952 |
|
|
952 |
|
|
953 | 953 |
/// @} |
... | ... |
@@ -1091,3 +1091,3 @@ |
1091 | 1091 |
} |
1092 |
|
|
1092 |
|
|
1093 | 1093 |
// Set data for the artificial root node |
... | ... |
@@ -1265,3 +1265,3 @@ |
1265 | 1265 |
e = _pred[u]; |
1266 |
d = _forward[u] ? |
|
1266 |
d = _forward[u] ? |
|
1267 | 1267 |
(_cap[e] >= MAX ? INF : _cap[e] - _flow[e]) : _flow[e]; |
... | ... |
@@ -1569,3 +1569,3 @@ |
1569 | 1569 |
} |
1570 |
|
|
1570 |
|
|
1571 | 1571 |
// Check feasibility |
... | ... |
@@ -1586,3 +1586,3 @@ |
1586 | 1586 |
} |
1587 |
|
|
1587 |
|
|
1588 | 1588 |
// Shift potentials to meet the requirements of the GEQ/LEQ type |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -968,3 +968,3 @@ |
968 | 968 |
|
969 |
|
|
969 |
|
|
970 | 970 |
template <typename From, typename To, |
... | ... |
@@ -974,3 +974,3 @@ |
974 | 974 |
PathCopySelectorForward<From, To>::copy(from, to); |
975 |
} |
|
975 |
} |
|
976 | 976 |
}; |
... | ... |
@@ -981,3 +981,3 @@ |
981 | 981 |
PathCopySelectorBackward<From, To>::copy(from, to); |
982 |
} |
|
982 |
} |
|
983 | 983 |
}; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -142,3 +142,3 @@ |
142 | 142 |
private: |
143 |
|
|
143 |
|
|
144 | 144 |
TEMPLATE_GRAPH_TYPEDEFS(Graph); |
... | ... |
@@ -148,7 +148,7 @@ |
148 | 148 |
private: |
149 |
|
|
149 |
|
|
150 | 150 |
typedef typename Graph::template NodeMap<Arc> PredMap; |
151 |
|
|
151 |
|
|
152 | 152 |
typedef typename Graph::template EdgeMap<bool> TreeMap; |
153 |
|
|
153 |
|
|
154 | 154 |
typedef typename Graph::template NodeMap<int> OrderMap; |
... | ... |
@@ -223,3 +223,3 @@ |
223 | 223 |
for (typename MergeRoots::Value::iterator it = |
224 |
merge_roots[node].begin(); |
|
224 |
merge_roots[node].begin(); |
|
225 | 225 |
it != merge_roots[node].end(); ++it) { |
... | ... |
@@ -434,3 +434,3 @@ |
434 | 434 |
bool rd; |
435 |
if (!external(xnode, rorder, child_lists, |
|
435 |
if (!external(xnode, rorder, child_lists, |
|
436 | 436 |
ancestor_map, low_map)) { |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -188,3 +188,3 @@ |
188 | 188 |
///It is also quite memory efficient but at the price |
189 |
///that it does not support node and arc deletion |
|
189 |
///that it does not support node and arc deletion |
|
190 | 190 |
///(except for the Snapshot feature). |
... | ... |
@@ -337,3 +337,3 @@ |
337 | 337 |
/// |
338 |
///\note After a state is restored, you cannot restore a later state, |
|
338 |
///\note After a state is restored, you cannot restore a later state, |
|
339 | 339 |
///i.e. you cannot add the removed nodes and arcs again using |
... | ... |
@@ -616,3 +616,3 @@ |
616 | 616 |
/// It is also quite memory efficient but at the price |
617 |
/// that it does not support node and edge deletion |
|
617 |
/// that it does not support node and edge deletion |
|
618 | 618 |
/// (except for the Snapshot feature). |
... | ... |
@@ -763,3 +763,3 @@ |
763 | 763 |
/// |
764 |
///\note After a state is restored, you cannot restore a later state, |
|
764 |
///\note After a state is restored, you cannot restore a later state, |
|
765 | 765 |
///i.e. you cannot add the removed nodes and edges again using |
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- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -33,8 +33,8 @@ |
33 | 33 |
|
34 |
StaticDigraphBase() |
|
35 |
: built(false), node_num(0), arc_num(0), |
|
34 |
StaticDigraphBase() |
|
35 |
: built(false), node_num(0), arc_num(0), |
|
36 | 36 |
node_first_out(NULL), node_first_in(NULL), |
37 |
arc_source(NULL), arc_target(NULL), |
|
37 |
arc_source(NULL), arc_target(NULL), |
|
38 | 38 |
arc_next_in(NULL), arc_next_out(NULL) {} |
39 |
|
|
39 |
|
|
40 | 40 |
~StaticDigraphBase() { |
... | ... |
@@ -64,3 +64,3 @@ |
64 | 64 |
class Arc { |
65 |
friend class StaticDigraphBase; |
|
65 |
friend class StaticDigraphBase; |
|
66 | 66 |
protected: |
... | ... |
@@ -85,4 +85,4 @@ |
85 | 85 |
|
86 |
void firstOut(Arc& e, const Node& n) const { |
|
87 |
e.id = node_first_out[n.id] != node_first_out[n.id + 1] ? |
|
86 |
void firstOut(Arc& e, const Node& n) const { |
|
87 |
e.id = node_first_out[n.id] != node_first_out[n.id + 1] ? |
|
88 | 88 |
node_first_out[n.id] : -1; |
... | ... |
@@ -115,7 +115,7 @@ |
115 | 115 |
|
116 |
ArcLess(const Digraph &_graph, const NodeRefMap& _nodeRef) |
|
116 |
ArcLess(const Digraph &_graph, const NodeRefMap& _nodeRef) |
|
117 | 117 |
: digraph(_graph), nodeRef(_nodeRef) {} |
118 |
|
|
118 |
|
|
119 | 119 |
bool operator()(const Arc& left, const Arc& right) const { |
120 |
|
|
120 |
return nodeRef[digraph.target(left)] < nodeRef[digraph.target(right)]; |
|
121 | 121 |
} |
... | ... |
@@ -125,3 +125,3 @@ |
125 | 125 |
}; |
126 |
|
|
126 |
|
|
127 | 127 |
public: |
... | ... |
@@ -129,3 +129,3 @@ |
129 | 129 |
typedef True BuildTag; |
130 |
|
|
130 |
|
|
131 | 131 |
void clear() { |
... | ... |
@@ -143,3 +143,3 @@ |
143 | 143 |
} |
144 |
|
|
144 |
|
|
145 | 145 |
template <typename Digraph, typename NodeRefMap, typename ArcRefMap> |
... | ... |
@@ -185,3 +185,3 @@ |
185 | 185 |
arcRef[*it] = Arc(arc_index); |
186 |
arc_source[arc_index] = source; |
|
186 |
arc_source[arc_index] = source; |
|
187 | 187 |
arc_target[arc_index] = target; |
... | ... |
@@ -199,3 +199,3 @@ |
199 | 199 |
} |
200 |
|
|
200 |
|
|
201 | 201 |
template <typename ArcListIterator> |
... | ... |
@@ -214,7 +214,7 @@ |
214 | 214 |
arc_next_in = new int[arc_num]; |
215 |
|
|
215 |
|
|
216 | 216 |
for (int i = 0; i != node_num; ++i) { |
217 | 217 |
node_first_in[i] = -1; |
218 |
} |
|
219 |
|
|
218 |
} |
|
219 |
|
|
220 | 220 |
int arc_index = 0; |
... | ... |
@@ -284,3 +284,3 @@ |
284 | 284 |
/// can be indexed with integers from the ranges <tt>[0..nodeNum()-1]</tt> |
285 |
/// and <tt>[0..arcNum()-1]</tt>, respectively. |
|
285 |
/// and <tt>[0..arcNum()-1]</tt>, respectively. |
|
286 | 286 |
/// The index of an item is the same as its ID, it can be obtained |
... | ... |
@@ -301,5 +301,5 @@ |
301 | 301 |
typedef ExtendedStaticDigraphBase Parent; |
302 |
|
|
302 |
|
|
303 | 303 |
public: |
304 |
|
|
304 |
|
|
305 | 305 |
/// \brief Constructor |
... | ... |
@@ -351,3 +351,3 @@ |
351 | 351 |
/// structure using \ref DigraphCopy. |
352 |
/// |
|
352 |
/// |
|
353 | 353 |
/// \param digraph An existing digraph to be copied. |
... | ... |
@@ -372,3 +372,3 @@ |
372 | 372 |
} |
373 |
|
|
373 |
|
|
374 | 374 |
/// \brief Build the digraph from an arc list. |
... | ... |
@@ -423,3 +423,3 @@ |
423 | 423 |
using Parent::fastLastOut; |
424 |
|
|
424 |
|
|
425 | 425 |
public: |
... | ... |
@@ -434,4 +434,4 @@ |
434 | 434 |
OutArcIt(const StaticDigraph& digraph, const Node& node) { |
435 |
digraph.fastFirstOut(*this, node); |
|
436 |
digraph.fastLastOut(last, node); |
|
435 |
digraph.fastFirstOut(*this, node); |
|
436 |
digraph.fastLastOut(last, node); |
|
437 | 437 |
if (last == *this) *this = INVALID; |
... | ... |
@@ -445,6 +445,6 @@ |
445 | 445 |
|
446 |
OutArcIt& operator++() { |
|
446 |
OutArcIt& operator++() { |
|
447 | 447 |
StaticDigraph::fastNextOut(*this); |
448 | 448 |
if (last == *this) *this = INVALID; |
449 |
return *this; |
|
449 |
return *this; |
|
450 | 450 |
} |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -67,3 +67,3 @@ |
67 | 67 |
typedef lemon::Path<Digraph> Path; |
68 |
|
|
68 |
|
|
69 | 69 |
/// The cross reference type used for the heap. |
... | ... |
@@ -160,3 +160,3 @@ |
160 | 160 |
Node _t; |
161 |
|
|
161 |
|
|
162 | 162 |
PotentialMap _dist; |
... | ... |
@@ -169,5 +169,5 @@ |
169 | 169 |
_graph(srb._graph), _length(srb._length), |
170 |
_flow(*srb._flow), _pi(*srb._potential), _pred(srb._pred), |
|
170 |
_flow(*srb._flow), _pi(*srb._potential), _pred(srb._pred), |
|
171 | 171 |
_s(srb._s), _t(srb._t), _dist(_graph) {} |
172 |
|
|
172 |
|
|
173 | 173 |
// Run the algorithm and return true if a path is found |
... | ... |
@@ -179,3 +179,3 @@ |
179 | 179 |
private: |
180 |
|
|
180 |
|
|
181 | 181 |
// Execute the algorithm for the first time (the flow and potential |
... | ... |
@@ -350,3 +350,3 @@ |
350 | 350 |
}; |
351 |
|
|
351 |
|
|
352 | 352 |
template <typename H, typename CR> |
... | ... |
@@ -361,3 +361,3 @@ |
361 | 361 |
/// \ref named-templ-param "Named parameter" for setting \c Heap |
362 |
/// and \c HeapCrossRef types with automatic allocation. |
|
362 |
/// and \c HeapCrossRef types with automatic allocation. |
|
363 | 363 |
/// They will be used for internal Dijkstra computations. |
... | ... |
@@ -399,3 +399,3 @@ |
399 | 399 |
PredMap _pred; |
400 |
|
|
400 |
|
|
401 | 401 |
// Data for full init |
... | ... |
@@ -557,3 +557,3 @@ |
557 | 557 |
dijk.run(s); |
558 |
|
|
558 |
|
|
559 | 559 |
_full_init = true; |
... | ... |
@@ -601,3 +601,3 @@ |
601 | 601 |
ResidualDijkstra dijkstra(*this); |
602 |
|
|
602 |
|
|
603 | 603 |
// Initialization |
... | ... |
@@ -615,3 +615,3 @@ |
615 | 615 |
u = _graph.source(e); |
616 |
} |
|
616 |
} |
|
617 | 617 |
_path_num = 1; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -99,3 +99,3 @@ |
99 | 99 |
pp = const_bf_test.negativeCycle(); |
100 |
|
|
100 |
|
|
101 | 101 |
for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {} |
... | ... |
@@ -112,3 +112,3 @@ |
112 | 112 |
concepts::ReadWriteMap<Node,Value> dist_map; |
113 |
|
|
113 |
|
|
114 | 114 |
bf_test |
... | ... |
@@ -191,3 +191,3 @@ |
191 | 191 |
check(pathTarget(gr, p) == t, "path() found a wrong path."); |
192 |
|
|
192 |
|
|
193 | 193 |
ListPath<Digraph> path; |
... | ... |
@@ -230,3 +230,3 @@ |
230 | 230 |
IntArcMap length(gr); |
231 |
|
|
231 |
|
|
232 | 232 |
Node n1 = gr.addNode(); |
... | ... |
@@ -235,9 +235,9 @@ |
235 | 235 |
Node n4 = gr.addNode(); |
236 |
|
|
236 |
|
|
237 | 237 |
Arc a1 = gr.addArc(n1, n2); |
238 | 238 |
Arc a2 = gr.addArc(n2, n2); |
239 |
|
|
239 |
|
|
240 | 240 |
length[a1] = 2; |
241 | 241 |
length[a2] = -1; |
242 |
|
|
242 |
|
|
243 | 243 |
{ |
... | ... |
@@ -249,5 +249,5 @@ |
249 | 249 |
} |
250 |
|
|
250 |
|
|
251 | 251 |
length[a2] = 0; |
252 |
|
|
252 |
|
|
253 | 253 |
{ |
... | ... |
@@ -258,3 +258,3 @@ |
258 | 258 |
} |
259 |
|
|
259 |
|
|
260 | 260 |
length[gr.addArc(n1, n3)] = 5; |
... | ... |
@@ -263,3 +263,3 @@ |
263 | 263 |
length[gr.addArc(n3, n2)] = -4; |
264 |
|
|
264 |
|
|
265 | 265 |
{ |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -85,3 +85,3 @@ |
85 | 85 |
i = const_bfs_test.queueSize(); |
86 |
|
|
86 |
|
|
87 | 87 |
bfs_test.start(); |
... | ... |
@@ -106,3 +106,3 @@ |
106 | 106 |
::Create bfs_test(G); |
107 |
|
|
107 |
|
|
108 | 108 |
concepts::ReadWriteMap<Node,Arc> pred_map; |
... | ... |
@@ -111,3 +111,3 @@ |
111 | 111 |
concepts::WriteMap<Node,bool> processed_map; |
112 |
|
|
112 |
|
|
113 | 113 |
bfs_test |
... | ... |
@@ -121,3 +121,3 @@ |
121 | 121 |
bfs_test.run(); |
122 |
|
|
122 |
|
|
123 | 123 |
bfs_test.init(); |
... | ... |
@@ -130,3 +130,3 @@ |
130 | 130 |
i = bfs_test.queueSize(); |
131 |
|
|
131 |
|
|
132 | 132 |
bfs_test.start(); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -83,3 +83,3 @@ |
83 | 83 |
const CirculationType& const_circ_test = circ_test; |
84 |
|
|
84 |
|
|
85 | 85 |
circ_test |
... | ... |
@@ -89,3 +89,3 @@ |
89 | 89 |
.flowMap(flow); |
90 |
|
|
90 |
|
|
91 | 91 |
const CirculationType::Elevator& elev = const_circ_test.elevator(); |
... | ... |
@@ -104,3 +104,3 @@ |
104 | 104 |
const_circ_test.barrierMap(bar); |
105 |
|
|
105 |
|
|
106 | 106 |
ignore_unused_variable_warning(fm); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -31,3 +31,3 @@ |
31 | 31 |
typedef Undirector<Digraph> Graph; |
32 |
|
|
32 |
|
|
33 | 33 |
{ |
... | ... |
@@ -36,3 +36,3 @@ |
36 | 36 |
Graph g(d); |
37 |
|
|
37 |
|
|
38 | 38 |
check(stronglyConnected(d), "The empty digraph is strongly connected"); |
... | ... |
@@ -50,3 +50,3 @@ |
50 | 50 |
"The empty graph has 0 bi-edge-connected component"); |
51 |
|
|
51 |
|
|
52 | 52 |
check(dag(d), "The empty digraph is DAG."); |
... | ... |
@@ -84,3 +84,3 @@ |
84 | 84 |
"This graph has 1 bi-edge-connected component"); |
85 |
|
|
85 |
|
|
86 | 86 |
check(dag(d), "This digraph is DAG."); |
... | ... |
@@ -103,3 +103,3 @@ |
103 | 103 |
Graph g(d); |
104 |
|
|
104 |
|
|
105 | 105 |
Digraph::Node n1 = d.addNode(); |
... | ... |
@@ -110,3 +110,3 @@ |
110 | 110 |
Digraph::Node n6 = d.addNode(); |
111 |
|
|
111 |
|
|
112 | 112 |
d.addArc(n1, n3); |
... | ... |
@@ -138,5 +138,5 @@ |
138 | 138 |
check(!simpleGraph(g), "This graph is not simple."); |
139 |
|
|
139 |
|
|
140 | 140 |
d.addArc(n3, n3); |
141 |
|
|
141 |
|
|
142 | 142 |
check(!loopFree(d), "This digraph is not loop-free."); |
... | ... |
@@ -144,8 +144,8 @@ |
144 | 144 |
check(!simpleGraph(d), "This digraph is not simple."); |
145 |
|
|
145 |
|
|
146 | 146 |
d.addArc(n3, n2); |
147 |
|
|
147 |
|
|
148 | 148 |
check(!parallelFree(d), "This digraph is not parallel-free."); |
149 | 149 |
} |
150 |
|
|
150 |
|
|
151 | 151 |
{ |
... | ... |
@@ -154,3 +154,3 @@ |
154 | 154 |
Graph g(d); |
155 |
|
|
155 |
|
|
156 | 156 |
Digraph::Node n1 = d.addNode(); |
... | ... |
@@ -174,3 +174,3 @@ |
174 | 174 |
d.addArc(n7, n6); |
175 |
|
|
175 |
|
|
176 | 176 |
check(!stronglyConnected(d), "This digraph is not strongly connected"); |
... | ... |
@@ -237,3 +237,3 @@ |
237 | 237 |
Digraph::NodeMap<int> order(d); |
238 |
|
|
238 |
|
|
239 | 239 |
Digraph::Node belt = d.addNode(); |
... | ... |
@@ -257,3 +257,3 @@ |
257 | 257 |
d.addArc(necktie, coat); |
258 |
|
|
258 |
|
|
259 | 259 |
check(dag(d), "This digraph is DAG."); |
... | ... |
@@ -269,3 +269,3 @@ |
269 | 269 |
ListGraph::NodeMap<bool> map(g); |
270 |
|
|
270 |
|
|
271 | 271 |
ListGraph::Node n1 = g.addNode(); |
... | ... |
@@ -285,6 +285,6 @@ |
285 | 285 |
g.addEdge(n5, n7); |
286 |
|
|
286 |
|
|
287 | 287 |
check(bipartite(g), "This graph is bipartite"); |
288 | 288 |
check(bipartitePartitions(g, map), "This graph is bipartite"); |
289 |
|
|
289 |
|
|
290 | 290 |
check(map[n1] == map[n2] && map[n1] == map[n6] && map[n1] == map[n7], |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -85,3 +85,3 @@ |
85 | 85 |
i = const_dfs_test.queueSize(); |
86 |
|
|
86 |
|
|
87 | 87 |
dfs_test.start(); |
... | ... |
@@ -111,3 +111,3 @@ |
111 | 111 |
concepts::WriteMap<Node,bool> processed_map; |
112 |
|
|
112 |
|
|
113 | 113 |
dfs_test |
... | ... |
@@ -128,3 +128,3 @@ |
128 | 128 |
i = dfs_test.queueSize(); |
129 |
|
|
129 |
|
|
130 | 130 |
dfs_test.start(); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -394,5 +394,5 @@ |
394 | 394 |
SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g); |
395 |
|
|
395 |
|
|
396 | 396 |
StaticDigraph G; |
397 |
|
|
397 |
|
|
398 | 398 |
checkGraphNodeList(G, 0); |
... | ... |
@@ -466,3 +466,3 @@ |
466 | 466 |
G.build(6, arcs.begin(), arcs.end()); |
467 |
|
|
467 |
|
|
468 | 468 |
checkGraphNodeList(G, 6); |
... | ... |
@@ -490,3 +490,3 @@ |
490 | 490 |
checkGraphArcMap(G); |
491 |
|
|
491 |
|
|
492 | 492 |
int n = G.nodeNum(); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -87,3 +87,3 @@ |
87 | 87 |
i = const_dijkstra_test.queueSize(); |
88 |
|
|
88 |
|
|
89 | 89 |
dijkstra_test.start(); |
... | ... |
@@ -111,3 +111,3 @@ |
111 | 111 |
::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > > |
112 |
::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >, |
|
112 |
::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >, |
|
113 | 113 |
concepts::ReadWriteMap<Node,int> > |
... | ... |
@@ -121,3 +121,3 @@ |
121 | 121 |
BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref); |
122 |
|
|
122 |
|
|
123 | 123 |
dijkstra_test |
... | ... |
@@ -138,3 +138,3 @@ |
138 | 138 |
i = dijkstra_test.queueSize(); |
139 |
|
|
139 |
|
|
140 | 140 |
dijkstra_test.start(); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -87,3 +87,3 @@ |
87 | 87 |
typedef Undirector<Digraph> Graph; |
88 |
|
|
88 |
|
|
89 | 89 |
{ |
... | ... |
@@ -91,3 +91,3 @@ |
91 | 91 |
Graph g(d); |
92 |
|
|
92 |
|
|
93 | 93 |
checkDiEulerIt(d); |
... | ... |
@@ -130,3 +130,3 @@ |
130 | 130 |
Digraph::Node n3 = d.addNode(); |
131 |
|
|
131 |
|
|
132 | 132 |
d.addArc(n1, n2); |
... | ... |
@@ -155,3 +155,3 @@ |
155 | 155 |
Digraph::Node n6 = d.addNode(); |
156 |
|
|
156 |
|
|
157 | 157 |
d.addArc(n1, n2); |
... | ... |
@@ -191,3 +191,3 @@ |
191 | 191 |
Digraph::Node n5 = d.addNode(); |
192 |
|
|
192 |
|
|
193 | 193 |
d.addArc(n1, n2); |
... | ... |
@@ -213,3 +213,3 @@ |
213 | 213 |
Digraph::Node n3 = d.addNode(); |
214 |
|
|
214 |
|
|
215 | 215 |
d.addArc(n1, n2); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -240,3 +240,3 @@ |
240 | 240 |
check((e == mfm.matching(graph.u(e)) ? 1 : 0) + |
241 |
(e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
241 |
(e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
242 | 242 |
mfm.matching(e), "Invalid matching"); |
... | ... |
@@ -294,3 +294,3 @@ |
294 | 294 |
check((e == mfm.matching(graph.u(e)) ? 1 : 0) + |
295 |
(e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
295 |
(e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
296 | 296 |
mfm.matching(e), "Invalid matching"); |
... | ... |
@@ -352,3 +352,3 @@ |
352 | 352 |
check((e == mwfm.matching(graph.u(e)) ? 1 : 0) + |
353 |
(e == mwfm.matching(graph.v(e)) ? 1 : 0) == |
|
353 |
(e == mwfm.matching(graph.v(e)) ? 1 : 0) == |
|
354 | 354 |
mwfm.matching(e), "Invalid matching"); |
... | ... |
@@ -412,3 +412,3 @@ |
412 | 412 |
check((e == mwpfm.matching(graph.u(e)) ? 1 : 0) + |
413 |
(e == mwpfm.matching(graph.v(e)) ? 1 : 0) == |
|
413 |
(e == mwpfm.matching(graph.v(e)) ? 1 : 0) == |
|
414 | 414 |
mwpfm.matching(e), "Invalid matching"); |
1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
|
2 |
* |
|
3 |
* This file is a part of LEMON, a generic C++ optimization library. |
|
4 |
* |
|
5 |
* Copyright (C) 2003-2010 |
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
|
8 |
* |
|
9 |
* Permission to use, modify and distribute this software is granted |
|
10 |
* provided that this copyright notice appears in all copies. For |
|
11 |
* precise terms see the accompanying LICENSE file. |
|
12 |
* |
|
13 |
* This software is provided "AS IS" with no warranty of any kind, |
|
14 |
* express or implied, and with no claim as to its suitability for any |
|
15 |
* purpose. |
|
16 |
* |
|
17 |
*/ |
|
18 |
|
|
1 | 19 |
#include <iostream> |
... | ... |
@@ -35,3 +53,3 @@ |
35 | 53 |
"target 3\n"; |
36 |
|
|
54 |
|
|
37 | 55 |
void checkGomoryHuCompile() |
... | ... |
@@ -71,3 +89,3 @@ |
71 | 89 |
int cutValue(const Graph& graph, const BoolNodeMap& cut, |
72 |
|
|
90 |
const IntEdgeMap& capacity) { |
|
73 | 91 |
|
... | ... |
@@ -109,3 +127,3 @@ |
109 | 127 |
for(GomoryHu<Graph>::MinCutEdgeIt a(ght, u, v);a!=INVALID;++a) |
110 |
sum+=capacity[a]; |
|
128 |
sum+=capacity[a]; |
|
111 | 129 |
check(sum == ght.minCutValue(u, v), "Problem with MinCutEdgeIt"); |
... | ... |
@@ -120,3 +138,3 @@ |
120 | 138 |
} |
121 |
|
|
139 |
|
|
122 | 140 |
return 0; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -266,3 +266,3 @@ |
266 | 266 |
checkGraphArcList(G, 6); |
267 |
|
|
267 |
|
|
268 | 268 |
G.addEdge(G.addNode(), G.addNode()); |
... | ... |
@@ -515,3 +515,3 @@ |
515 | 515 |
check(G.dimension() == dim, "Wrong dimension"); |
516 |
|
|
516 |
|
|
517 | 517 |
checkGraphNodeList(G, 1 << dim); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -85,3 +85,3 @@ |
85 | 85 |
template <typename Graph, typename CapMap, typename CutMap> |
86 |
typename CapMap::Value |
|
86 |
typename CapMap::Value |
|
87 | 87 |
cutValue(const Graph& graph, const CapMap& cap, const CutMap& cut) |
... | ... |
@@ -112,3 +112,3 @@ |
112 | 112 |
ho.minCutMap(cut); |
113 |
|
|
113 |
|
|
114 | 114 |
check(ho.minCutValue() == 1, "Wrong cut value"); |
... | ... |
@@ -128,3 +128,3 @@ |
128 | 128 |
ho.minCutMap(cut); |
129 |
|
|
129 |
|
|
130 | 130 |
check(ho.minCutValue() == 1, "Wrong cut value"); |
... | ... |
@@ -132,6 +132,6 @@ |
132 | 132 |
} |
133 |
|
|
133 |
|
|
134 | 134 |
typedef Undirector<SmartDigraph> UGraph; |
135 | 135 |
UGraph ugraph(graph); |
136 |
|
|
136 |
|
|
137 | 137 |
{ |
... | ... |
@@ -140,3 +140,3 @@ |
140 | 140 |
ho.minCutMap(cut); |
141 |
|
|
141 |
|
|
142 | 142 |
check(ho.minCutValue() == 2, "Wrong cut value"); |
... | ... |
@@ -148,3 +148,3 @@ |
148 | 148 |
ho.minCutMap(cut); |
149 |
|
|
149 |
|
|
150 | 150 |
check(ho.minCutValue() == 5, "Wrong cut value"); |
... | ... |
@@ -156,3 +156,3 @@ |
156 | 156 |
ho.minCutMap(cut); |
157 |
|
|
157 |
|
|
158 | 158 |
check(ho.minCutValue() == 5, "Wrong cut value"); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -227,3 +227,4 @@ |
227 | 227 |
checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
228 |
MapToFunctor<ReadMap<A,B> > map = |
|
228 |
MapToFunctor<ReadMap<A,B> > map = |
|
229 |
MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
|
229 | 230 |
|
... | ... |
@@ -379,3 +380,3 @@ |
379 | 380 |
check(v1[i++] == *it, "Something is wrong with LoggerBoolMap"); |
380 |
|
|
381 |
|
|
381 | 382 |
typedef ListDigraph Graph; |
... | ... |
@@ -388,3 +389,3 @@ |
388 | 389 |
Node n3 = gr.addNode(); |
389 |
|
|
390 |
|
|
390 | 391 |
gr.addArc(n3, n0); |
... | ... |
@@ -394,3 +395,3 @@ |
394 | 395 |
gr.addArc(n0, n1); |
395 |
|
|
396 |
|
|
396 | 397 |
{ |
... | ... |
@@ -405,3 +406,3 @@ |
405 | 406 |
dfs(gr).processedMap(loggerBoolMap(v.begin())).run(); |
406 |
|
|
407 |
|
|
407 | 408 |
check(v.size()==4 && v[0]==n1 && v[1]==n2 && v[2]==n0 && v[3]==n3, |
... | ... |
@@ -410,3 +411,3 @@ |
410 | 411 |
} |
411 |
|
|
412 |
|
|
412 | 413 |
// IdMap, RangeIdMap |
... | ... |
@@ -420,3 +421,3 @@ |
420 | 421 |
checkConcept<ReadMap<Arc, int>, RangeIdMap<Graph, Arc> >(); |
421 |
|
|
422 |
|
|
422 | 423 |
Graph gr; |
... | ... |
@@ -426,3 +427,3 @@ |
426 | 427 |
RangeIdMap<Graph, Arc> armap(gr); |
427 |
|
|
428 |
|
|
428 | 429 |
Node n0 = gr.addNode(); |
... | ... |
@@ -430,3 +431,3 @@ |
430 | 431 |
Node n2 = gr.addNode(); |
431 |
|
|
432 |
|
|
432 | 433 |
Arc a0 = gr.addArc(n0, n1); |
... | ... |
@@ -435,3 +436,3 @@ |
435 | 436 |
Arc a3 = gr.addArc(n2, n0); |
436 |
|
|
437 |
|
|
437 | 438 |
check(nmap[n0] == gr.id(n0) && nmap(gr.id(n0)) == n0, "Wrong IdMap"); |
... | ... |
@@ -447,3 +448,3 @@ |
447 | 448 |
check(amap.inverse()[gr.id(a0)] == a0, "Wrong IdMap::InverseMap"); |
448 |
|
|
449 |
|
|
449 | 450 |
check(nrmap.size() == 3 && armap.size() == 4, |
... | ... |
@@ -454,3 +455,3 @@ |
454 | 455 |
check(nrmap[n2] == 2 && nrmap(2) == n2, "Wrong RangeIdMap"); |
455 |
|
|
456 |
|
|
456 | 457 |
check(armap[a0] == 0 && armap(0) == a0, "Wrong RangeIdMap"); |
... | ... |
@@ -462,5 +463,5 @@ |
462 | 463 |
check(armap.inverse()[0] == a0, "Wrong RangeIdMap::InverseMap"); |
463 |
|
|
464 |
|
|
464 | 465 |
gr.erase(n1); |
465 |
|
|
466 |
|
|
466 | 467 |
if (nrmap[n0] == 1) nrmap.swap(n0, n2); |
... | ... |
@@ -469,3 +470,3 @@ |
469 | 470 |
armap.swap(a3, a1); |
470 |
|
|
471 |
|
|
471 | 472 |
check(nrmap.size() == 2 && armap.size() == 2, |
... | ... |
@@ -475,3 +476,3 @@ |
475 | 476 |
check(nrmap[n2] == 0 && nrmap(0) == n2, "Wrong RangeIdMap"); |
476 |
|
|
477 |
|
|
477 | 478 |
check(armap[a1] == 1 && armap(1) == a1, "Wrong RangeIdMap"); |
... | ... |
@@ -482,3 +483,3 @@ |
482 | 483 |
} |
483 |
|
|
484 |
|
|
484 | 485 |
// SourceMap, TargetMap, ForwardMap, BackwardMap, InDegMap, OutDegMap |
... | ... |
@@ -487,3 +488,3 @@ |
487 | 488 |
GRAPH_TYPEDEFS(Graph); |
488 |
|
|
489 |
|
|
489 | 490 |
checkConcept<ReadMap<Arc, Node>, SourceMap<Graph> >(); |
... | ... |
@@ -499,3 +500,3 @@ |
499 | 500 |
Node n2 = gr.addNode(); |
500 |
|
|
501 |
|
|
501 | 502 |
gr.addEdge(n0,n1); |
... | ... |
@@ -506,3 +507,3 @@ |
506 | 507 |
gr.addEdge(n0,n1); |
507 |
|
|
508 |
|
|
508 | 509 |
for (EdgeIt e(gr); e != INVALID; ++e) { |
... | ... |
@@ -511,3 +512,3 @@ |
511 | 512 |
} |
512 |
|
|
513 |
|
|
513 | 514 |
check(mapCompare(gr, |
... | ... |
@@ -521,6 +522,6 @@ |
521 | 522 |
InDegMap<Digraph> idm(dgr); |
522 |
|
|
523 |
|
|
523 | 524 |
check(odm[n0] == 3 && odm[n1] == 2 && odm[n2] == 1, "Wrong OutDegMap"); |
524 | 525 |
check(idm[n0] == 0 && idm[n1] == 3 && idm[n2] == 3, "Wrong InDegMap"); |
525 |
|
|
526 |
|
|
526 | 527 |
gr.addEdge(n2, n0); |
... | ... |
@@ -530,3 +531,3 @@ |
530 | 531 |
} |
531 |
|
|
532 |
|
|
532 | 533 |
// CrossRefMap |
... | ... |
@@ -542,3 +543,3 @@ |
542 | 543 |
CrossRefMap<Graph, Node, double> >(); |
543 |
|
|
544 |
|
|
544 | 545 |
Graph gr; |
... | ... |
@@ -546,3 +547,3 @@ |
546 | 547 |
CRMap map(gr); |
547 |
|
|
548 |
|
|
548 | 549 |
Node n0 = gr.addNode(); |
... | ... |
@@ -550,3 +551,3 @@ |
550 | 551 |
Node n2 = gr.addNode(); |
551 |
|
|
552 |
|
|
552 | 553 |
map.set(n0, 'A'); |
... | ... |
@@ -554,3 +555,3 @@ |
554 | 555 |
map.set(n2, 'C'); |
555 |
|
|
556 |
|
|
556 | 557 |
check(map[n0] == 'A' && map('A') == n0 && map.inverse()['A'] == n0, |
... | ... |
@@ -563,3 +564,3 @@ |
563 | 564 |
"Wrong CrossRefMap::count()"); |
564 |
|
|
565 |
|
|
565 | 566 |
CRMap::ValueIt it = map.beginValue(); |
... | ... |
@@ -567,3 +568,3 @@ |
567 | 568 |
it == map.endValue(), "Wrong value iterator"); |
568 |
|
|
569 |
|
|
569 | 570 |
map.set(n2, 'A'); |
... | ... |
@@ -605,3 +606,3 @@ |
605 | 606 |
CrossRefMap<Graph, Node, int> >(); |
606 |
|
|
607 |
|
|
607 | 608 |
Graph gr; |
... | ... |
@@ -610,3 +611,3 @@ |
610 | 611 |
CRMap map(gr); |
611 |
|
|
612 |
|
|
612 | 613 |
Node n0 = gr.addNode(); |
... | ... |
@@ -614,3 +615,3 @@ |
614 | 615 |
Node n2 = gr.addNode(); |
615 |
|
|
616 |
|
|
616 | 617 |
map.set(n0, 'A'); |
... | ... |
@@ -631,3 +632,3 @@ |
631 | 632 |
} |
632 |
|
|
633 |
|
|
633 | 634 |
// Iterable bool map |
... | ... |
@@ -819,3 +820,3 @@ |
819 | 820 |
} |
820 |
|
|
821 |
|
|
821 | 822 |
// Graph map utilities: |
... | ... |
@@ -831,3 +832,3 @@ |
831 | 832 |
Node n3 = g.addNode(); |
832 |
|
|
833 |
|
|
833 | 834 |
SmartDigraph::NodeMap<int> map1(g); |
... | ... |
@@ -836,3 +837,3 @@ |
836 | 837 |
ConstMap<Arc, C> cmap2 = C(0); |
837 |
|
|
838 |
|
|
838 | 839 |
map1[n1] = 10; |
... | ... |
@@ -840,3 +841,3 @@ |
840 | 841 |
map1[n3] = 12; |
841 |
|
|
842 |
|
|
842 | 843 |
// mapMin(), mapMax(), mapMinValue(), mapMaxValue() |
... | ... |
@@ -859,3 +860,3 @@ |
859 | 860 |
Arc a4 = g.addArc(n3, n1); |
860 |
|
|
861 |
|
|
861 | 862 |
map2[a1] = 'b'; |
... | ... |
@@ -926,3 +927,3 @@ |
926 | 927 |
"Wrong mapCountIf()"); |
927 |
|
|
928 |
|
|
928 | 929 |
// MapIt, ConstMapIt |
... | ... |
@@ -936,3 +937,3 @@ |
936 | 937 |
"Wrong NodeMap<>::MapIt"); |
937 |
|
|
938 |
|
|
938 | 939 |
int sum = 0; |
... | ... |
@@ -953,6 +954,6 @@ |
953 | 954 |
SmartDigraph::ArcMap<char> map4(g, 'a'); |
954 |
|
|
955 |
|
|
955 | 956 |
check(!mapCompare(g, map1, map3), "Wrong mapCompare()"); |
956 |
check(!mapCompare(g, map2, map4), "Wrong mapCompare()"); |
|
957 |
|
|
957 |
check(!mapCompare(g, map2, map4), "Wrong mapCompare()"); |
|
958 |
|
|
958 | 959 |
mapCopy(g, map1, map3); |
... | ... |
@@ -961,4 +962,4 @@ |
961 | 962 |
check(mapCompare(g, map1, map3), "Wrong mapCompare() or mapCopy()"); |
962 |
check(mapCompare(g, map2, map4), "Wrong mapCompare() or mapCopy()"); |
|
963 |
|
|
963 |
check(mapCompare(g, map2, map4), "Wrong mapCompare() or mapCopy()"); |
|
964 |
|
|
964 | 965 |
Undirector<SmartDigraph> ug(g); |
... | ... |
@@ -966,3 +967,3 @@ |
966 | 967 |
Undirector<SmartDigraph>::ArcMap<double> umap2(ug, 3.14); |
967 |
|
|
968 |
|
|
968 | 969 |
check(!mapCompare(g, map2, umap1), "Wrong mapCompare() or mapCopy()"); |
... | ... |
@@ -971,3 +972,3 @@ |
971 | 972 |
check(!mapCompare(ug, umap1, map2), "Wrong mapCompare() or mapCopy()"); |
972 |
|
|
973 |
|
|
973 | 974 |
mapCopy(g, map2, umap1); |
... | ... |
@@ -978,3 +979,3 @@ |
978 | 979 |
check(mapCompare(ug, umap1, map2), "Wrong mapCompare() or mapCopy()"); |
979 |
|
|
980 |
|
|
980 | 981 |
mapCopy(g, map2, umap1); |
... | ... |
@@ -983,3 +984,3 @@ |
983 | 984 |
mapCopy(ug, umap1, map2); |
984 |
|
|
985 |
|
|
985 | 986 |
check(!mapCompare(ug, umap1, umap2), "Wrong mapCompare() or mapCopy()"); |
... | ... |
@@ -987,3 +988,3 @@ |
987 | 988 |
check(mapCompare(ug, umap1, umap2), "Wrong mapCompare() or mapCopy()"); |
988 |
|
|
989 |
|
|
989 | 990 |
check(!mapCompare(g, map1, constMap<Node>(2)), "Wrong mapCompare()"); |
... | ... |
@@ -996,3 +997,3 @@ |
996 | 997 |
} |
997 |
|
|
998 |
|
|
998 | 999 |
return 0; |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -136,3 +136,3 @@ |
136 | 136 |
mat_test.run(); |
137 |
|
|
137 |
|
|
138 | 138 |
const_mat_test.matchingSize(); |
... | ... |
@@ -145,3 +145,3 @@ |
145 | 145 |
|
146 |
MaxMatching<Graph>::Status stat = |
|
146 |
MaxMatching<Graph>::Status stat = |
|
147 | 147 |
const_mat_test.status(n); |
... | ... |
@@ -172,3 +172,3 @@ |
172 | 172 |
mat_test.run(); |
173 |
|
|
173 |
|
|
174 | 174 |
const_mat_test.matchingWeight(); |
... | ... |
@@ -181,3 +181,3 @@ |
181 | 181 |
const_mat_test.mate(n); |
182 |
|
|
182 |
|
|
183 | 183 |
int k = 0; |
... | ... |
@@ -209,3 +209,3 @@ |
209 | 209 |
mat_test.run(); |
210 |
|
|
210 |
|
|
211 | 211 |
const_mat_test.matchingWeight(); |
... | ... |
@@ -217,3 +217,3 @@ |
217 | 217 |
const_mat_test.mate(n); |
218 |
|
|
218 |
|
|
219 | 219 |
int k = 0; |
... | ... |
@@ -427,3 +427,3 @@ |
427 | 427 |
bool result = mwpm.run(); |
428 |
|
|
428 |
|
|
429 | 429 |
check(result == perfect, "Perfect matching found"); |
... | ... |
@@ -438,3 +438,3 @@ |
438 | 438 |
bool result = mwpm.start(); |
439 |
|
|
439 |
|
|
440 | 440 |
check(result == perfect, "Perfect matching found"); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -112,3 +112,3 @@ |
112 | 112 |
i = const_mcarb_test.queueSize(); |
113 |
|
|
113 |
|
|
114 | 114 |
c = const_mcarb_test.arborescenceCost(); |
... | ... |
@@ -122,3 +122,3 @@ |
122 | 122 |
b = const_mcarb_test.processed(n); |
123 |
|
|
123 |
|
|
124 | 124 |
i = const_mcarb_test.dualNum(); |
... | ... |
@@ -127,3 +127,3 @@ |
127 | 127 |
c = const_mcarb_test.dualValue(i); |
128 |
|
|
128 |
|
|
129 | 129 |
ignore_unused_variable_warning(am); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -54,3 +54,3 @@ |
54 | 54 |
" 12 -20 -27 0 -30 -30 -20\n" |
55 |
"\n" |
|
55 |
"\n" |
|
56 | 56 |
"@arcs\n" |
... | ... |
@@ -104,3 +104,3 @@ |
104 | 104 |
"7 5 -120 0 0\n"; |
105 |
|
|
105 |
|
|
106 | 106 |
char test_neg2_lgf[] = |
... | ... |
@@ -153,3 +153,3 @@ |
153 | 153 |
checkConcept<concepts::Digraph, GR>(); |
154 |
|
|
154 |
|
|
155 | 155 |
const Constraints& me = *this; |
... | ... |
@@ -182,3 +182,3 @@ |
182 | 182 |
typedef concepts::WriteMap<Node, Cost> PotMap; |
183 |
|
|
183 |
|
|
184 | 184 |
GR g; |
... | ... |
@@ -236,3 +236,3 @@ |
236 | 236 |
bool checkPotential( const GR& gr, const LM& lower, const UM& upper, |
237 |
const CM& cost, const SM& supply, const FM& flow, |
|
237 |
const CM& cost, const SM& supply, const FM& flow, |
|
238 | 238 |
const PM& pi, SupplyType type ) |
... | ... |
@@ -249,3 +249,3 @@ |
249 | 249 |
} |
250 |
|
|
250 |
|
|
251 | 251 |
for (NodeIt n(gr); opt && n != INVALID; ++n) { |
... | ... |
@@ -262,3 +262,3 @@ |
262 | 262 |
} |
263 |
|
|
263 |
|
|
264 | 264 |
return opt; |
... | ... |
@@ -287,3 +287,3 @@ |
287 | 287 |
} |
288 |
|
|
288 |
|
|
289 | 289 |
for (NodeIt n(gr); n != INVALID; ++n) { |
... | ... |
@@ -296,3 +296,3 @@ |
296 | 296 |
} |
297 |
|
|
297 |
|
|
298 | 298 |
return dual_cost == total; |
... | ... |
@@ -334,3 +334,3 @@ |
334 | 334 |
MCF mcf1(gr), mcf2(neg1_gr), mcf3(neg2_gr); |
335 |
|
|
335 |
|
|
336 | 336 |
// Basic tests |
... | ... |
@@ -437,3 +437,3 @@ |
437 | 437 |
.run(); |
438 |
|
|
438 |
|
|
439 | 439 |
std::istringstream neg_inp1(test_neg1_lgf); |
... | ... |
@@ -445,3 +445,3 @@ |
445 | 445 |
.run(); |
446 |
|
|
446 |
|
|
447 | 447 |
std::istringstream neg_inp2(test_neg2_lgf); |
... | ... |
@@ -451,3 +451,3 @@ |
451 | 451 |
.run(); |
452 |
|
|
452 |
|
|
453 | 453 |
// Check the interface of NetworkSimplex |
... | ... |
@@ -503,3 +503,3 @@ |
503 | 503 |
// Test NetworkSimplex |
504 |
{ |
|
504 |
{ |
|
505 | 505 |
typedef NetworkSimplex<Digraph> MCF; |
... | ... |
@@ -516,3 +516,3 @@ |
516 | 516 |
} |
517 |
|
|
517 |
|
|
518 | 518 |
// Test CapacityScaling |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -63,3 +63,3 @@ |
63 | 63 |
|
64 |
|
|
64 |
|
|
65 | 65 |
// Check the interface of an MMC algorithm |
... | ... |
@@ -79,6 +79,6 @@ |
79 | 79 |
const MmcAlg& const_mmc = mmc; |
80 |
|
|
80 |
|
|
81 | 81 |
typename MmcAlg::Tolerance tol = const_mmc.tolerance(); |
82 | 82 |
mmc.tolerance(tol); |
83 |
|
|
83 |
|
|
84 | 84 |
b = mmc.cycle(p).run(); |
... | ... |
@@ -94,3 +94,3 @@ |
94 | 94 |
typedef concepts::ReadMap<typename GR::Arc, Cost> CM; |
95 |
|
|
95 |
|
|
96 | 96 |
GR g; |
... | ... |
@@ -155,3 +155,3 @@ |
155 | 155 |
KarpMmc<GR, concepts::ReadMap<GR::Arc, float> > >(); |
156 |
|
|
156 |
|
|
157 | 157 |
// HartmannOrlinMmc |
... | ... |
@@ -161,3 +161,3 @@ |
161 | 161 |
HartmannOrlinMmc<GR, concepts::ReadMap<GR::Arc, float> > >(); |
162 |
|
|
162 |
|
|
163 | 163 |
// HowardMmc |
... | ... |
@@ -178,3 +178,3 @@ |
178 | 178 |
DIGRAPH_TYPEDEFS(GR); |
179 |
|
|
179 |
|
|
180 | 180 |
GR gr; |
... | ... |
@@ -182,3 +182,3 @@ |
182 | 182 |
IntArcMap c1(gr), c2(gr), c3(gr), c4(gr); |
183 |
|
|
183 |
|
|
184 | 184 |
std::istringstream input(test_lgf); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -96,3 +96,3 @@ |
96 | 96 |
const PreflowType& const_preflow_test = preflow_test; |
97 |
|
|
97 |
|
|
98 | 98 |
const PreflowType::Elevator& elev = const_preflow_test.elevator(); |
... | ... |
@@ -120,3 +120,3 @@ |
120 | 120 |
const_preflow_test.minCutMap(cut); |
121 |
|
|
121 |
|
|
122 | 122 |
ignore_unused_variable_warning(fm); |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -83,3 +83,3 @@ |
83 | 83 |
typedef concepts::ReadMap<Arc, VType> LengthMap; |
84 |
|
|
84 |
|
|
85 | 85 |
typedef Suurballe<Digraph, LengthMap> ST; |
... | ... |
@@ -116,3 +116,3 @@ |
116 | 116 |
suurb_test.findPaths(); |
117 |
|
|
117 |
|
|
118 | 118 |
int f; |
... | ... |
@@ -128,3 +128,3 @@ |
128 | 128 |
Path<Digraph> p = const_suurb_test.path(k); |
129 |
|
|
129 |
|
|
130 | 130 |
ignore_unused_variable_warning(fm); |
... | ... |
@@ -210,3 +210,3 @@ |
210 | 210 |
Suurballe<ListDigraph> suurballe(digraph, length); |
211 |
|
|
211 |
|
|
212 | 212 |
// Find 2 paths |
... | ... |
@@ -221,3 +221,3 @@ |
221 | 221 |
check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path"); |
222 |
|
|
222 |
|
|
223 | 223 |
// Find 3 paths |
... | ... |
@@ -232,3 +232,3 @@ |
232 | 232 |
check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path"); |
233 |
|
|
233 |
|
|
234 | 234 |
// Find 5 paths (only 3 can be found) |
... | ... |
@@ -244,3 +244,3 @@ |
244 | 244 |
} |
245 |
|
|
245 |
|
|
246 | 246 |
// Check fullInit() + start() |
... | ... |
@@ -249,3 +249,3 @@ |
249 | 249 |
suurballe.fullInit(s); |
250 |
|
|
250 |
|
|
251 | 251 |
// Find 2 paths |
... | ... |
@@ -4,3 +4,3 @@ |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2010 |
|
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
... | ... |
@@ -90,3 +90,3 @@ |
90 | 90 |
if(report) std::cerr << "Run Preflow: " << ti << '\n'; |
91 |
if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n'; |
|
91 |
if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n'; |
|
92 | 92 |
} |
... | ... |
@@ -150,3 +150,3 @@ |
150 | 150 |
if(report) std::cerr << "\nCardinality of max matching: " |
151 |
<< mat.matchingSize() << '\n'; |
|
151 |
<< mat.matchingSize() << '\n'; |
|
152 | 152 |
} |
... | ... |
@@ -168,3 +168,3 @@ |
168 | 168 |
} |
169 |
|
|
169 |
|
|
170 | 170 |
switch(desc.type) |
... | ... |
@@ -240,3 +240,3 @@ |
240 | 240 |
DimacsDescriptor desc = dimacsType(is); |
241 |
|
|
241 |
|
|
242 | 242 |
if(!ap.given("q")) |
... | ... |
@@ -265,3 +265,3 @@ |
265 | 265 |
} |
266 |
|
|
266 |
|
|
267 | 267 |
if(ap.given("double")) |
0 comments (0 inline)