[Lemon-commits] Peter Kovacs: Add tolerance() functions for MMC ...

Lemon HG hg at lemon.cs.elte.hu
Thu Nov 5 08:59:58 CET 2009


details:   http://lemon.cs.elte.hu/hg/lemon/rev/e746fb14e680
changeset: 829:e746fb14e680
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Tue Aug 18 10:08:28 2009 +0200
description:
	Add tolerance() functions for MMC classes (#179)

diffstat:

 lemon/hartmann_orlin.h      |  18 ++++++++++++++++++
 lemon/howard.h              |  18 ++++++++++++++++++
 lemon/karp.h                |  18 ++++++++++++++++++
 test/min_mean_cycle_test.cc |   3 +++
 4 files changed, 57 insertions(+), 0 deletions(-)

diffs (97 lines):

diff --git a/lemon/hartmann_orlin.h b/lemon/hartmann_orlin.h
--- a/lemon/hartmann_orlin.h
+++ b/lemon/hartmann_orlin.h
@@ -282,6 +282,24 @@
       return *this;
     }
 
+    /// \brief Set the tolerance used by the algorithm.
+    ///
+    /// This function sets the tolerance object used by the algorithm.
+    ///
+    /// \return <tt>(*this)</tt>
+    HartmannOrlin& tolerance(const Tolerance& tolerance) {
+      _tolerance = tolerance;
+      return *this;
+    }
+
+    /// \brief Return a const reference to the tolerance.
+    ///
+    /// This function returns a const reference to the tolerance object
+    /// used by the algorithm.
+    const Tolerance& tolerance() const {
+      return _tolerance;
+    }
+
     /// \name Execution control
     /// The simplest way to execute the algorithm is to call the \ref run()
     /// function.\n
diff --git a/lemon/howard.h b/lemon/howard.h
--- a/lemon/howard.h
+++ b/lemon/howard.h
@@ -273,6 +273,24 @@
       return *this;
     }
 
+    /// \brief Set the tolerance used by the algorithm.
+    ///
+    /// This function sets the tolerance object used by the algorithm.
+    ///
+    /// \return <tt>(*this)</tt>
+    Howard& tolerance(const Tolerance& tolerance) {
+      _tolerance = tolerance;
+      return *this;
+    }
+
+    /// \brief Return a const reference to the tolerance.
+    ///
+    /// This function returns a const reference to the tolerance object
+    /// used by the algorithm.
+    const Tolerance& tolerance() const {
+      return _tolerance;
+    }
+
     /// \name Execution control
     /// The simplest way to execute the algorithm is to call the \ref run()
     /// function.\n
diff --git a/lemon/karp.h b/lemon/karp.h
--- a/lemon/karp.h
+++ b/lemon/karp.h
@@ -278,6 +278,24 @@
       return *this;
     }
 
+    /// \brief Set the tolerance used by the algorithm.
+    ///
+    /// This function sets the tolerance object used by the algorithm.
+    ///
+    /// \return <tt>(*this)</tt>
+    Karp& tolerance(const Tolerance& tolerance) {
+      _tolerance = tolerance;
+      return *this;
+    }
+
+    /// \brief Return a const reference to the tolerance.
+    ///
+    /// This function returns a const reference to the tolerance object
+    /// used by the algorithm.
+    const Tolerance& tolerance() const {
+      return _tolerance;
+    }
+
     /// \name Execution control
     /// The simplest way to execute the algorithm is to call the \ref run()
     /// function.\n
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
@@ -78,6 +78,9 @@
       MmcAlg mmc(me.g, me.length);
       const MmcAlg& const_mmc = mmc;
       
+      typename MmcAlg::Tolerance tol = const_mmc.tolerance();
+      mmc.tolerance(tol);
+      
       b = mmc.cycle(p).run();
       b = mmc.findMinMean();
       b = mmc.findCycle();



More information about the Lemon-commits mailing list