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