src/benchmark/hcube.cc
changeset 738 56e60e9eb2da
parent 718 75d36edc6bc4
child 742 235fd36336b7
equal deleted inserted replaced
2:ab934e396eb8 3:4eda1fd69e69
     2 
     2 
     3 #include<math.h>
     3 #include<math.h>
     4 #include<hugo/list_graph.h>
     4 #include<hugo/list_graph.h>
     5 #include<hugo/smart_graph.h>
     5 #include<hugo/smart_graph.h>
     6 #include<hugo/dijkstra.h>
     6 #include<hugo/dijkstra.h>
     7 #include<../work/jacint/max_flow_no_stack.h>
     7 #include<hugo/max_flow.h>
       
     8 
     8 #include"bench_tools.h"
     9 #include"bench_tools.h"
     9 
    10 
    10 using namespace std;
    11 using namespace std;
    11 using namespace hugo;
    12 using namespace hugo;
    12 
    13 
    92 
    93 
    93   PrintTime("GENGRAPH",T);
    94   PrintTime("GENGRAPH",T);
    94 
    95 
    95   T.reset();
    96   T.reset();
    96   Graph::EdgeMap<int> map(G);
    97   Graph::EdgeMap<int> map(G);
    97   {
    98   for(int i=0;i<5;i++) {
    98     Primes P;
    99     Primes P;
    99     for(int i=0;i<dim*(1<<dim);i++) P();
   100     for(int i=0;i<dim*(1<<dim);i++) P();
   100     
   101     
   101     //  for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
   102     //  for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
   102     for(int i=0;i<dim*(1<<dim);i++)
   103     for(int i=0;i<dim*(1<<dim);i++)
   113   PrintTime("GENLENGTHS",T);
   114   PrintTime("GENLENGTHS",T);
   114 
   115 
   115   T.reset();
   116   T.reset();
   116   {
   117   {
   117     Dijkstra<Graph> Dij(G,map);
   118     Dijkstra<Graph> Dij(G,map);
   118     Dij.run(nodes[0]);
   119     for(int i=0;i<10;i++)
       
   120       Dij.run(nodes[0]);
   119   }
   121   }
   120   PrintTime("DIJKSTRA",T);
   122   PrintTime("DIJKSTRA",T);
   121 
   123 
   122   T.reset();
   124   T.reset();
   123   {
   125   {
   124    Graph::EdgeMap<int> flow(G);
   126    Graph::EdgeMap<int> flow(G);
   125    
   127    
   126     MaxFlowNoStack<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
   128     MaxFlow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
   127     MF.run(MF.NO_FLOW);
   129     for(int i=0;i<10;i++)
       
   130       MF.run(MF.NO_FLOW);
   128   }
   131   }
   129   PrintTime("PREFLOW",T);
   132   PrintTime("PREFLOW",T);
   130 
   133 
   131 }
   134 }