Changeset 718:75d36edc6bc4 in lemon0.x for src/benchmark/hcube.cc
 Timestamp:
 07/21/04 09:03:20 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@970
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/benchmark/hcube.cc
r711 r718 5 5 #include<hugo/smart_graph.h> 6 6 #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> 10 8 #include"bench_tools.h" 11 9 … … 24 22 for(int i=0;i<bits[dim];i++) { 25 23 nodes.push_back(G.addNode()); 26 for( j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[ibits[j]],nodes[i]);24 for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[ibits[j]],nodes[i]); 27 25 } 28 26 } … … 47 45 } 48 46 47 inline 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 57 inline 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 49 67 int main(int argc, char *argv[]) 50 68 { … … 66 84 int dim=atoi(argv[1]); 67 85 68 cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "69 << dim*(1<<dim) << " edges):";86 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, " 87 // << dim*(1<<dim) << " edges):"; 70 88 89 T.reset(); 71 90 vector<Node> nodes; 72 91 addBiDirHiperCube(G,dim,nodes); 73 cout << T; 74 cout << "\nGenerating the lengths: "; 92 93 PrintTime("GENGRAPH",T); 94 75 95 T.reset(); 76 96 Graph::EdgeMap<int> map(G); … … 83 103 // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P(); 84 104 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 // } 85 111 } 86 112 87 cout << T;88 cout << "\nRunning Dijkstra: "; 113 PrintTime("GENLENGTHS",T); 114 89 115 T.reset(); 90 116 { … … 92 118 Dij.run(nodes[0]); 93 119 } 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); 99 125 100 // MaxFlow<Graph,int> MF(G,nodes[0],nodes[1<<dim1],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<<dim1],map,flow); 127 MF.run(MF.NO_FLOW); 128 } 129 PrintTime("PREFLOW",T); 130 105 131 }
Note: See TracChangeset
for help on using the changeset viewer.