1.1 --- a/src/work/marci/max_flow_demo.cc Tue Aug 31 13:40:07 2004 +0000
1.2 +++ b/src/work/marci/max_flow_demo.cc Tue Aug 31 17:54:22 2004 +0000
1.3 @@ -1,4 +1,9 @@
1.4 // -*- c++ -*-
1.5 +
1.6 +// Use a DIMACS max flow file as stdin.
1.7 +// max_flow_demo < dimacs_max_flow_file
1.8 +
1.9 +
1.10 #include <iostream>
1.11 #include <fstream>
1.12
1.13 @@ -15,9 +20,6 @@
1.14
1.15 using namespace hugo;
1.16
1.17 -// Use a DIMACS max flow file as stdin.
1.18 -// max_flow_demo < dimacs_max_flow_file
1.19 -
1.20 int main(int, char **) {
1.21
1.22 typedef SageGraph MutableGraph;
1.23 @@ -102,23 +104,23 @@
1.24 }
1.25 }
1.26
1.27 -// {
1.28 -// std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
1.29 -// FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
1.30 -// ts.reset();
1.31 -// int i=0;
1.32 -// while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; }
1.33 -// std::cout << "elapsed time: " << ts << std::endl;
1.34 -// std::cout << "number of augmentation phases: " << i << std::endl;
1.35 -// std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
1.36 + {
1.37 + std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
1.38 + FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
1.39 + ts.reset();
1.40 + int i=0;
1.41 + while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; }
1.42 + std::cout << "elapsed time: " << ts << std::endl;
1.43 + std::cout << "number of augmentation phases: " << i << std::endl;
1.44 + std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
1.45
1.46 -// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
1.47 -// if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
1.48 -// std::cout << "Slackness does not hold!" << std::endl;
1.49 -// if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0)
1.50 -// std::cout << "Slackness does not hold!" << std::endl;
1.51 -// }
1.52 -// }
1.53 + FOR_EACH_LOC(Graph::EdgeIt, e, g) {
1.54 + if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
1.55 + std::cout << "Slackness does not hold!" << std::endl;
1.56 + if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0)
1.57 + std::cout << "Slackness does not hold!" << std::endl;
1.58 + }
1.59 + }
1.60
1.61 {
1.62 std::cout << "on-the-fly shortest path augmentation ..." << std::endl;