0
2
0
12
12
... | ... |
@@ -184,85 +184,85 @@ |
184 | 184 |
} |
185 | 185 |
} |
186 | 186 |
|
187 | 187 |
public: |
188 | 188 |
|
189 | 189 |
typedef Preflow Create; |
190 | 190 |
|
191 | 191 |
///\name Named template parameters |
192 | 192 |
|
193 | 193 |
///@{ |
194 | 194 |
|
195 | 195 |
template <typename _FlowMap> |
196 |
struct |
|
196 |
struct SetFlowMapTraits : public Traits { |
|
197 | 197 |
typedef _FlowMap FlowMap; |
198 | 198 |
static FlowMap *createFlowMap(const Digraph&) { |
199 | 199 |
LEMON_ASSERT(false, "FlowMap is not initialized"); |
200 | 200 |
return 0; // ignore warnings |
201 | 201 |
} |
202 | 202 |
}; |
203 | 203 |
|
204 | 204 |
/// \brief \ref named-templ-param "Named parameter" for setting |
205 | 205 |
/// FlowMap type |
206 | 206 |
/// |
207 | 207 |
/// \ref named-templ-param "Named parameter" for setting FlowMap |
208 | 208 |
/// type |
209 | 209 |
template <typename _FlowMap> |
210 |
struct DefFlowMap |
|
211 |
: public Preflow<Digraph, CapacityMap, DefFlowMapTraits<_FlowMap> > { |
|
210 |
struct SetFlowMap |
|
211 |
: public Preflow<Digraph, CapacityMap, SetFlowMapTraits<_FlowMap> > { |
|
212 | 212 |
typedef Preflow<Digraph, CapacityMap, |
213 |
|
|
213 |
SetFlowMapTraits<_FlowMap> > Create; |
|
214 | 214 |
}; |
215 | 215 |
|
216 | 216 |
template <typename _Elevator> |
217 |
struct |
|
217 |
struct SetElevatorTraits : public Traits { |
|
218 | 218 |
typedef _Elevator Elevator; |
219 | 219 |
static Elevator *createElevator(const Digraph&, int) { |
220 | 220 |
LEMON_ASSERT(false, "Elevator is not initialized"); |
221 | 221 |
return 0; // ignore warnings |
222 | 222 |
} |
223 | 223 |
}; |
224 | 224 |
|
225 | 225 |
/// \brief \ref named-templ-param "Named parameter" for setting |
226 | 226 |
/// Elevator type |
227 | 227 |
/// |
228 | 228 |
/// \ref named-templ-param "Named parameter" for setting Elevator |
229 | 229 |
/// type |
230 | 230 |
template <typename _Elevator> |
231 |
struct DefElevator |
|
232 |
: public Preflow<Digraph, CapacityMap, DefElevatorTraits<_Elevator> > { |
|
231 |
struct SetElevator |
|
232 |
: public Preflow<Digraph, CapacityMap, SetElevatorTraits<_Elevator> > { |
|
233 | 233 |
typedef Preflow<Digraph, CapacityMap, |
234 |
|
|
234 |
SetElevatorTraits<_Elevator> > Create; |
|
235 | 235 |
}; |
236 | 236 |
|
237 | 237 |
template <typename _Elevator> |
238 |
struct |
|
238 |
struct SetStandardElevatorTraits : public Traits { |
|
239 | 239 |
typedef _Elevator Elevator; |
240 | 240 |
static Elevator *createElevator(const Digraph& digraph, int max_level) { |
241 | 241 |
return new Elevator(digraph, max_level); |
242 | 242 |
} |
243 | 243 |
}; |
244 | 244 |
|
245 | 245 |
/// \brief \ref named-templ-param "Named parameter" for setting |
246 | 246 |
/// Elevator type |
247 | 247 |
/// |
248 | 248 |
/// \ref named-templ-param "Named parameter" for setting Elevator |
249 | 249 |
/// type. The Elevator should be standard constructor interface, ie. |
250 | 250 |
/// the digraph and the maximum level should be passed to it. |
251 | 251 |
template <typename _Elevator> |
252 |
struct |
|
252 |
struct SetStandardElevator |
|
253 | 253 |
: public Preflow<Digraph, CapacityMap, |
254 |
|
|
254 |
SetStandardElevatorTraits<_Elevator> > { |
|
255 | 255 |
typedef Preflow<Digraph, CapacityMap, |
256 |
|
|
256 |
SetStandardElevatorTraits<_Elevator> > Create; |
|
257 | 257 |
}; |
258 | 258 |
|
259 | 259 |
/// @} |
260 | 260 |
|
261 | 261 |
protected: |
262 | 262 |
|
263 | 263 |
Preflow() {} |
264 | 264 |
|
265 | 265 |
public: |
266 | 266 |
|
267 | 267 |
|
268 | 268 |
/// \brief The constructor of the class. |
... | ... |
@@ -37,25 +37,25 @@ |
37 | 37 |
typedef Digraph::Arc Arc; |
38 | 38 |
typedef concepts::ReadMap<Arc,VType> CapMap; |
39 | 39 |
typedef concepts::ReadWriteMap<Arc,VType> FlowMap; |
40 | 40 |
typedef concepts::WriteMap<Node,bool> CutMap; |
41 | 41 |
|
42 | 42 |
Digraph g; |
43 | 43 |
Node n; |
44 | 44 |
Arc e; |
45 | 45 |
CapMap cap; |
46 | 46 |
FlowMap flow; |
47 | 47 |
CutMap cut; |
48 | 48 |
|
49 |
Preflow<Digraph, CapMap>:: |
|
49 |
Preflow<Digraph, CapMap>::SetFlowMap<FlowMap>::Create preflow_test(g,cap,n,n); |
|
50 | 50 |
|
51 | 51 |
preflow_test.capacityMap(cap); |
52 | 52 |
flow = preflow_test.flowMap(); |
53 | 53 |
preflow_test.flowMap(flow); |
54 | 54 |
preflow_test.source(n); |
55 | 55 |
preflow_test.target(n); |
56 | 56 |
|
57 | 57 |
preflow_test.init(); |
58 | 58 |
preflow_test.flowInit(cap); |
59 | 59 |
preflow_test.startFirstPhase(); |
60 | 60 |
preflow_test.startSecondPhase(); |
61 | 61 |
preflow_test.run(); |
0 comments (0 inline)