[Lemon-commits] [lemon_svn] alpar: r2303 - hugo/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:51:40 CET 2006


Author: alpar
Date: Fri Nov  4 17:21:41 2005
New Revision: 2303

Modified:
   hugo/trunk/lemon/lp_base.h

Log:
(Dual)Expr::simplify(double tolerance) added

Modified: hugo/trunk/lemon/lp_base.h
==============================================================================
--- hugo/trunk/lemon/lp_base.h	(original)
+++ hugo/trunk/lemon/lp_base.h	Fri Nov  4 17:21:41 2005
@@ -293,6 +293,16 @@
 	}
       }
 
+      ///Removes the coefficients closer to zero than \c tolerance.
+      void simplify(double &tolerance) {
+	for (Base::iterator i=Base::begin(); i!=Base::end();) {
+	  Base::iterator j=i;
+	  ++j;
+	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
+	  j=i;
+	}
+      }
+
       ///Sets all coefficients and the constant component to 0.
       void clear() {
 	Base::clear();
@@ -499,6 +509,17 @@
 	}
       }
 
+      ///Removes the coefficients closer to zero than \c tolerance.
+      void simplify(double &tolerance) {
+	for (Base::iterator i=Base::begin(); i!=Base::end();) {
+	  Base::iterator j=i;
+	  ++j;
+	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
+	  j=i;
+	}
+      }
+
+
       ///Sets all coefficients to 0.
       void clear() {
 	Base::clear();



More information about the Lemon-commits mailing list