Add tolerance() functions for MMC classes (#179)
authorPeter Kovacs <kpeter@inf.elte.hu>
Tue, 18 Aug 2009 10:08:28 +0200
changeset 769e746fb14e680
parent 768 0a42883c8221
child 770 432c54cec63c
Add tolerance() functions for MMC classes (#179)
lemon/hartmann_orlin.h
lemon/howard.h
lemon/karp.h
test/min_mean_cycle_test.cc
     1.1 --- a/lemon/hartmann_orlin.h	Wed Aug 12 09:45:15 2009 +0200
     1.2 +++ b/lemon/hartmann_orlin.h	Tue Aug 18 10:08:28 2009 +0200
     1.3 @@ -282,6 +282,24 @@
     1.4        return *this;
     1.5      }
     1.6  
     1.7 +    /// \brief Set the tolerance used by the algorithm.
     1.8 +    ///
     1.9 +    /// This function sets the tolerance object used by the algorithm.
    1.10 +    ///
    1.11 +    /// \return <tt>(*this)</tt>
    1.12 +    HartmannOrlin& tolerance(const Tolerance& tolerance) {
    1.13 +      _tolerance = tolerance;
    1.14 +      return *this;
    1.15 +    }
    1.16 +
    1.17 +    /// \brief Return a const reference to the tolerance.
    1.18 +    ///
    1.19 +    /// This function returns a const reference to the tolerance object
    1.20 +    /// used by the algorithm.
    1.21 +    const Tolerance& tolerance() const {
    1.22 +      return _tolerance;
    1.23 +    }
    1.24 +
    1.25      /// \name Execution control
    1.26      /// The simplest way to execute the algorithm is to call the \ref run()
    1.27      /// function.\n
     2.1 --- a/lemon/howard.h	Wed Aug 12 09:45:15 2009 +0200
     2.2 +++ b/lemon/howard.h	Tue Aug 18 10:08:28 2009 +0200
     2.3 @@ -273,6 +273,24 @@
     2.4        return *this;
     2.5      }
     2.6  
     2.7 +    /// \brief Set the tolerance used by the algorithm.
     2.8 +    ///
     2.9 +    /// This function sets the tolerance object used by the algorithm.
    2.10 +    ///
    2.11 +    /// \return <tt>(*this)</tt>
    2.12 +    Howard& tolerance(const Tolerance& tolerance) {
    2.13 +      _tolerance = tolerance;
    2.14 +      return *this;
    2.15 +    }
    2.16 +
    2.17 +    /// \brief Return a const reference to the tolerance.
    2.18 +    ///
    2.19 +    /// This function returns a const reference to the tolerance object
    2.20 +    /// used by the algorithm.
    2.21 +    const Tolerance& tolerance() const {
    2.22 +      return _tolerance;
    2.23 +    }
    2.24 +
    2.25      /// \name Execution control
    2.26      /// The simplest way to execute the algorithm is to call the \ref run()
    2.27      /// function.\n
     3.1 --- a/lemon/karp.h	Wed Aug 12 09:45:15 2009 +0200
     3.2 +++ b/lemon/karp.h	Tue Aug 18 10:08:28 2009 +0200
     3.3 @@ -278,6 +278,24 @@
     3.4        return *this;
     3.5      }
     3.6  
     3.7 +    /// \brief Set the tolerance used by the algorithm.
     3.8 +    ///
     3.9 +    /// This function sets the tolerance object used by the algorithm.
    3.10 +    ///
    3.11 +    /// \return <tt>(*this)</tt>
    3.12 +    Karp& tolerance(const Tolerance& tolerance) {
    3.13 +      _tolerance = tolerance;
    3.14 +      return *this;
    3.15 +    }
    3.16 +
    3.17 +    /// \brief Return a const reference to the tolerance.
    3.18 +    ///
    3.19 +    /// This function returns a const reference to the tolerance object
    3.20 +    /// used by the algorithm.
    3.21 +    const Tolerance& tolerance() const {
    3.22 +      return _tolerance;
    3.23 +    }
    3.24 +
    3.25      /// \name Execution control
    3.26      /// The simplest way to execute the algorithm is to call the \ref run()
    3.27      /// function.\n
     4.1 --- a/test/min_mean_cycle_test.cc	Wed Aug 12 09:45:15 2009 +0200
     4.2 +++ b/test/min_mean_cycle_test.cc	Tue Aug 18 10:08:28 2009 +0200
     4.3 @@ -78,6 +78,9 @@
     4.4        MmcAlg mmc(me.g, me.length);
     4.5        const MmcAlg& const_mmc = mmc;
     4.6        
     4.7 +      typename MmcAlg::Tolerance tol = const_mmc.tolerance();
     4.8 +      mmc.tolerance(tol);
     4.9 +      
    4.10        b = mmc.cycle(p).run();
    4.11        b = mmc.findMinMean();
    4.12        b = mmc.findCycle();