Ticket #179: 179-7-rename-f2f32caf7d14.patch
File 179-7-rename-f2f32caf7d14.patch, 7.0 KB (added by , 15 years ago) |
---|
-
lemon/Makefile.am
# HG changeset patch # User Peter Kovacs <kpeter@inf.elte.hu> # Date 1249908657 -7200 # Node ID f2f32caf7d145c66cfbddb3d5e9999806cbd98fb # Parent e5b1b18cf0648b8b53fea352898f25ea0b0d90c6 Rename MinMeanCycle to Howard (#179) diff --git a/lemon/Makefile.am b/lemon/Makefile.am
a b 83 83 lemon/gomory_hu.h \ 84 84 lemon/graph_to_eps.h \ 85 85 lemon/grid_graph.h \ 86 lemon/howard.h \ 86 87 lemon/hypercube_graph.h \ 87 88 lemon/kruskal.h \ 88 89 lemon/hao_orlin.h \ … … 97 98 lemon/matching.h \ 98 99 lemon/math.h \ 99 100 lemon/min_cost_arborescence.h \ 100 lemon/min_mean_cycle.h \101 101 lemon/nauty_reader.h \ 102 102 lemon/network_simplex.h \ 103 103 lemon/path.h \ -
.h
diff --git a/lemon/min_mean_cycle.h b/lemon/howard.h rename from lemon/min_mean_cycle.h rename to lemon/howard.h
old new 16 16 * 17 17 */ 18 18 19 #ifndef LEMON_ MIN_MEAN_CYCLE_H20 #define LEMON_ MIN_MEAN_CYCLE_H19 #ifndef LEMON_HOWARD_H 20 #define LEMON_HOWARD_H 21 21 22 22 /// \ingroup shortest_path 23 23 /// … … 32 32 33 33 namespace lemon { 34 34 35 /// \brief Default traits class of MinMeanCycleclass.35 /// \brief Default traits class of Howard class. 36 36 /// 37 /// Default traits class of MinMeanCycleclass.37 /// Default traits class of Howard class. 38 38 /// \tparam GR The type of the digraph. 39 39 /// \tparam LEN The type of the length map. 40 40 /// It must conform to the \ref concepts::ReadMap "ReadMap" concept. … … 44 44 template <typename GR, typename LEN, 45 45 bool integer = std::numeric_limits<typename LEN::Value>::is_integer> 46 46 #endif 47 struct MinMeanCycleDefaultTraits47 struct HowardDefaultTraits 48 48 { 49 49 /// The type of the digraph 50 50 typedef GR Digraph; … … 74 74 75 75 // Default traits class for integer value types 76 76 template <typename GR, typename LEN> 77 struct MinMeanCycleDefaultTraits<GR, LEN, true>77 struct HowardDefaultTraits<GR, LEN, true> 78 78 { 79 79 typedef GR Digraph; 80 80 typedef LEN LengthMap; … … 95 95 /// \brief Implementation of Howard's algorithm for finding a minimum 96 96 /// mean cycle. 97 97 /// 98 /// \ref MinMeanCycle implements Howard's algorithm for finding a99 /// directed cycle of minimum mean length (cost) in a digraph.98 /// This class implements Howard's policy iteration algorithm for finding 99 /// a directed cycle of minimum mean length (cost) in a digraph. 100 100 /// 101 101 /// \tparam GR The type of the digraph the algorithm runs on. 102 102 /// \tparam LEN The type of the length map. The default … … 106 106 #else 107 107 template < typename GR, 108 108 typename LEN = typename GR::template ArcMap<int>, 109 typename TR = MinMeanCycleDefaultTraits<GR, LEN> >109 typename TR = HowardDefaultTraits<GR, LEN> > 110 110 #endif 111 class MinMeanCycle111 class Howard 112 112 { 113 113 public: 114 114 … … 122 122 /// \brief The large value type 123 123 /// 124 124 /// The large value type used for internal computations. 125 /// Using the \ref MinMeanCycleDefaultTraits "default traits class",125 /// Using the \ref HowardDefaultTraits "default traits class", 126 126 /// it is \c long \c long if the \c Value type is integer, 127 127 /// otherwise it is \c double. 128 128 typedef typename TR::LargeValue LargeValue; … … 133 133 /// \brief The path type of the found cycles 134 134 /// 135 135 /// The path type of the found cycles. 136 /// Using the \ref MinMeanCycleDefaultTraits "default traits class",136 /// Using the \ref HowardDefaultTraits "default traits class", 137 137 /// it is \ref lemon::Path "Path<Digraph>". 138 138 typedef typename TR::Path Path; 139 139 140 /// The \ref MinMeanCycleDefaultTraits "traits class" of the algorithm140 /// The \ref HowardDefaultTraits "traits class" of the algorithm 141 141 typedef TR Traits; 142 142 143 143 private: … … 195 195 /// type. It is used for internal computations in the algorithm. 196 196 template <typename T> 197 197 struct SetLargeValue 198 : public MinMeanCycle<GR, LEN, SetLargeValueTraits<T> > {199 typedef MinMeanCycle<GR, LEN, SetLargeValueTraits<T> > Create;198 : public Howard<GR, LEN, SetLargeValueTraits<T> > { 199 typedef Howard<GR, LEN, SetLargeValueTraits<T> > Create; 200 200 }; 201 201 202 202 template <typename T> … … 213 213 /// and it must have an \c addBack() function. 214 214 template <typename T> 215 215 struct SetPath 216 : public MinMeanCycle<GR, LEN, SetPathTraits<T> > {217 typedef MinMeanCycle<GR, LEN, SetPathTraits<T> > Create;216 : public Howard<GR, LEN, SetPathTraits<T> > { 217 typedef Howard<GR, LEN, SetPathTraits<T> > Create; 218 218 }; 219 219 220 220 /// @} … … 227 227 /// 228 228 /// \param digraph The digraph the algorithm runs on. 229 229 /// \param length The lengths (costs) of the arcs. 230 MinMeanCycle( const Digraph &digraph,231 230 Howard( const Digraph &digraph, 231 const LengthMap &length ) : 232 232 _gr(digraph), _length(length), _cycle_path(NULL), _local_path(false), 233 233 _policy(digraph), _reached(digraph), _level(digraph), _dist(digraph), 234 234 _comp(digraph), _in_arcs(digraph) 235 235 {} 236 236 237 237 /// Destructor. 238 ~ MinMeanCycle() {238 ~Howard() { 239 239 if (_local_path) delete _cycle_path; 240 240 } 241 241 … … 253 253 /// "addBack()" function of the given path structure. 254 254 /// 255 255 /// \return <tt>(*this)</tt> 256 MinMeanCycle& cycle(Path &path) {256 Howard& cycle(Path &path) { 257 257 if (_local_path) { 258 258 delete _cycle_path; 259 259 _local_path = false; … … 558 558 return improved; 559 559 } 560 560 561 }; //class MinMeanCycle561 }; //class Howard 562 562 563 563 ///@} 564 564 565 565 } //namespace lemon 566 566 567 #endif //LEMON_ MIN_MEAN_CYCLE_H567 #endif //LEMON_HOWARD_H -
test/min_mean_cycle_test.cc
diff --git a/test/min_mean_cycle_test.cc b/test/min_mean_cycle_test.cc
a b 21 21 22 22 #include <lemon/smart_graph.h> 23 23 #include <lemon/lgf_reader.h> 24 #include <lemon/ min_mean_cycle.h>24 #include <lemon/howard.h> 25 25 #include <lemon/path.h> 26 26 #include <lemon/concepts/digraph.h> 27 27 #include <lemon/concept_check.h> … … 141 141 // Check the interface 142 142 { 143 143 typedef concepts::Digraph GR; 144 typedef MinMeanCycle<GR, concepts::ReadMap<GR::Arc, int> > IntMmcAlg;145 typedef MinMeanCycle<GR, concepts::ReadMap<GR::Arc, float> > FloatMmcAlg;144 typedef Howard<GR, concepts::ReadMap<GR::Arc, int> > IntMmcAlg; 145 typedef Howard<GR, concepts::ReadMap<GR::Arc, float> > FloatMmcAlg; 146 146 147 147 checkConcept<MmcClassConcept<GR, int>, IntMmcAlg>(); 148 148 checkConcept<MmcClassConcept<GR, float>, FloatMmcAlg>(); … … 174 174 arcMap("c4", c4). 175 175 run(); 176 176 177 checkMmcAlg< MinMeanCycle<GR, IntArcMap> >(gr, l1, c1, 6, 3);178 checkMmcAlg< MinMeanCycle<GR, IntArcMap> >(gr, l2, c2, 5, 2);179 checkMmcAlg< MinMeanCycle<GR, IntArcMap> >(gr, l3, c3, 0, 1);180 checkMmcAlg< MinMeanCycle<GR, IntArcMap> >(gr, l4, c4, -1, 1);177 checkMmcAlg<Howard<GR, IntArcMap> >(gr, l1, c1, 6, 3); 178 checkMmcAlg<Howard<GR, IntArcMap> >(gr, l2, c2, 5, 2); 179 checkMmcAlg<Howard<GR, IntArcMap> >(gr, l3, c3, 0, 1); 180 checkMmcAlg<Howard<GR, IntArcMap> >(gr, l4, c4, -1, 1); 181 181 } 182 182 183 183 return 0;