# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1225228851 3600
# Node ID 39ff10276621ccdf7d74451efba324da4253b626
# Parent 2f64c4a692a87056623c6fffafd76432806ee593
Apply the unifier script to the Suurballe related files
diff git a/lemon/suurballe.h b/lemon/suurballe.h
a

b


1   /* * C++ * 
 1  /* * mode: C++; indenttabsmode: nil; * 
2  2  * 
3   * This file is a part of LEMON, a generic C++ optimization library 
 3  * This file is a part of LEMON, a generic C++ optimization library. 
4  4  * 
5  5  * Copyright (C) 20032008 
6  6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 
… 
… 

53  53  /// with \ref SplitDigraphAdaptor. 
54  54  /// 
55  55  /// \author Attila Bernath and Peter Kovacs 
56   
57   template < typename Digraph, 
 56  
 57  template < typename Digraph, 
58  58  typename LengthMap = typename Digraph::template ArcMap<int> > 
59  59  class Suurballe 
60  60  { 
… 
… 

74  74  typedef SimplePath<Digraph> Path; 
75  75  
76  76  private: 
77   
 77  
78  78  /// \brief Special implementation of the \ref Dijkstra algorithm 
79  79  /// for finding shortest paths in the residual network. 
80  80  /// 
… 
… 

104  104  PredMap &_pred; 
105  105  // The processed (i.e. permanently labeled) nodes 
106  106  std::vector<Node> _proc_nodes; 
107   
 107  
108  108  Node _s; 
109  109  Node _t; 
110  110  
… 
… 

198  198  const Digraph &_graph; 
199  199  // The length map 
200  200  const LengthMap &_length; 
201   
 201  
202  202  // Arc map of the current flow 
203  203  FlowMap *_flow; 
204  204  bool _local_flow; 
… 
… 

266  266  /// 
267  267  /// Sets the potential map. 
268  268  /// 
269   /// The potentials provide the dual solution of the underlying 
 269  /// The potentials provide the dual solution of the underlying 
270  270  /// minimum cost flow problem. 
271  271  /// 
272  272  /// \return \c (*this) 
… 
… 

328  328  for (ArcIt e(_graph); e != INVALID; ++e) (*_flow)[e] = 0; 
329  329  for (NodeIt n(_graph); n != INVALID; ++n) (*_potential)[n] = 0; 
330  330  
331   _dijkstra = new ResidualDijkstra( _graph, *_flow, _length, 
 331  _dijkstra = new ResidualDijkstra( _graph, *_flow, _length, 
332  332  *_potential, _pred, 
333  333  _source, _target ); 
334  334  } 
… 
… 

368  368  } 
369  369  return _path_num; 
370  370  } 
371   
 371  
372  372  /// \brief Computes the paths from the flow. 
373  373  /// 
374  374  /// Computes the paths from the flow. 
… 
… 

420  420  /// found potentials (the dual solution). 
421  421  /// 
422  422  /// Returns a const reference to the node map storing the found 
423   /// potentials that provide the dual solution of the underlying 
 423  /// potentials that provide the dual solution of the underlying 
424  424  /// minimum cost flow problem. 
425  425  /// 
426  426  /// \pre \ref run() or findFlow() must be called before using this 
diff git a/test/suurballe_test.cc b/test/suurballe_test.cc
a

b


1   /* * C++ * 
 1  /* * mode: C++; indenttabsmode: nil; * 
2  2  * 
3   * This file is a part of LEMON, a generic C++ optimization library 
 3  * This file is a part of LEMON, a generic C++ optimization library. 
4  4  * 
5  5  * Copyright (C) 20032008 
6  6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 
… 
… 

30  30  
31  31  // Checks the feasibility of the flow 
32  32  template <typename Digraph, typename FlowMap> 
33   bool checkFlow( const Digraph& gr, const FlowMap& flow, 
 33  bool checkFlow( const Digraph& gr, const FlowMap& flow, 
34  34  typename Digraph::Node s, typename Digraph::Node t, 
35  35  int value ) 
36  36  { 
… 
… 

53  53  } 
54  54  
55  55  // Checks the optimalitiy of the flow 
56   template < typename Digraph, typename CostMap, 
 56  template < typename Digraph, typename CostMap, 
57  57  typename FlowMap, typename PotentialMap > 
58  58  bool checkOptimality( const Digraph& gr, const CostMap& cost, 
59  59  const FlowMap& flow, const PotentialMap& pi ) 
… 
… 

110  110  node("target", target). 
111  111  run(); 
112  112  input.close(); 
113   
 113  
114  114  // Finding 2 paths 
115  115  { 
116  116  Suurballe<ListDigraph> suurballe(digraph, length, source, target); 
… 
… 

118  118  check(checkFlow(digraph, suurballe.flowMap(), source, target, 2), 
119  119  "The flow is not feasible"); 
120  120  check(suurballe.totalLength() == 510, "The flow is not optimal"); 
121   check(checkOptimality(digraph, length, suurballe.flowMap(), 
 121  check(checkOptimality(digraph, length, suurballe.flowMap(), 
122  122  suurballe.potentialMap()), 
123  123  "Wrong potentials"); 
124  124  for (int i = 0; i < suurballe.pathNum(); ++i) 
… 
… 

133  133  check(checkFlow(digraph, suurballe.flowMap(), source, target, 3), 
134  134  "The flow is not feasible"); 
135  135  check(suurballe.totalLength() == 1040, "The flow is not optimal"); 
136   check(checkOptimality(digraph, length, suurballe.flowMap(), 
 136  check(checkOptimality(digraph, length, suurballe.flowMap(), 
137  137  suurballe.potentialMap()), 
138  138  "Wrong potentials"); 
139  139  for (int i = 0; i < suurballe.pathNum(); ++i) 
… 
… 

148  148  check(checkFlow(digraph, suurballe.flowMap(), source, target, 3), 
149  149  "The flow is not feasible"); 
150  150  check(suurballe.totalLength() == 1040, "The flow is not optimal"); 
151   check(checkOptimality(digraph, length, suurballe.flowMap(), 
 151  check(checkOptimality(digraph, length, suurballe.flowMap(), 
152  152  suurballe.potentialMap()), 
153  153  "Wrong potentials"); 
154  154  for (int i = 0; i < suurballe.pathNum(); ++i) 