# HG changeset patch # User marci # Date 1076955331 0 # Node ID 4d6a48fc0a2d7725ccfdaacf166357197664924c # Parent 6c8adcd6b482c62e641014a14f4582ee66b659e1 Can you test more preflow algs? diff -r 6c8adcd6b482 -r 4d6a48fc0a2d src/work/marci/comparison --- a/src/work/marci/comparison Mon Feb 16 16:36:12 2004 +0000 +++ b/src/work/marci/comparison Mon Feb 16 18:15:31 2004 +0000 @@ -1,4 +1,6 @@ -./preflow_demo_leda < flow-1.dim -./preflow_demo_boost < flow-1.dim -./edmonds_karp_demo < flow-1.dim -./edmonds_karp_demo_boost < flow-1.dim \ No newline at end of file +./preflow_demo_leda < $1 +./preflow_demo_boost < $1 +./preflow_demo_jacint < $1 +./preflow_demo_athos < $1 +./edmonds_karp_demo < $1 +./edmonds_karp_demo_boost < $1 diff -r 6c8adcd6b482 -r 4d6a48fc0a2d src/work/marci/makefile --- a/src/work/marci/makefile Mon Feb 16 16:36:12 2004 +0000 +++ b/src/work/marci/makefile Mon Feb 16 18:15:31 2004 +0000 @@ -3,7 +3,7 @@ CXXFLAGS = -W -Wall -ansi -pedantic LEDAROOT = /ledasrc/LEDA-4.1 -BINARIES = edmonds_karp_demo preflow_demo_leda preflow_demo_boost edmonds_karp_demo_boost +BINARIES = edmonds_karp_demo preflow_demo_leda preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos all: $(BINARIES) @@ -27,6 +27,12 @@ edmonds_karp_demo_boost: $(CXX2) -ftemplate-depth-30 -O3 -I. -I/home/marci/boost -o edmonds_karp_demo_boost edmonds_karp_demo_boost.cc +preflow_demo_jacint: + $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_demo_jacint preflow_demo_jacint.cc + +preflow_demo_athos: + $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../athos -o preflow_demo_athos preflow_demo_athos.cc + clean: $(RM) *.o $(BINARIES) .depend diff -r 6c8adcd6b482 -r 4d6a48fc0a2d src/work/marci/preflow_demo_athos.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/preflow_demo_athos.cc Mon Feb 16 18:15:31 2004 +0000 @@ -0,0 +1,44 @@ +#include +#include + +#include +#include +#include +#include + +using namespace marci; + +// Use a DIMACS max flow file as stdin. +// read_dimacs_demo < dimacs_max_flow_file +int main(int, char **) { + typedef ListGraph::NodeIt NodeIt; + typedef ListGraph::EachEdgeIt EachEdgeIt; + + ListGraph G; + NodeIt s, t; + ListGraph::EdgeMap cap(G); + readDimacsMaxFlow(std::cin, G, s, t, cap); + + std::cout << "preflow demo (ATHOS)..." << std::endl; + //ListGraph::EdgeMap flow(G); //0 flow + + double pre_time=currTime(); + preflow_push max_flow_test(G, s, t, cap); + int flow_value=max_flow_test.run(); + //ListGraph::NodeMap cut=max_flow_test.mincut(); + //int cut_value=0; + //for(EachEdgeIt e=G.first(); e.valid(); ++e) { + // if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e); + //} + double post_time=currTime(); + //std::cout << "maximum flow: "<< std::endl; + //for(EachEdgeIt e=G.first(); e.valid(); ++e) { + // std::cout<<"("<"< +#include + +#include +#include +#include +#include + +using namespace marci; + +// Use a DIMACS max flow file as stdin. +// read_dimacs_demo < dimacs_max_flow_file +int main(int, char **) { + typedef ListGraph::NodeIt NodeIt; + typedef ListGraph::EachEdgeIt EachEdgeIt; + + ListGraph G; + NodeIt s, t; + ListGraph::EdgeMap cap(G); + readDimacsMaxFlow(std::cin, G, s, t, cap); + + std::cout << "preflow demo (JACINT)..." << std::endl; + //ListGraph::EdgeMap flow(G); //0 flow + + double pre_time=currTime(); + preflow_push_max_flow max_flow_test(G, s, t, cap); + max_flow_test.run(); + ListGraph::NodeMap cut=max_flow_test.mincut(); + int cut_value=0; + for(EachEdgeIt e=G.first(); e.valid(); ++e) { + if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e); + } + double post_time=currTime(); + //std::cout << "maximum flow: "<< std::endl; + //for(EachEdgeIt e=G.first(); e.valid(); ++e) { + // std::cout<<"("<"<