# HG changeset patch # User Peter Kovacs # Date 1250582908 -7200 # Node ID e746fb14e680fe3c63e3c9362cf2c77fba50238e # Parent 0a42883c82217ee3fa7e74b4503eace8048d0af8 Add tolerance() functions for MMC classes (#179) diff -r 0a42883c8221 -r e746fb14e680 lemon/hartmann_orlin.h --- a/lemon/hartmann_orlin.h Wed Aug 12 09:45:15 2009 +0200 +++ b/lemon/hartmann_orlin.h Tue Aug 18 10:08:28 2009 +0200 @@ -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 (*this) + 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 -r 0a42883c8221 -r e746fb14e680 lemon/howard.h --- a/lemon/howard.h Wed Aug 12 09:45:15 2009 +0200 +++ b/lemon/howard.h Tue Aug 18 10:08:28 2009 +0200 @@ -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 (*this) + 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 -r 0a42883c8221 -r e746fb14e680 lemon/karp.h --- a/lemon/karp.h Wed Aug 12 09:45:15 2009 +0200 +++ b/lemon/karp.h Tue Aug 18 10:08:28 2009 +0200 @@ -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 (*this) + 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 -r 0a42883c8221 -r e746fb14e680 test/min_mean_cycle_test.cc --- a/test/min_mean_cycle_test.cc Wed Aug 12 09:45:15 2009 +0200 +++ b/test/min_mean_cycle_test.cc Tue Aug 18 10:08:28 2009 +0200 @@ -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();