COIN-OR::LEMON - Graph Library

Changeset 940:50a153b08f07 in lemon-0.x


Ignore:
Timestamp:
10/07/04 19:21:27 (15 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1282
Message:

Coding style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/preflow_test.cc

    r921 r940  
    4040  typedef Preflow<Graph, int, CapMap, FlowMap> PType;
    4141
    42   Graph G;
     42  Graph g;
    4343  Node n;
    4444  CapMap cap;
     
    4646  CutMap cut;
    4747
    48   PType preflow_test(G,n,n,cap,flow);
     48  PType preflow_test(g,n,n,cap,flow);
    4949
    5050  preflow_test.run();
     
    6363}
    6464
    65 int cut_value ( SmartGraph& G, SmartGraph::NodeMap<bool>& cut,
     65int cut_value ( SmartGraph& g, SmartGraph::NodeMap<bool>& cut,
    6666                SmartGraph::EdgeMap<int>& cap) {
    6767 
    6868  int c=0;
    69   for(SmartGraph::EdgeIt e(G); e!=INVALID; ++e) {
    70     if (cut[G.tail(e)] && !cut[G.head(e)]) c+=cap[e];
     69  for(SmartGraph::EdgeIt e(g); e!=INVALID; ++e) {
     70    if (cut[g.tail(e)] && !cut[g.head(e)]) c+=cap[e];
    7171  }
    7272  return c;
     
    9898  check(file, "Input file '" << f_name << "' not found.");
    9999 
    100   Graph G;
     100  Graph g;
    101101  Node s, t;
    102   CapMap cap(G);
    103   readDimacs(file, G, cap, s, t);
    104 
    105   FlowMap flow(G,0);
     102  CapMap cap(g);
     103  readDimacs(file, g, cap, s, t);
     104
     105  FlowMap flow(g,0);
    106106
    107107 
    108108
    109   PType preflow_test(G, s, t, cap, flow);
     109  PType preflow_test(g, s, t, cap, flow);
    110110  preflow_test.run(PType::ZERO_FLOW);
    111111   
    112   CutMap mincut(G,false);
    113   preflow_test.minCut(mincut);
    114   int min_cut_value=cut_value(G,mincut,cap);
    115    
    116   CutMap minmincut(G,false);
    117   preflow_test.minMinCut(minmincut);
    118   int min_min_cut_value=cut_value(G,minmincut,cap);
    119    
    120   CutMap maxmincut(G,false);
    121   preflow_test.maxMinCut(maxmincut);
    122   int max_min_cut_value=cut_value(G,maxmincut,cap);
     112  CutMap min_cut(g,false);
     113  preflow_test.minCut(min_cut);
     114  int min_cut_value=cut_value(g,min_cut,cap);
     115   
     116  CutMap min_min_cut(g,false);
     117  preflow_test.minMinCut(min_min_cut);
     118  int min_min_cut_value=cut_value(g,min_min_cut,cap);
     119   
     120  CutMap max_min_cut(g,false);
     121  preflow_test.maxMinCut(max_min_cut);
     122  int max_min_cut_value=cut_value(g,max_min_cut,cap);
    123123
    124124  check(preflow_test.flowValue() == min_cut_value &&
     
    131131
    132132
    133   for(EdgeIt e(G); e!=INVALID; ++e) cap[e]=2*cap[e];
     133  for(EdgeIt e(g); e!=INVALID; ++e) cap[e]=2*cap[e];
    134134  preflow_test.setCap(cap); 
    135135
    136136  preflow_test.phase1(PType::PRE_FLOW);
    137137
    138   CutMap mincut1(G,false);
    139   preflow_test.minCut(mincut1);
    140   min_cut_value=cut_value(G,mincut1,cap);
     138  CutMap min_cut1(g,false);
     139  preflow_test.minCut(min_cut1);
     140  min_cut_value=cut_value(g,min_cut1,cap);
    141141   
    142142  check(preflow_test.flowValue() == min_cut_value &&
     
    146146  preflow_test.phase2();
    147147
    148   CutMap mincut2(G,false);
    149   preflow_test.minCut(mincut2);
    150   min_cut_value=cut_value(G,mincut2,cap);
    151    
    152   CutMap minmincut2(G,false);
    153   preflow_test.minMinCut(minmincut2);
    154   min_min_cut_value=cut_value(G,minmincut2,cap);
     148  CutMap min_cut2(g,false);
     149  preflow_test.minCut(min_cut2);
     150  min_cut_value=cut_value(g,min_cut2,cap);
     151   
     152  CutMap min_min_cut2(g,false);
     153  preflow_test.minMinCut(min_min_cut2);
     154  min_min_cut_value=cut_value(g,min_min_cut2,cap);
    155155 
    156   preflow_test.maxMinCut(maxmincut);
    157   max_min_cut_value=cut_value(G,maxmincut,cap);
     156  preflow_test.maxMinCut(max_min_cut);
     157  max_min_cut_value=cut_value(g,max_min_cut,cap);
    158158
    159159  check(preflow_test.flowValue() == min_cut_value &&
     
    165165
    166166
    167   EdgeIt e(G);
     167  EdgeIt e(g);
    168168  for( int i=1; i==10; ++i ) {
    169169    flow.set(e,0);
     
    173173  preflow_test.setFlow(flow);
    174174
    175   NodeIt tmp1(G,s);
     175  NodeIt tmp1(g,s);
    176176  ++tmp1;
    177177  if ( tmp1 != INVALID ) s=tmp1;
    178178
    179   NodeIt tmp2(G,t);
     179  NodeIt tmp2(g,t);
    180180  ++tmp2;
    181181  if ( tmp2 != INVALID ) t=tmp2;
     
    186186  preflow_test.run();
    187187
    188   CutMap mincut3(G,false);
    189   preflow_test.minCut(mincut3);
    190   min_cut_value=cut_value(G,mincut3,cap);
    191    
    192   CutMap minmincut3(G,false);
    193   preflow_test.minMinCut(minmincut3);
    194   min_min_cut_value=cut_value(G,minmincut3,cap);
    195    
    196   preflow_test.maxMinCut(maxmincut);
    197   max_min_cut_value=cut_value(G,maxmincut,cap);
     188  CutMap min_cut3(g,false);
     189  preflow_test.minCut(min_cut3);
     190  min_cut_value=cut_value(g,min_cut3,cap);
     191   
     192  CutMap min_min_cut3(g,false);
     193  preflow_test.minMinCut(min_min_cut3);
     194  min_min_cut_value=cut_value(g,min_min_cut3,cap);
     195   
     196  preflow_test.maxMinCut(max_min_cut);
     197  max_min_cut_value=cut_value(g,max_min_cut,cap);
    198198
    199199  check(preflow_test.flowValue() == min_cut_value &&
Note: See TracChangeset for help on using the changeset viewer.