0
13
0
... | ... |
@@ -164,12 +164,34 @@ |
164 | 164 |
only useful when the COIN-OR headers and libraries are not under |
165 | 165 |
the same prefix (which is unlikely). |
166 | 166 |
|
167 | 167 |
--with-coin-libdir=DIR |
168 | 168 |
|
169 | 169 |
The directory where the COIN-OR libraries are located. This is only |
170 | 170 |
useful when the COIN-OR headers and libraries are not under the |
171 | 171 |
same prefix (which is unlikely). |
172 | 172 |
|
173 | 173 |
--without-coin |
174 | 174 |
|
175 | 175 |
Disable COIN-OR support. |
176 |
|
|
177 |
|
|
178 |
Makefile Variables |
|
179 |
================== |
|
180 |
|
|
181 |
Some Makefile variables are reserved by the GNU Coding Standards for |
|
182 |
the use of the "user" - the person building the package. For instance, |
|
183 |
CXX and CXXFLAGS are such variables, and have the same meaning as |
|
184 |
explained in the previous section. These variables can be set on the |
|
185 |
command line when invoking `make' like this: |
|
186 |
`make [VARIABLE=VALUE]...' |
|
187 |
|
|
188 |
WARNINGCXXFLAGS is a non-standard Makefile variable introduced by us |
|
189 |
to hold several compiler flags related to warnings. Its default value |
|
190 |
can be overridden when invoking `make'. For example to disable all |
|
191 |
warning flags use `make WARNINGCXXFLAGS='. |
|
192 |
|
|
193 |
In order to turn off a single flag from the default set of warning |
|
194 |
flags, you can use the CXXFLAGS variable, since this is passed after |
|
195 |
WARNINGCXXFLAGS. For example to turn off `-Wold-style-cast' (which is |
|
196 |
used by default when g++ is detected) you can use |
|
197 |
`make CXXFLAGS="-g -O2 -Wno-old-style-cast"'. |
... | ... |
@@ -162,24 +162,29 @@ |
162 | 162 |
/// kind of length. The type of the length values is determined by the |
163 | 163 |
/// \ref concepts::ReadMap::Value "Value" type of the length map. |
164 | 164 |
/// |
165 | 165 |
/// There is also a \ref bellmanFord() "function-type interface" for the |
166 | 166 |
/// Bellman-Ford algorithm, which is convenient in the simplier cases and |
167 | 167 |
/// it can be used easier. |
168 | 168 |
/// |
169 | 169 |
/// \tparam GR The type of the digraph the algorithm runs on. |
170 | 170 |
/// The default type is \ref ListDigraph. |
171 | 171 |
/// \tparam LEN A \ref concepts::ReadMap "readable" arc map that specifies |
172 | 172 |
/// the lengths of the arcs. The default map type is |
173 | 173 |
/// \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
174 |
/// \tparam TR The traits class that defines various types used by the |
|
175 |
/// algorithm. By default, it is \ref BellmanFordDefaultTraits |
|
176 |
/// "BellmanFordDefaultTraits<GR, LEN>". |
|
177 |
/// In most cases, this parameter should not be set directly, |
|
178 |
/// consider to use the named template parameters instead. |
|
174 | 179 |
#ifdef DOXYGEN |
175 | 180 |
template <typename GR, typename LEN, typename TR> |
176 | 181 |
#else |
177 | 182 |
template <typename GR=ListDigraph, |
178 | 183 |
typename LEN=typename GR::template ArcMap<int>, |
179 | 184 |
typename TR=BellmanFordDefaultTraits<GR,LEN> > |
180 | 185 |
#endif |
181 | 186 |
class BellmanFord { |
182 | 187 |
public: |
183 | 188 |
|
184 | 189 |
///The type of the underlying digraph. |
185 | 190 |
typedef typename TR::Digraph Digraph; |
... | ... |
@@ -924,24 +929,27 @@ |
924 | 929 |
|
925 | 930 |
/// \brief Auxiliary class for the function-type interface of the |
926 | 931 |
/// \ref BellmanFord "Bellman-Ford" algorithm. |
927 | 932 |
/// |
928 | 933 |
/// This auxiliary class is created to implement the |
929 | 934 |
/// \ref bellmanFord() "function-type interface" of the |
930 | 935 |
/// \ref BellmanFord "Bellman-Ford" algorithm. |
931 | 936 |
/// It does not have own \ref run() method, it uses the |
932 | 937 |
/// functions and features of the plain \ref BellmanFord. |
933 | 938 |
/// |
934 | 939 |
/// This class should only be used through the \ref bellmanFord() |
935 | 940 |
/// function, which makes it easier to use the algorithm. |
941 |
/// |
|
942 |
/// \tparam TR The traits class that defines various types used by the |
|
943 |
/// algorithm. |
|
936 | 944 |
template<class TR> |
937 | 945 |
class BellmanFordWizard : public TR { |
938 | 946 |
typedef TR Base; |
939 | 947 |
|
940 | 948 |
typedef typename TR::Digraph Digraph; |
941 | 949 |
|
942 | 950 |
typedef typename Digraph::Node Node; |
943 | 951 |
typedef typename Digraph::NodeIt NodeIt; |
944 | 952 |
typedef typename Digraph::Arc Arc; |
945 | 953 |
typedef typename Digraph::OutArcIt ArcIt; |
946 | 954 |
|
947 | 955 |
typedef typename TR::LengthMap LengthMap; |
... | ... |
@@ -112,24 +112,29 @@ |
112 | 112 |
|
113 | 113 |
///%BFS algorithm class. |
114 | 114 |
|
115 | 115 |
///\ingroup search |
116 | 116 |
///This class provides an efficient implementation of the %BFS algorithm. |
117 | 117 |
/// |
118 | 118 |
///There is also a \ref bfs() "function-type interface" for the BFS |
119 | 119 |
///algorithm, which is convenient in the simplier cases and it can be |
120 | 120 |
///used easier. |
121 | 121 |
/// |
122 | 122 |
///\tparam GR The type of the digraph the algorithm runs on. |
123 | 123 |
///The default type is \ref ListDigraph. |
124 |
///\tparam TR The traits class that defines various types used by the |
|
125 |
///algorithm. By default, it is \ref BfsDefaultTraits |
|
126 |
///"BfsDefaultTraits<GR>". |
|
127 |
///In most cases, this parameter should not be set directly, |
|
128 |
///consider to use the named template parameters instead. |
|
124 | 129 |
#ifdef DOXYGEN |
125 | 130 |
template <typename GR, |
126 | 131 |
typename TR> |
127 | 132 |
#else |
128 | 133 |
template <typename GR=ListDigraph, |
129 | 134 |
typename TR=BfsDefaultTraits<GR> > |
130 | 135 |
#endif |
131 | 136 |
class Bfs { |
132 | 137 |
public: |
133 | 138 |
|
134 | 139 |
///The type of the digraph the algorithm runs on. |
135 | 140 |
typedef typename TR::Digraph Digraph; |
... | ... |
@@ -948,24 +953,27 @@ |
948 | 953 |
|
949 | 954 |
}; |
950 | 955 |
|
951 | 956 |
/// Auxiliary class for the function-type interface of BFS algorithm. |
952 | 957 |
|
953 | 958 |
/// This auxiliary class is created to implement the |
954 | 959 |
/// \ref bfs() "function-type interface" of \ref Bfs algorithm. |
955 | 960 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
956 | 961 |
/// functions and features of the plain \ref Bfs. |
957 | 962 |
/// |
958 | 963 |
/// This class should only be used through the \ref bfs() function, |
959 | 964 |
/// which makes it easier to use the algorithm. |
965 |
/// |
|
966 |
/// \tparam TR The traits class that defines various types used by the |
|
967 |
/// algorithm. |
|
960 | 968 |
template<class TR> |
961 | 969 |
class BfsWizard : public TR |
962 | 970 |
{ |
963 | 971 |
typedef TR Base; |
964 | 972 |
|
965 | 973 |
typedef typename TR::Digraph Digraph; |
966 | 974 |
|
967 | 975 |
typedef typename Digraph::Node Node; |
968 | 976 |
typedef typename Digraph::NodeIt NodeIt; |
969 | 977 |
typedef typename Digraph::Arc Arc; |
970 | 978 |
typedef typename Digraph::OutArcIt OutArcIt; |
971 | 979 |
|
... | ... |
@@ -1286,29 +1294,29 @@ |
1286 | 1294 |
/// when extra actions have to be performed in connection with certain |
1287 | 1295 |
/// events of the BFS algorithm. Otherwise consider to use Bfs or bfs() |
1288 | 1296 |
/// instead. |
1289 | 1297 |
/// |
1290 | 1298 |
/// \tparam GR The type of the digraph the algorithm runs on. |
1291 | 1299 |
/// The default type is \ref ListDigraph. |
1292 | 1300 |
/// The value of GR is not used directly by \ref BfsVisit, |
1293 | 1301 |
/// it is only passed to \ref BfsVisitDefaultTraits. |
1294 | 1302 |
/// \tparam VS The Visitor type that is used by the algorithm. |
1295 | 1303 |
/// \ref BfsVisitor "BfsVisitor<GR>" is an empty visitor, which |
1296 | 1304 |
/// does not observe the BFS events. If you want to observe the BFS |
1297 | 1305 |
/// events, you should implement your own visitor class. |
1298 |
/// \tparam TR Traits class to set various data types used by the |
|
1299 |
/// algorithm. The default traits class is |
|
1300 |
/// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>". |
|
1301 |
/// See \ref BfsVisitDefaultTraits for the documentation of |
|
1302 |
/// |
|
1306 |
/// \tparam TR The traits class that defines various types used by the |
|
1307 |
/// algorithm. By default, it is \ref BfsVisitDefaultTraits |
|
1308 |
/// "BfsVisitDefaultTraits<GR>". |
|
1309 |
/// In most cases, this parameter should not be set directly, |
|
1310 |
/// consider to use the named template parameters instead. |
|
1303 | 1311 |
#ifdef DOXYGEN |
1304 | 1312 |
template <typename GR, typename VS, typename TR> |
1305 | 1313 |
#else |
1306 | 1314 |
template <typename GR = ListDigraph, |
1307 | 1315 |
typename VS = BfsVisitor<GR>, |
1308 | 1316 |
typename TR = BfsVisitDefaultTraits<GR> > |
1309 | 1317 |
#endif |
1310 | 1318 |
class BfsVisit { |
1311 | 1319 |
public: |
1312 | 1320 |
|
1313 | 1321 |
///The traits class. |
1314 | 1322 |
typedef TR Traits; |
... | ... |
@@ -68,27 +68,32 @@ |
68 | 68 |
/// of the successive shortest path algorithm for finding a |
69 | 69 |
/// \ref min_cost_flow "minimum cost flow" \ref amo93networkflows, |
70 | 70 |
/// \ref edmondskarp72theoretical. It is an efficient dual |
71 | 71 |
/// solution method. |
72 | 72 |
/// |
73 | 73 |
/// Most of the parameters of the problem (except for the digraph) |
74 | 74 |
/// can be given using separate functions, and the algorithm can be |
75 | 75 |
/// executed using the \ref run() function. If some parameters are not |
76 | 76 |
/// specified, then default values will be used. |
77 | 77 |
/// |
78 | 78 |
/// \tparam GR The digraph type the algorithm runs on. |
79 | 79 |
/// \tparam V The number type used for flow amounts, capacity bounds |
80 |
/// and supply values in the algorithm. By default it is \c int. |
|
80 |
/// and supply values in the algorithm. By default, it is \c int. |
|
81 | 81 |
/// \tparam C The number type used for costs and potentials in the |
82 |
/// algorithm. By default it is the same as \c V. |
|
82 |
/// algorithm. By default, it is the same as \c V. |
|
83 |
/// \tparam TR The traits class that defines various types used by the |
|
84 |
/// algorithm. By default, it is \ref CapacityScalingDefaultTraits |
|
85 |
/// "CapacityScalingDefaultTraits<GR, V, C>". |
|
86 |
/// In most cases, this parameter should not be set directly, |
|
87 |
/// consider to use the named template parameters instead. |
|
83 | 88 |
/// |
84 | 89 |
/// \warning Both number types must be signed and all input data must |
85 | 90 |
/// be integer. |
86 | 91 |
/// \warning This algorithm does not support negative costs for such |
87 | 92 |
/// arcs that have infinite upper bound. |
88 | 93 |
#ifdef DOXYGEN |
89 | 94 |
template <typename GR, typename V, typename C, typename TR> |
90 | 95 |
#else |
91 | 96 |
template < typename GR, typename V = int, typename C = V, |
92 | 97 |
typename TR = CapacityScalingDefaultTraits<GR, V, C> > |
93 | 98 |
#endif |
94 | 99 |
class CapacityScaling |
... | ... |
@@ -164,24 +164,29 @@ |
164 | 164 |
cannot exist. |
165 | 165 |
|
166 | 166 |
Note that this algorithm also provides a feasible solution for the |
167 | 167 |
\ref min_cost_flow "minimum cost flow problem". |
168 | 168 |
|
169 | 169 |
\tparam GR The type of the digraph the algorithm runs on. |
170 | 170 |
\tparam LM The type of the lower bound map. The default |
171 | 171 |
map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
172 | 172 |
\tparam UM The type of the upper bound (capacity) map. |
173 | 173 |
The default map type is \c LM. |
174 | 174 |
\tparam SM The type of the supply map. The default map type is |
175 | 175 |
\ref concepts::Digraph::NodeMap "GR::NodeMap<UM::Value>". |
176 |
\tparam TR The traits class that defines various types used by the |
|
177 |
algorithm. By default, it is \ref CirculationDefaultTraits |
|
178 |
"CirculationDefaultTraits<GR, LM, UM, SM>". |
|
179 |
In most cases, this parameter should not be set directly, |
|
180 |
consider to use the named template parameters instead. |
|
176 | 181 |
*/ |
177 | 182 |
#ifdef DOXYGEN |
178 | 183 |
template< typename GR, |
179 | 184 |
typename LM, |
180 | 185 |
typename UM, |
181 | 186 |
typename SM, |
182 | 187 |
typename TR > |
183 | 188 |
#else |
184 | 189 |
template< typename GR, |
185 | 190 |
typename LM = typename GR::template ArcMap<int>, |
186 | 191 |
typename UM = LM, |
187 | 192 |
typename SM = typename GR::template NodeMap<typename UM::Value>, |
... | ... |
@@ -95,27 +95,32 @@ |
95 | 95 |
/// \ref goldberg97efficient, \ref bunnagel98efficient. |
96 | 96 |
/// It is a highly efficient primal-dual solution method, which |
97 | 97 |
/// can be viewed as the generalization of the \ref Preflow |
98 | 98 |
/// "preflow push-relabel" algorithm for the maximum flow problem. |
99 | 99 |
/// |
100 | 100 |
/// Most of the parameters of the problem (except for the digraph) |
101 | 101 |
/// can be given using separate functions, and the algorithm can be |
102 | 102 |
/// executed using the \ref run() function. If some parameters are not |
103 | 103 |
/// specified, then default values will be used. |
104 | 104 |
/// |
105 | 105 |
/// \tparam GR The digraph type the algorithm runs on. |
106 | 106 |
/// \tparam V The number type used for flow amounts, capacity bounds |
107 |
/// and supply values in the algorithm. By default it is \c int. |
|
107 |
/// and supply values in the algorithm. By default, it is \c int. |
|
108 | 108 |
/// \tparam C The number type used for costs and potentials in the |
109 |
/// algorithm. By default it is the same as \c V. |
|
109 |
/// algorithm. By default, it is the same as \c V. |
|
110 |
/// \tparam TR The traits class that defines various types used by the |
|
111 |
/// algorithm. By default, it is \ref CostScalingDefaultTraits |
|
112 |
/// "CostScalingDefaultTraits<GR, V, C>". |
|
113 |
/// In most cases, this parameter should not be set directly, |
|
114 |
/// consider to use the named template parameters instead. |
|
110 | 115 |
/// |
111 | 116 |
/// \warning Both number types must be signed and all input data must |
112 | 117 |
/// be integer. |
113 | 118 |
/// \warning This algorithm does not support negative costs for such |
114 | 119 |
/// arcs that have infinite upper bound. |
115 | 120 |
/// |
116 | 121 |
/// \note %CostScaling provides three different internal methods, |
117 | 122 |
/// from which the most efficient one is used by default. |
118 | 123 |
/// For more information, see \ref Method. |
119 | 124 |
#ifdef DOXYGEN |
120 | 125 |
template <typename GR, typename V, typename C, typename TR> |
121 | 126 |
#else |
... | ... |
@@ -127,26 +132,25 @@ |
127 | 132 |
public: |
128 | 133 |
|
129 | 134 |
/// The type of the digraph |
130 | 135 |
typedef typename TR::Digraph Digraph; |
131 | 136 |
/// The type of the flow amounts, capacity bounds and supply values |
132 | 137 |
typedef typename TR::Value Value; |
133 | 138 |
/// The type of the arc costs |
134 | 139 |
typedef typename TR::Cost Cost; |
135 | 140 |
|
136 | 141 |
/// \brief The large cost type |
137 | 142 |
/// |
138 | 143 |
/// The large cost type used for internal computations. |
139 |
/// Using the \ref CostScalingDefaultTraits "default traits class", |
|
140 |
/// it is \c long \c long if the \c Cost type is integer, |
|
144 |
/// By default, it is \c long \c long if the \c Cost type is integer, |
|
141 | 145 |
/// otherwise it is \c double. |
142 | 146 |
typedef typename TR::LargeCost LargeCost; |
143 | 147 |
|
144 | 148 |
/// The \ref CostScalingDefaultTraits "traits class" of the algorithm |
145 | 149 |
typedef TR Traits; |
146 | 150 |
|
147 | 151 |
public: |
148 | 152 |
|
149 | 153 |
/// \brief Problem type constants for the \c run() function. |
150 | 154 |
/// |
151 | 155 |
/// Enum type containing the problem type constants that can be |
152 | 156 |
/// returned by the \ref run() function of the algorithm. |
... | ... |
@@ -112,24 +112,29 @@ |
112 | 112 |
|
113 | 113 |
///%DFS algorithm class. |
114 | 114 |
|
115 | 115 |
///\ingroup search |
116 | 116 |
///This class provides an efficient implementation of the %DFS algorithm. |
117 | 117 |
/// |
118 | 118 |
///There is also a \ref dfs() "function-type interface" for the DFS |
119 | 119 |
///algorithm, which is convenient in the simplier cases and it can be |
120 | 120 |
///used easier. |
121 | 121 |
/// |
122 | 122 |
///\tparam GR The type of the digraph the algorithm runs on. |
123 | 123 |
///The default type is \ref ListDigraph. |
124 |
///\tparam TR The traits class that defines various types used by the |
|
125 |
///algorithm. By default, it is \ref DfsDefaultTraits |
|
126 |
///"DfsDefaultTraits<GR>". |
|
127 |
///In most cases, this parameter should not be set directly, |
|
128 |
///consider to use the named template parameters instead. |
|
124 | 129 |
#ifdef DOXYGEN |
125 | 130 |
template <typename GR, |
126 | 131 |
typename TR> |
127 | 132 |
#else |
128 | 133 |
template <typename GR=ListDigraph, |
129 | 134 |
typename TR=DfsDefaultTraits<GR> > |
130 | 135 |
#endif |
131 | 136 |
class Dfs { |
132 | 137 |
public: |
133 | 138 |
|
134 | 139 |
///The type of the digraph the algorithm runs on. |
135 | 140 |
typedef typename TR::Digraph Digraph; |
... | ... |
@@ -878,24 +883,27 @@ |
878 | 883 |
|
879 | 884 |
}; |
880 | 885 |
|
881 | 886 |
/// Auxiliary class for the function-type interface of DFS algorithm. |
882 | 887 |
|
883 | 888 |
/// This auxiliary class is created to implement the |
884 | 889 |
/// \ref dfs() "function-type interface" of \ref Dfs algorithm. |
885 | 890 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
886 | 891 |
/// functions and features of the plain \ref Dfs. |
887 | 892 |
/// |
888 | 893 |
/// This class should only be used through the \ref dfs() function, |
889 | 894 |
/// which makes it easier to use the algorithm. |
895 |
/// |
|
896 |
/// \tparam TR The traits class that defines various types used by the |
|
897 |
/// algorithm. |
|
890 | 898 |
template<class TR> |
891 | 899 |
class DfsWizard : public TR |
892 | 900 |
{ |
893 | 901 |
typedef TR Base; |
894 | 902 |
|
895 | 903 |
typedef typename TR::Digraph Digraph; |
896 | 904 |
|
897 | 905 |
typedef typename Digraph::Node Node; |
898 | 906 |
typedef typename Digraph::NodeIt NodeIt; |
899 | 907 |
typedef typename Digraph::Arc Arc; |
900 | 908 |
typedef typename Digraph::OutArcIt OutArcIt; |
901 | 909 |
|
... | ... |
@@ -1228,29 +1236,29 @@ |
1228 | 1236 |
/// when extra actions have to be performed in connection with certain |
1229 | 1237 |
/// events of the DFS algorithm. Otherwise consider to use Dfs or dfs() |
1230 | 1238 |
/// instead. |
1231 | 1239 |
/// |
1232 | 1240 |
/// \tparam GR The type of the digraph the algorithm runs on. |
1233 | 1241 |
/// The default type is \ref ListDigraph. |
1234 | 1242 |
/// The value of GR is not used directly by \ref DfsVisit, |
1235 | 1243 |
/// it is only passed to \ref DfsVisitDefaultTraits. |
1236 | 1244 |
/// \tparam VS The Visitor type that is used by the algorithm. |
1237 | 1245 |
/// \ref DfsVisitor "DfsVisitor<GR>" is an empty visitor, which |
1238 | 1246 |
/// does not observe the DFS events. If you want to observe the DFS |
1239 | 1247 |
/// events, you should implement your own visitor class. |
1240 |
/// \tparam TR Traits class to set various data types used by the |
|
1241 |
/// algorithm. The default traits class is |
|
1242 |
/// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<GR>". |
|
1243 |
/// See \ref DfsVisitDefaultTraits for the documentation of |
|
1244 |
/// |
|
1248 |
/// \tparam TR The traits class that defines various types used by the |
|
1249 |
/// algorithm. By default, it is \ref DfsVisitDefaultTraits |
|
1250 |
/// "DfsVisitDefaultTraits<GR>". |
|
1251 |
/// In most cases, this parameter should not be set directly, |
|
1252 |
/// consider to use the named template parameters instead. |
|
1245 | 1253 |
#ifdef DOXYGEN |
1246 | 1254 |
template <typename GR, typename VS, typename TR> |
1247 | 1255 |
#else |
1248 | 1256 |
template <typename GR = ListDigraph, |
1249 | 1257 |
typename VS = DfsVisitor<GR>, |
1250 | 1258 |
typename TR = DfsVisitDefaultTraits<GR> > |
1251 | 1259 |
#endif |
1252 | 1260 |
class DfsVisit { |
1253 | 1261 |
public: |
1254 | 1262 |
|
1255 | 1263 |
///The traits class. |
1256 | 1264 |
typedef TR Traits; |
... | ... |
@@ -183,24 +183,29 @@ |
183 | 183 |
///There is also a \ref dijkstra() "function-type interface" for the |
184 | 184 |
///%Dijkstra algorithm, which is convenient in the simplier cases and |
185 | 185 |
///it can be used easier. |
186 | 186 |
/// |
187 | 187 |
///\tparam GR The type of the digraph the algorithm runs on. |
188 | 188 |
///The default type is \ref ListDigraph. |
189 | 189 |
///\tparam LEN A \ref concepts::ReadMap "readable" arc map that specifies |
190 | 190 |
///the lengths of the arcs. |
191 | 191 |
///It is read once for each arc, so the map may involve in |
192 | 192 |
///relatively time consuming process to compute the arc lengths if |
193 | 193 |
///it is necessary. The default map type is \ref |
194 | 194 |
///concepts::Digraph::ArcMap "GR::ArcMap<int>". |
195 |
///\tparam TR The traits class that defines various types used by the |
|
196 |
///algorithm. By default, it is \ref DijkstraDefaultTraits |
|
197 |
///"DijkstraDefaultTraits<GR, LEN>". |
|
198 |
///In most cases, this parameter should not be set directly, |
|
199 |
///consider to use the named template parameters instead. |
|
195 | 200 |
#ifdef DOXYGEN |
196 | 201 |
template <typename GR, typename LEN, typename TR> |
197 | 202 |
#else |
198 | 203 |
template <typename GR=ListDigraph, |
199 | 204 |
typename LEN=typename GR::template ArcMap<int>, |
200 | 205 |
typename TR=DijkstraDefaultTraits<GR,LEN> > |
201 | 206 |
#endif |
202 | 207 |
class Dijkstra { |
203 | 208 |
public: |
204 | 209 |
|
205 | 210 |
///The type of the digraph the algorithm runs on. |
206 | 211 |
typedef typename TR::Digraph Digraph; |
... | ... |
@@ -1083,24 +1088,27 @@ |
1083 | 1088 |
|
1084 | 1089 |
}; |
1085 | 1090 |
|
1086 | 1091 |
/// Auxiliary class for the function-type interface of Dijkstra algorithm. |
1087 | 1092 |
|
1088 | 1093 |
/// This auxiliary class is created to implement the |
1089 | 1094 |
/// \ref dijkstra() "function-type interface" of \ref Dijkstra algorithm. |
1090 | 1095 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
1091 | 1096 |
/// functions and features of the plain \ref Dijkstra. |
1092 | 1097 |
/// |
1093 | 1098 |
/// This class should only be used through the \ref dijkstra() function, |
1094 | 1099 |
/// which makes it easier to use the algorithm. |
1100 |
/// |
|
1101 |
/// \tparam TR The traits class that defines various types used by the |
|
1102 |
/// algorithm. |
|
1095 | 1103 |
template<class TR> |
1096 | 1104 |
class DijkstraWizard : public TR |
1097 | 1105 |
{ |
1098 | 1106 |
typedef TR Base; |
1099 | 1107 |
|
1100 | 1108 |
typedef typename TR::Digraph Digraph; |
1101 | 1109 |
|
1102 | 1110 |
typedef typename Digraph::Node Node; |
1103 | 1111 |
typedef typename Digraph::NodeIt NodeIt; |
1104 | 1112 |
typedef typename Digraph::Arc Arc; |
1105 | 1113 |
typedef typename Digraph::OutArcIt OutArcIt; |
1106 | 1114 |
... | ... |
@@ -97,47 +97,51 @@ |
97 | 97 |
/// a minimum mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements the Hartmann-Orlin algorithm for finding |
100 | 100 |
/// a directed cycle of minimum mean length (cost) in a digraph |
101 | 101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
102 | 102 |
/// It is an improved version of \ref Karp "Karp"'s original algorithm, |
103 | 103 |
/// it applies an efficient early termination scheme. |
104 | 104 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
105 | 105 |
/// |
106 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
107 | 107 |
/// \tparam LEN The type of the length map. The default |
108 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
109 |
/// \tparam TR The traits class that defines various types used by the |
|
110 |
/// algorithm. By default, it is \ref HartmannOrlinDefaultTraits |
|
111 |
/// "HartmannOrlinDefaultTraits<GR, LEN>". |
|
112 |
/// In most cases, this parameter should not be set directly, |
|
113 |
/// consider to use the named template parameters instead. |
|
109 | 114 |
#ifdef DOXYGEN |
110 | 115 |
template <typename GR, typename LEN, typename TR> |
111 | 116 |
#else |
112 | 117 |
template < typename GR, |
113 | 118 |
typename LEN = typename GR::template ArcMap<int>, |
114 | 119 |
typename TR = HartmannOrlinDefaultTraits<GR, LEN> > |
115 | 120 |
#endif |
116 | 121 |
class HartmannOrlin |
117 | 122 |
{ |
118 | 123 |
public: |
119 | 124 |
|
120 | 125 |
/// The type of the digraph |
121 | 126 |
typedef typename TR::Digraph Digraph; |
122 | 127 |
/// The type of the length map |
123 | 128 |
typedef typename TR::LengthMap LengthMap; |
124 | 129 |
/// The type of the arc lengths |
125 | 130 |
typedef typename TR::Value Value; |
126 | 131 |
|
127 | 132 |
/// \brief The large value type |
128 | 133 |
/// |
129 | 134 |
/// The large value type used for internal computations. |
130 |
/// Using the \ref HartmannOrlinDefaultTraits "default traits class", |
|
131 |
/// it is \c long \c long if the \c Value type is integer, |
|
135 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
132 | 136 |
/// otherwise it is \c double. |
133 | 137 |
typedef typename TR::LargeValue LargeValue; |
134 | 138 |
|
135 | 139 |
/// The tolerance type |
136 | 140 |
typedef typename TR::Tolerance Tolerance; |
137 | 141 |
|
138 | 142 |
/// \brief The path type of the found cycles |
139 | 143 |
/// |
140 | 144 |
/// The path type of the found cycles. |
141 | 145 |
/// Using the \ref HartmannOrlinDefaultTraits "default traits class", |
142 | 146 |
/// it is \ref lemon::Path "Path<Digraph>". |
143 | 147 |
typedef typename TR::Path Path; |
... | ... |
@@ -97,47 +97,51 @@ |
97 | 97 |
/// mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements Howard's policy iteration algorithm for finding |
100 | 100 |
/// a directed cycle of minimum mean length (cost) in a digraph |
101 | 101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
102 | 102 |
/// This class provides the most efficient algorithm for the |
103 | 103 |
/// minimum mean cycle problem, though the best known theoretical |
104 | 104 |
/// bound on its running time is exponential. |
105 | 105 |
/// |
106 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
107 | 107 |
/// \tparam LEN The type of the length map. The default |
108 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
109 |
/// \tparam TR The traits class that defines various types used by the |
|
110 |
/// algorithm. By default, it is \ref HowardDefaultTraits |
|
111 |
/// "HowardDefaultTraits<GR, LEN>". |
|
112 |
/// In most cases, this parameter should not be set directly, |
|
113 |
/// consider to use the named template parameters instead. |
|
109 | 114 |
#ifdef DOXYGEN |
110 | 115 |
template <typename GR, typename LEN, typename TR> |
111 | 116 |
#else |
112 | 117 |
template < typename GR, |
113 | 118 |
typename LEN = typename GR::template ArcMap<int>, |
114 | 119 |
typename TR = HowardDefaultTraits<GR, LEN> > |
115 | 120 |
#endif |
116 | 121 |
class Howard |
117 | 122 |
{ |
118 | 123 |
public: |
119 | 124 |
|
120 | 125 |
/// The type of the digraph |
121 | 126 |
typedef typename TR::Digraph Digraph; |
122 | 127 |
/// The type of the length map |
123 | 128 |
typedef typename TR::LengthMap LengthMap; |
124 | 129 |
/// The type of the arc lengths |
125 | 130 |
typedef typename TR::Value Value; |
126 | 131 |
|
127 | 132 |
/// \brief The large value type |
128 | 133 |
/// |
129 | 134 |
/// The large value type used for internal computations. |
130 |
/// Using the \ref HowardDefaultTraits "default traits class", |
|
131 |
/// it is \c long \c long if the \c Value type is integer, |
|
135 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
132 | 136 |
/// otherwise it is \c double. |
133 | 137 |
typedef typename TR::LargeValue LargeValue; |
134 | 138 |
|
135 | 139 |
/// The tolerance type |
136 | 140 |
typedef typename TR::Tolerance Tolerance; |
137 | 141 |
|
138 | 142 |
/// \brief The path type of the found cycles |
139 | 143 |
/// |
140 | 144 |
/// The path type of the found cycles. |
141 | 145 |
/// Using the \ref HowardDefaultTraits "default traits class", |
142 | 146 |
/// it is \ref lemon::Path "Path<Digraph>". |
143 | 147 |
typedef typename TR::Path Path; |
... | ... |
@@ -95,47 +95,51 @@ |
95 | 95 |
|
96 | 96 |
/// \brief Implementation of Karp's algorithm for finding a minimum |
97 | 97 |
/// mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements Karp's algorithm for finding a directed |
100 | 100 |
/// cycle of minimum mean length (cost) in a digraph |
101 | 101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
102 | 102 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
103 | 103 |
/// |
104 | 104 |
/// \tparam GR The type of the digraph the algorithm runs on. |
105 | 105 |
/// \tparam LEN The type of the length map. The default |
106 | 106 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
107 |
/// \tparam TR The traits class that defines various types used by the |
|
108 |
/// algorithm. By default, it is \ref KarpDefaultTraits |
|
109 |
/// "KarpDefaultTraits<GR, LEN>". |
|
110 |
/// In most cases, this parameter should not be set directly, |
|
111 |
/// consider to use the named template parameters instead. |
|
107 | 112 |
#ifdef DOXYGEN |
108 | 113 |
template <typename GR, typename LEN, typename TR> |
109 | 114 |
#else |
110 | 115 |
template < typename GR, |
111 | 116 |
typename LEN = typename GR::template ArcMap<int>, |
112 | 117 |
typename TR = KarpDefaultTraits<GR, LEN> > |
113 | 118 |
#endif |
114 | 119 |
class Karp |
115 | 120 |
{ |
116 | 121 |
public: |
117 | 122 |
|
118 | 123 |
/// The type of the digraph |
119 | 124 |
typedef typename TR::Digraph Digraph; |
120 | 125 |
/// The type of the length map |
121 | 126 |
typedef typename TR::LengthMap LengthMap; |
122 | 127 |
/// The type of the arc lengths |
123 | 128 |
typedef typename TR::Value Value; |
124 | 129 |
|
125 | 130 |
/// \brief The large value type |
126 | 131 |
/// |
127 | 132 |
/// The large value type used for internal computations. |
128 |
/// Using the \ref KarpDefaultTraits "default traits class", |
|
129 |
/// it is \c long \c long if the \c Value type is integer, |
|
133 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
130 | 134 |
/// otherwise it is \c double. |
131 | 135 |
typedef typename TR::LargeValue LargeValue; |
132 | 136 |
|
133 | 137 |
/// The tolerance type |
134 | 138 |
typedef typename TR::Tolerance Tolerance; |
135 | 139 |
|
136 | 140 |
/// \brief The path type of the found cycles |
137 | 141 |
/// |
138 | 142 |
/// The path type of the found cycles. |
139 | 143 |
/// Using the \ref KarpDefaultTraits "default traits class", |
140 | 144 |
/// it is \ref lemon::Path "Path<Digraph>". |
141 | 145 |
typedef typename TR::Path Path; |
... | ... |
@@ -103,35 +103,36 @@ |
103 | 103 |
/// given sources and spans all the nodes which are reachable from the |
104 | 104 |
/// sources. The time complexity of the algorithm is O(n<sup>2</sup>+e). |
105 | 105 |
/// |
106 | 106 |
/// The algorithm also provides an optimal dual solution, therefore |
107 | 107 |
/// the optimality of the solution can be checked. |
108 | 108 |
/// |
109 | 109 |
/// \param GR The digraph type the algorithm runs on. |
110 | 110 |
/// \param CM A read-only arc map storing the costs of the |
111 | 111 |
/// arcs. It is read once for each arc, so the map may involve in |
112 | 112 |
/// relatively time consuming process to compute the arc costs if |
113 | 113 |
/// it is necessary. The default map type is \ref |
114 | 114 |
/// concepts::Digraph::ArcMap "Digraph::ArcMap<int>". |
115 |
/// \param TR Traits class to set various data types used |
|
116 |
/// by the algorithm. The default traits class is |
|
117 |
/// \ |
|
115 |
/// \tparam TR The traits class that defines various types used by the |
|
116 |
/// algorithm. By default, it is \ref MinCostArborescenceDefaultTraits |
|
118 | 117 |
/// "MinCostArborescenceDefaultTraits<GR, CM>". |
118 |
/// In most cases, this parameter should not be set directly, |
|
119 |
/// consider to use the named template parameters instead. |
|
119 | 120 |
#ifndef DOXYGEN |
120 | 121 |
template <typename GR, |
121 | 122 |
typename CM = typename GR::template ArcMap<int>, |
122 | 123 |
typename TR = |
123 | 124 |
MinCostArborescenceDefaultTraits<GR, CM> > |
124 | 125 |
#else |
125 |
template <typename GR, typename CM, |
|
126 |
template <typename GR, typename CM, typename TR> |
|
126 | 127 |
#endif |
127 | 128 |
class MinCostArborescence { |
128 | 129 |
public: |
129 | 130 |
|
130 | 131 |
/// \brief The \ref MinCostArborescenceDefaultTraits "traits class" |
131 | 132 |
/// of the algorithm. |
132 | 133 |
typedef TR Traits; |
133 | 134 |
/// The type of the underlying digraph. |
134 | 135 |
typedef typename Traits::Digraph Digraph; |
135 | 136 |
/// The type of the map that stores the arc costs. |
136 | 137 |
typedef typename Traits::CostMap CostMap; |
137 | 138 |
///The type of the costs of the arcs. |
... | ... |
@@ -110,24 +110,29 @@ |
110 | 110 |
/// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$. |
111 | 111 |
/// |
112 | 112 |
/// The algorithm consists of two phases. After the first phase |
113 | 113 |
/// the maximum flow value and the minimum cut is obtained. The |
114 | 114 |
/// second phase constructs a feasible maximum flow on each arc. |
115 | 115 |
/// |
116 | 116 |
/// \warning This implementation cannot handle infinite or very large |
117 | 117 |
/// capacities (e.g. the maximum value of \c CAP::Value). |
118 | 118 |
/// |
119 | 119 |
/// \tparam GR The type of the digraph the algorithm runs on. |
120 | 120 |
/// \tparam CAP The type of the capacity map. The default map |
121 | 121 |
/// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
122 |
/// \tparam TR The traits class that defines various types used by the |
|
123 |
/// algorithm. By default, it is \ref PreflowDefaultTraits |
|
124 |
/// "PreflowDefaultTraits<GR, CAP>". |
|
125 |
/// In most cases, this parameter should not be set directly, |
|
126 |
/// consider to use the named template parameters instead. |
|
122 | 127 |
#ifdef DOXYGEN |
123 | 128 |
template <typename GR, typename CAP, typename TR> |
124 | 129 |
#else |
125 | 130 |
template <typename GR, |
126 | 131 |
typename CAP = typename GR::template ArcMap<int>, |
127 | 132 |
typename TR = PreflowDefaultTraits<GR, CAP> > |
128 | 133 |
#endif |
129 | 134 |
class Preflow { |
130 | 135 |
public: |
131 | 136 |
|
132 | 137 |
///The \ref PreflowDefaultTraits "traits class" of the algorithm. |
133 | 138 |
typedef TR Traits; |
0 comments (0 inline)