src/work/athos/minlength_demo.cc
author alpar
Thu, 22 Jul 2004 20:06:40 +0000
changeset 733 240003bddaff
parent 511 325c9430723e
child 921 818510fa3d99
permissions -rw-r--r--
Check StaticGraphSkeleton, as well.
athos@511
     1
#include <iostream>
athos@511
     2
#include <fstream>
athos@511
     3
athos@511
     4
#include <list_graph.h>
athos@607
     5
#include <hugo/dimacs.h>
athos@607
     6
#include <hugo/time_measure.h>
athos@607
     7
#include "minlengthpaths.h"
athos@511
     8
//#include <time_measure.h>
athos@511
     9
athos@511
    10
using namespace hugo;
athos@511
    11
athos@511
    12
// Use a DIMACS max flow file as stdin.
athos@511
    13
// read_dimacs_demo < dimacs_max_flow_file
athos@511
    14
int main(int argc, char ** argv) {
athos@511
    15
  typedef ListGraph Graph;
athos@511
    16
athos@511
    17
  typedef Graph::Node Node;
athos@511
    18
  //typedef Graph::EachEdgeIt EachEdgeIt;
athos@511
    19
athos@511
    20
  Graph G;
athos@511
    21
  Node s, t;
athos@511
    22
  Graph::EdgeMap<int> cap(G);
athos@607
    23
  readDimacs(std::cin, G, cap, s, t);
athos@511
    24
athos@607
    25
  std::cout << "Minlengthpaths demo (ATHOS)..." << std::endl;
athos@511
    26
  //Graph::EdgeMap<int> flow(G); //0 flow
athos@511
    27
athos@511
    28
  //  double pre_time=currTime();
athos@511
    29
athos@511
    30
  int k=1;
athos@511
    31
  if (argc>1)
athos@511
    32
    k = atoi(argv[1]);
athos@511
    33
  MinLengthPaths<Graph, Graph::EdgeMap<int> >
athos@511
    34
    surb_test(G,cap);
athos@607
    35
  Timer ts;
athos@607
    36
  ts.reset();
athos@607
    37
  std::cout << "Number of found paths: " << surb_test.run(s,t,k) << std::endl;
athos@607
    38
  std::cout << "elapsed time: " << ts << std::endl;
athos@607
    39
  
athos@607
    40
  std::cout << "Total length of found paths: " << surb_test.totalLength() << std::endl;
athos@607
    41
  //std::cout << (surb_test.checkComplementarySlackness() ? "OK (compl. slackn.)." : "Problem (compl. slackn.)!!!") << std::endl;
athos@607
    42
athos@511
    43
  //preflow_push<Graph, int> max_flow_test(G, s, t, cap);
athos@511
    44
  //int flow_value=max_flow_test.run();
athos@511
    45
athos@511
    46
  //double post_time=currTime();
athos@511
    47
athos@511
    48
  //std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
athos@511
    49
  //std::cout << "flow value: "<< flow_value << std::endl;
athos@511
    50
athos@511
    51
  return 0;
athos@511
    52
}