COIN-OR::LEMON - Graph Library

Changeset 718:75d36edc6bc4 in lemon-0.x for src/benchmark/hcube.cc


Ignore:
Timestamp:
07/21/04 09:03:20 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@970
Message:

Ready to run the first test series.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/hcube.cc

    r711 r718  
    55#include<hugo/smart_graph.h>
    66#include<hugo/dijkstra.h>
    7 #include<hugo/time_measure.h>
    8 #include<iostream>
    9 //#include<../work/jacint/max_flow.h>
     7#include<../work/jacint/max_flow_no_stack.h>
    108#include"bench_tools.h"
    119
     
    2422  for(int i=0;i<bits[dim];i++) {
    2523    nodes.push_back(G.addNode());
    26     for(j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[i-bits[j]],nodes[i]);
     24    for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[i-bits[j]],nodes[i]);
    2725  }
    2826}
     
    4745}
    4846
     47inline int numOfOnes(int n,int dim)
     48{
     49  int s=0;
     50  for(int i=0;i<dim;i++) {
     51    s+=n%2;
     52    n>>=1;
     53  }
     54  return s;
     55}
     56
     57inline int numOfZeros(int n,int dim)
     58{
     59  int s=dim;
     60  for(int i=0;i<dim;i++) {
     61    s-=n&1;
     62    n>>=1;
     63  }
     64  return s;
     65}
     66
    4967int main(int argc, char *argv[])
    5068{
     
    6684  int dim=atoi(argv[1]);
    6785 
    68   cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
    69        << dim*(1<<dim) << " edges):";
     86//   cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
     87//        << dim*(1<<dim) << " edges):";
    7088
     89  T.reset();
    7190  vector<Node> nodes;
    7291  addBiDirHiperCube(G,dim,nodes);
    73   cout << T;
    74   cout << "\nGenerating the lengths: ";
     92
     93  PrintTime("GENGRAPH",T);
     94
    7595  T.reset();
    7696  Graph::EdgeMap<int> map(G);
     
    83103      //    map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
    84104      map[Edge(((long long int)(i)*93505)%(dim*(1<<dim)))]=P();
     105 
     106//     for(int i=0;i<(1<<dim);i++) {
     107//       int mul= (1<<(numOfZeros(i,dim)/4));
     108//       for(OutEdgeIt e(G,nodes[i]);G.valid(e);G.next(e))
     109//      map[e]*=mul;
     110//     }
    85111  }
    86112 
    87   cout << T;
    88   cout << "\nRunning Dijkstra: ";
     113  PrintTime("GENLENGTHS",T);
     114
    89115  T.reset();
    90116  {
     
    92118    Dij.run(nodes[0]);
    93119  }
    94   cout << T;
    95 //   cout << "\nRunning MaxFlow: ";
    96 //   T.reset();
    97 //   {
    98 //    Graph::EdgeMap<int> flow(G);
     120  PrintTime("DIJKSTRA",T);
     121
     122  T.reset();
     123  {
     124   Graph::EdgeMap<int> flow(G);
    99125   
    100 //     MaxFlow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
    101 //     MF.run(MF.NO_FLOW);
    102 //   }
    103 //   cout << T;
    104   cout << "\n";
     126    MaxFlowNoStack<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
     127    MF.run(MF.NO_FLOW);
     128  }
     129  PrintTime("PREFLOW",T);
     130
    105131}
Note: See TracChangeset for help on using the changeset viewer.