Changeset 689:111698359429 in lemon for test/min_cost_flow_test.cc
 Timestamp:
 04/29/09 16:54:27 (13 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/min_cost_flow_test.cc
r687 r689 85 85 86 86 // Check the interface of an MCF algorithm 87 template <typename GR, typename Flow, typename Cost>87 template <typename GR, typename Value, typename Cost> 88 88 class McfClassConcept 89 89 { … … 96 96 97 97 MCF mcf(g); 98 const MCF& const_mcf = mcf; 98 99 99 100 b = mcf.reset() … … 103 104 .supplyMap(sup) 104 105 .stSupply(n, n, k) 105 .flowMap(flow)106 .potentialMap(pot)107 106 .run(); 108 109 const MCF& const_mcf = mcf;110 111 const typename MCF::FlowMap &fm = const_mcf.flowMap();112 const typename MCF::PotentialMap &pm = const_mcf.potentialMap();113 107 114 108 c = const_mcf.totalCost(); 115 doublex = const_mcf.template totalCost<double>();109 x = const_mcf.template totalCost<double>(); 116 110 v = const_mcf.flow(a); 117 111 c = const_mcf.potential(n); 118 119 v = const_mcf.INF; 120 121 ignore_unused_variable_warning(fm); 122 ignore_unused_variable_warning(pm); 123 ignore_unused_variable_warning(x); 112 const_mcf.flowMap(fm); 113 const_mcf.potentialMap(pm); 124 114 } 125 115 126 116 typedef typename GR::Node Node; 127 117 typedef typename GR::Arc Arc; 128 typedef concepts::ReadMap<Node, Flow> NM;129 typedef concepts::ReadMap<Arc, Flow> FAM;118 typedef concepts::ReadMap<Node, Value> NM; 119 typedef concepts::ReadMap<Arc, Value> VAM; 130 120 typedef concepts::ReadMap<Arc, Cost> CAM; 121 typedef concepts::WriteMap<Arc, Value> FlowMap; 122 typedef concepts::WriteMap<Node, Cost> PotMap; 131 123 132 124 const GR &g; 133 const FAM &lower;134 const FAM &upper;125 const VAM &lower; 126 const VAM &upper; 135 127 const CAM &cost; 136 128 const NM ⊃ 137 129 const Node &n; 138 130 const Arc &a; 139 const Flow&k;140 Flow v;141 Cost c;131 const Value &k; 132 FlowMap fm; 133 PotMap pm; 142 134 bool b; 143 144 typename MCF:: FlowMap &flow;145 typename MCF:: PotentialMap &pot;135 double x; 136 typename MCF::Value v; 137 typename MCF::Cost c; 146 138 }; 147 139 … … 222 214 check(mcf_result == result, "Wrong result " + test_id); 223 215 if (optimal) { 224 check(checkFlow(gr, lower, upper, supply, mcf.flowMap(), type), 216 typename GR::template ArcMap<typename SM::Value> flow(gr); 217 typename GR::template NodeMap<typename CM::Value> pi(gr); 218 mcf.flowMap(flow); 219 mcf.potentialMap(pi); 220 check(checkFlow(gr, lower, upper, supply, flow, type), 225 221 "The flow is not feasible " + test_id); 226 222 check(mcf.totalCost() == total, "The flow is not optimal " + test_id); 227 check(checkPotential(gr, lower, upper, cost, supply, mcf.flowMap(), 228 mcf.potentialMap()), 223 check(checkPotential(gr, lower, upper, cost, supply, flow, pi), 229 224 "Wrong potentials " + test_id); 230 225 } … … 235 230 // Check the interfaces 236 231 { 237 typedef int Flow;238 typedef int Cost;239 232 typedef concepts::Digraph GR; 240 checkConcept< McfClassConcept<GR, Flow, Cost>, 241 NetworkSimplex<GR, Flow, Cost> >(); 233 checkConcept< McfClassConcept<GR, int, int>, 234 NetworkSimplex<GR> >(); 235 checkConcept< McfClassConcept<GR, double, double>, 236 NetworkSimplex<GR, double> >(); 237 checkConcept< McfClassConcept<GR, int, double>, 238 NetworkSimplex<GR, int, double> >(); 242 239 } 243 240
Note: See TracChangeset
for help on using the changeset viewer.