COIN-OR::LEMON - Graph Library

Ticket #179: 179-7-rename-f2f32caf7d14.patch

File 179-7-rename-f2f32caf7d14.patch, 7.0 KB (added by Peter Kovacs, 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  
    8383        lemon/gomory_hu.h \
    8484        lemon/graph_to_eps.h \
    8585        lemon/grid_graph.h \
     86        lemon/howard.h \
    8687        lemon/hypercube_graph.h \
    8788        lemon/kruskal.h \
    8889        lemon/hao_orlin.h \
     
    9798        lemon/matching.h \
    9899        lemon/math.h \
    99100        lemon/min_cost_arborescence.h \
    100         lemon/min_mean_cycle.h \
    101101        lemon/nauty_reader.h \
    102102        lemon/network_simplex.h \
    103103        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  
    1616 *
    1717 */
    1818
    19 #ifndef LEMON_MIN_MEAN_CYCLE_H
    20 #define LEMON_MIN_MEAN_CYCLE_H
     19#ifndef LEMON_HOWARD_H
     20#define LEMON_HOWARD_H
    2121
    2222/// \ingroup shortest_path
    2323///
     
    3232
    3333namespace lemon {
    3434
    35   /// \brief Default traits class of MinMeanCycle class.
     35  /// \brief Default traits class of Howard class.
    3636  ///
    37   /// Default traits class of MinMeanCycle class.
     37  /// Default traits class of Howard class.
    3838  /// \tparam GR The type of the digraph.
    3939  /// \tparam LEN The type of the length map.
    4040  /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
     
    4444  template <typename GR, typename LEN,
    4545    bool integer = std::numeric_limits<typename LEN::Value>::is_integer>
    4646#endif
    47   struct MinMeanCycleDefaultTraits
     47  struct HowardDefaultTraits
    4848  {
    4949    /// The type of the digraph
    5050    typedef GR Digraph;
     
    7474
    7575  // Default traits class for integer value types
    7676  template <typename GR, typename LEN>
    77   struct MinMeanCycleDefaultTraits<GR, LEN, true>
     77  struct HowardDefaultTraits<GR, LEN, true>
    7878  {
    7979    typedef GR Digraph;
    8080    typedef LEN LengthMap;
     
    9595  /// \brief Implementation of Howard's algorithm for finding a minimum
    9696  /// mean cycle.
    9797  ///
    98   /// \ref MinMeanCycle implements Howard's algorithm for finding a
    99   /// 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.
    100100  ///
    101101  /// \tparam GR The type of the digraph the algorithm runs on.
    102102  /// \tparam LEN The type of the length map. The default
     
    106106#else
    107107  template < typename GR,
    108108             typename LEN = typename GR::template ArcMap<int>,
    109              typename TR = MinMeanCycleDefaultTraits<GR, LEN> >
     109             typename TR = HowardDefaultTraits<GR, LEN> >
    110110#endif
    111   class MinMeanCycle
     111  class Howard
    112112  {
    113113  public:
    114114 
     
    122122    /// \brief The large value type
    123123    ///
    124124    /// The large value type used for internal computations.
    125     /// Using the \ref MinMeanCycleDefaultTraits "default traits class",
     125    /// Using the \ref HowardDefaultTraits "default traits class",
    126126    /// it is \c long \c long if the \c Value type is integer,
    127127    /// otherwise it is \c double.
    128128    typedef typename TR::LargeValue LargeValue;
     
    133133    /// \brief The path type of the found cycles
    134134    ///
    135135    /// The path type of the found cycles.
    136     /// Using the \ref MinMeanCycleDefaultTraits "default traits class",
     136    /// Using the \ref HowardDefaultTraits "default traits class",
    137137    /// it is \ref lemon::Path "Path<Digraph>".
    138138    typedef typename TR::Path Path;
    139139
    140     /// The \ref MinMeanCycleDefaultTraits "traits class" of the algorithm
     140    /// The \ref HowardDefaultTraits "traits class" of the algorithm
    141141    typedef TR Traits;
    142142
    143143  private:
     
    195195    /// type. It is used for internal computations in the algorithm.
    196196    template <typename T>
    197197    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;
    200200    };
    201201
    202202    template <typename T>
     
    213213    /// and it must have an \c addBack() function.
    214214    template <typename T>
    215215    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;
    218218    };
    219219   
    220220    /// @}
     
    227227    ///
    228228    /// \param digraph The digraph the algorithm runs on.
    229229    /// \param length The lengths (costs) of the arcs.
    230     MinMeanCycle( const Digraph &digraph,
    231                   const LengthMap &length ) :
     230    Howard( const Digraph &digraph,
     231            const LengthMap &length ) :
    232232      _gr(digraph), _length(length), _cycle_path(NULL), _local_path(false),
    233233      _policy(digraph), _reached(digraph), _level(digraph), _dist(digraph),
    234234      _comp(digraph), _in_arcs(digraph)
    235235    {}
    236236
    237237    /// Destructor.
    238     ~MinMeanCycle() {
     238    ~Howard() {
    239239      if (_local_path) delete _cycle_path;
    240240    }
    241241
     
    253253    /// "addBack()" function of the given path structure.
    254254    ///
    255255    /// \return <tt>(*this)</tt>
    256     MinMeanCycle& cycle(Path &path) {
     256    Howard& cycle(Path &path) {
    257257      if (_local_path) {
    258258        delete _cycle_path;
    259259        _local_path = false;
     
    558558      return improved;
    559559    }
    560560
    561   }; //class MinMeanCycle
     561  }; //class Howard
    562562
    563563  ///@}
    564564
    565565} //namespace lemon
    566566
    567 #endif //LEMON_MIN_MEAN_CYCLE_H
     567#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  
    2121
    2222#include <lemon/smart_graph.h>
    2323#include <lemon/lgf_reader.h>
    24 #include <lemon/min_mean_cycle.h>
     24#include <lemon/howard.h>
    2525#include <lemon/path.h>
    2626#include <lemon/concepts/digraph.h>
    2727#include <lemon/concept_check.h>
     
    141141  // Check the interface
    142142  {
    143143    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;
    146146   
    147147    checkConcept<MmcClassConcept<GR, int>, IntMmcAlg>();
    148148    checkConcept<MmcClassConcept<GR, float>, FloatMmcAlg>();
     
    174174      arcMap("c4", c4).
    175175      run();
    176176
    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);
    181181  }
    182182
    183183  return 0;