diff --git a/lemon/Makefile.am b/lemon/Makefile.am --- a/lemon/Makefile.am +++ b/lemon/Makefile.am @@ -83,6 +83,7 @@ lemon/gomory_hu.h \ lemon/graph_to_eps.h \ lemon/grid_graph.h \ + lemon/howard.h \ lemon/hypercube_graph.h \ lemon/kruskal.h \ lemon/hao_orlin.h \ @@ -97,7 +98,6 @@ lemon/matching.h \ lemon/math.h \ lemon/min_cost_arborescence.h \ - lemon/min_mean_cycle.h \ lemon/nauty_reader.h \ lemon/network_simplex.h \ lemon/path.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 --- a/lemon/min_mean_cycle.h +++ b/lemon/howard.h @@ -16,8 +16,8 @@ * */ -#ifndef LEMON_MIN_MEAN_CYCLE_H -#define LEMON_MIN_MEAN_CYCLE_H +#ifndef LEMON_HOWARD_H +#define LEMON_HOWARD_H /// \ingroup shortest_path /// @@ -33,9 +33,9 @@ namespace lemon { - /// \brief Default traits class of MinMeanCycle class. + /// \brief Default traits class of Howard class. /// - /// Default traits class of MinMeanCycle class. + /// Default traits class of Howard class. /// \tparam GR The type of the digraph. /// \tparam LEN The type of the length map. /// It must conform to the \ref concepts::ReadMap "ReadMap" concept. @@ -45,7 +45,7 @@ template ::is_integer> #endif - struct MinMeanCycleDefaultTraits + struct HowardDefaultTraits { /// The type of the digraph typedef GR Digraph; @@ -75,7 +75,7 @@ // Default traits class for integer value types template - struct MinMeanCycleDefaultTraits + struct HowardDefaultTraits { typedef GR Digraph; typedef LEN LengthMap; @@ -96,8 +96,8 @@ /// \brief Implementation of Howard's algorithm for finding a minimum /// mean cycle. /// - /// \ref MinMeanCycle implements Howard's algorithm for finding a - /// directed cycle of minimum mean length (cost) in a digraph. + /// This class implements Howard's policy iteration algorithm for finding + /// a directed cycle of minimum mean length (cost) in a digraph. /// /// \tparam GR The type of the digraph the algorithm runs on. /// \tparam LEN The type of the length map. The default @@ -107,9 +107,9 @@ #else template < typename GR, typename LEN = typename GR::template ArcMap, - typename TR = MinMeanCycleDefaultTraits > + typename TR = HowardDefaultTraits > #endif - class MinMeanCycle + class Howard { public: @@ -123,7 +123,7 @@ /// \brief The large value type /// /// The large value type used for internal computations. - /// Using the \ref MinMeanCycleDefaultTraits "default traits class", + /// Using the \ref HowardDefaultTraits "default traits class", /// it is \c long \c long if the \c Value type is integer, /// otherwise it is \c double. typedef typename TR::LargeValue LargeValue; @@ -134,11 +134,11 @@ /// \brief The path type of the found cycles /// /// The path type of the found cycles. - /// Using the \ref MinMeanCycleDefaultTraits "default traits class", + /// Using the \ref HowardDefaultTraits "default traits class", /// it is \ref lemon::Path "Path". typedef typename TR::Path Path; - /// The \ref MinMeanCycleDefaultTraits "traits class" of the algorithm + /// The \ref HowardDefaultTraits "traits class" of the algorithm typedef TR Traits; private: @@ -196,8 +196,8 @@ /// type. It is used for internal computations in the algorithm. template struct SetLargeValue - : public MinMeanCycle > { - typedef MinMeanCycle > Create; + : public Howard > { + typedef Howard > Create; }; template @@ -214,8 +214,8 @@ /// and it must have an \c addBack() function. template struct SetPath - : public MinMeanCycle > { - typedef MinMeanCycle > Create; + : public Howard > { + typedef Howard > Create; }; /// @} @@ -228,15 +228,15 @@ /// /// \param digraph The digraph the algorithm runs on. /// \param length The lengths (costs) of the arcs. - MinMeanCycle( const Digraph &digraph, - const LengthMap &length ) : + Howard( const Digraph &digraph, + const LengthMap &length ) : _gr(digraph), _length(length), _cycle_path(NULL), _local_path(false), _policy(digraph), _reached(digraph), _level(digraph), _dist(digraph), _comp(digraph), _in_arcs(digraph) {} /// Destructor. - ~MinMeanCycle() { + ~Howard() { if (_local_path) delete _cycle_path; } @@ -254,7 +254,7 @@ /// "addBack()" function of the given path structure. /// /// \return (*this) - MinMeanCycle& cycle(Path &path) { + Howard& cycle(Path &path) { if (_local_path) { delete _cycle_path; _local_path = false; @@ -559,10 +559,10 @@ return improved; } - }; //class MinMeanCycle + }; //class Howard ///@} } //namespace lemon -#endif //LEMON_MIN_MEAN_CYCLE_H +#endif //LEMON_HOWARD_H diff --git a/test/min_mean_cycle_test.cc b/test/min_mean_cycle_test.cc --- a/test/min_mean_cycle_test.cc +++ b/test/min_mean_cycle_test.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -141,8 +141,8 @@ // Check the interface { typedef concepts::Digraph GR; - typedef MinMeanCycle > IntMmcAlg; - typedef MinMeanCycle > FloatMmcAlg; + typedef Howard > IntMmcAlg; + typedef Howard > FloatMmcAlg; checkConcept, IntMmcAlg>(); checkConcept, FloatMmcAlg>(); @@ -174,10 +174,10 @@ arcMap("c4", c4). run(); - checkMmcAlg >(gr, l1, c1, 6, 3); - checkMmcAlg >(gr, l2, c2, 5, 2); - checkMmcAlg >(gr, l3, c3, 0, 1); - checkMmcAlg >(gr, l4, c4, -1, 1); + checkMmcAlg >(gr, l1, c1, 6, 3); + checkMmcAlg >(gr, l2, c2, 5, 2); + checkMmcAlg >(gr, l3, c3, 0, 1); + checkMmcAlg >(gr, l4, c4, -1, 1); } return 0;