COIN-OR::LEMON - Graph Library

Changeset 71:1d8d806ac8e0 in lemon-0.x


Ignore:
Timestamp:
02/12/04 19:11:08 (21 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@87
Message:

read_dimacs_demo: measures elapsed time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/read_dimacs_demo.cc

    r69 r71  
     1#include <sys/time.h>
    12#include <iostream>
    23#include <fstream>
     4
    35#include <list_graph.hh>
    46#include <dimacs.hh>
     
    68
    79using namespace marci;
     10
     11double currTime() {
     12  timeval tv;
     13  //timezone tz;
     14  gettimeofday(&tv, 0);
     15  return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
     16}
    817
    918// Use a DIMACS max flow file as stdin.
     
    2029  std::cout << "augmenting path flow algorithm demo..." << std::endl;
    2130  ListGraph::EdgeMap<int> flow(G); //0 flow
     31
     32  double preTime=currTime();
    2233  MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
    2334  max_flow_test.run();
    24 
     35  double pushTime=currTime();
    2536  std::cout << "maximum flow: "<< std::endl;
    2637  for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
     
    2839  }
    2940  std::cout<<std::endl;
     41  std::cout << "elapsed time: " << pushTime-preTime << " sec"<< std::endl;
    3042  std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    3143
Note: See TracChangeset for help on using the changeset viewer.