COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/preflow_param.cc @ 116:a987c6013ea0

Last change on this file since 116:a987c6013ea0 was 109:fc5982b39e10, checked in by jacint, 21 years ago

Flows with test files. The best is preflow.h

File size: 1.0 KB
Line 
1#include <iostream>
2#include <fstream>
3
4#include <list_graph.hh>
5#include <dimacs.hh>
6#include <preflow_param.h>
7#include <time_measure.h>
8
9using namespace hugo;
10
11// Use a DIMACS max flow file as stdin.
12// read_dimacs_demo < dimacs_max_flow_file
13int main(int, char **) {
14  typedef ListGraph::NodeIt NodeIt;
15  typedef ListGraph::EachEdgeIt EachEdgeIt;
16
17  ListGraph G;
18  NodeIt s, t;
19  ListGraph::EdgeMap<int> cap(G);
20  readDimacsMaxFlow(std::cin, G, s, t, cap);
21
22  std::cout << "preflow parameters test ..." << std::endl;
23
24  double min=1000000; 
25
26  int _j=0;
27  int _k=0;
28
29  for (int j=1; j!=40; ++j ){
30    for (int k=1; k!=j; ++k ){
31     
32      double mintime=1000000;
33
34      for ( int i=1; i!=4; ++i ) {
35        double pre_time=currTime();
36        preflow_param<ListGraph, int> max_flow_test(G, s, t, cap, j, k);
37        double post_time=currTime();
38        if ( mintime > post_time-pre_time ) mintime = post_time-pre_time;
39      }
40      if (min > mintime ) {min=mintime; _j=j; _k=k;}
41    }
42  }
43
44  std::cout<<"Min. at ("<<_j<<","<<_k<<") in time "<<min<<std::endl;
45 
46  return 0;
47}
Note: See TracBrowser for help on using the repository browser.