Changeset 1173:d216e1c8b3fa in lemon for test/suurballe_test.cc
- Timestamp:
- 11/28/12 11:54:43 (11 years ago)
- Branch:
- default
- Parents:
- 1160:00f8d9f9920d (diff), 1171:7e368d9b67f7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/suurballe_test.cc
r956 r1173 118 118 int f; 119 119 VType c; 120 ignore_unused_variable_warning(f,c); 121 120 122 c = const_suurb_test.totalLength(); 121 123 f = const_suurb_test.flow(e); -
test/suurballe_test.cc
r1171 r1173 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 24 24 #include <lemon/suurballe.h> 25 25 #include <lemon/concepts/digraph.h> 26 #include <lemon/concepts/heap.h> 26 27 27 28 #include "test_tools.h" … … 81 82 typedef Digraph::Arc Arc; 82 83 typedef concepts::ReadMap<Arc, VType> LengthMap; 83 84 typedef Suurballe<Digraph, LengthMap> SuurballeType; 84 85 typedef Suurballe<Digraph, LengthMap> ST; 86 typedef Suurballe<Digraph, LengthMap> 87 ::SetFlowMap<ST::FlowMap> 88 ::SetPotentialMap<ST::PotentialMap> 89 ::SetPath<SimplePath<Digraph> > 90 ::SetHeap<concepts::Heap<VType, Digraph::NodeMap<int> > > 91 ::Create SuurballeType; 85 92 86 93 Digraph g; … … 102 109 k = suurb_test.run(n, n, k); 103 110 suurb_test.init(n); 111 suurb_test.fullInit(n); 112 suurb_test.start(n); 113 suurb_test.start(n, k); 104 114 k = suurb_test.findFlow(n); 105 115 k = suurb_test.findFlow(n, k); 106 116 suurb_test.findPaths(); 107 117 108 118 int f; 109 119 VType c; … … 119 129 k = const_suurb_test.pathNum(); 120 130 Path<Digraph> p = const_suurb_test.path(k); 121 131 122 132 ignore_unused_variable_warning(fm); 123 133 ignore_unused_variable_warning(pm); … … 198 208 run(); 199 209 200 // Find 2 paths210 // Check run() 201 211 { 202 212 Suurballe<ListDigraph> suurballe(digraph, length); 213 214 // Find 2 paths 203 215 check(suurballe.run(s, t) == 2, "Wrong number of paths"); 204 216 check(checkFlow(digraph, suurballe.flowMap(), s, t, 2), … … 210 222 for (int i = 0; i < suurballe.pathNum(); ++i) 211 223 check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path"); 212 } 213 214 // Find 3 paths 215 { 216 Suurballe<ListDigraph> suurballe(digraph, length); 224 225 // Find 3 paths 217 226 check(suurballe.run(s, t, 3) == 3, "Wrong number of paths"); 218 227 check(checkFlow(digraph, suurballe.flowMap(), s, t, 3), … … 224 233 for (int i = 0; i < suurballe.pathNum(); ++i) 225 234 check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path"); 226 } 227 228 // Find 5 paths (only 3 can be found) 229 { 230 Suurballe<ListDigraph> suurballe(digraph, length); 235 236 // Find 5 paths (only 3 can be found) 231 237 check(suurballe.run(s, t, 5) == 3, "Wrong number of paths"); 232 238 check(checkFlow(digraph, suurballe.flowMap(), s, t, 3), … … 240 246 } 241 247 248 // Check fullInit() + start() 249 { 250 Suurballe<ListDigraph> suurballe(digraph, length); 251 suurballe.fullInit(s); 252 253 // Find 2 paths 254 check(suurballe.start(t) == 2, "Wrong number of paths"); 255 check(suurballe.totalLength() == 510, "The flow is not optimal"); 256 257 // Find 3 paths 258 check(suurballe.start(t, 3) == 3, "Wrong number of paths"); 259 check(suurballe.totalLength() == 1040, "The flow is not optimal"); 260 261 // Find 5 paths (only 3 can be found) 262 check(suurballe.start(t, 5) == 3, "Wrong number of paths"); 263 check(suurballe.totalLength() == 1040, "The flow is not optimal"); 264 } 265 242 266 return 0; 243 267 }
Note: See TracChangeset
for help on using the changeset viewer.