[Lemon-commits] Gabor Retvari: Fix LpBase::Constr two-side limit...

Lemon HG hg at lemon.cs.elte.hu
Tue Nov 1 14:40:12 CET 2011


details:   http://lemon.cs.elte.hu/hg/lemon/rev/2eebc8f7dca5
changeset: 1092:2eebc8f7dca5
user:      Gabor Retvari <retvari [at] tmit.bme.hu>
date:      Tue Nov 01 08:24:30 2011 +0100
description:
	Fix LpBase::Constr two-side limit bug (#430)

diffstat:

 lemon/lp_base.h |  8 ++++----
 test/lp_test.cc |  8 ++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (57 lines):

diff --git a/lemon/lp_base.h b/lemon/lp_base.h
--- a/lemon/lp_base.h
+++ b/lemon/lp_base.h
@@ -1604,7 +1604,7 @@
   ///
   inline LpBase::Constr operator<=(const LpBase::Expr &e,
                                    const LpBase::Expr &f) {
-    return LpBase::Constr(0, f - e, LpBase::INF);
+    return LpBase::Constr(0, f - e, LpBase::NaN);
   }
 
   ///Create constraint
@@ -1622,7 +1622,7 @@
   ///
   inline LpBase::Constr operator<=(const LpBase::Expr &e,
                                    const LpBase::Value &f) {
-    return LpBase::Constr(- LpBase::INF, e, f);
+    return LpBase::Constr(LpBase::NaN, e, f);
   }
 
   ///Create constraint
@@ -1631,7 +1631,7 @@
   ///
   inline LpBase::Constr operator>=(const LpBase::Expr &e,
                                    const LpBase::Expr &f) {
-    return LpBase::Constr(0, e - f, LpBase::INF);
+    return LpBase::Constr(0, e - f, LpBase::NaN);
   }
 
 
@@ -1651,7 +1651,7 @@
   ///
   inline LpBase::Constr operator>=(const LpBase::Expr &e,
                                    const LpBase::Value &f) {
-    return LpBase::Constr(f, e, LpBase::INF);
+    return LpBase::Constr(f, e, LpBase::NaN);
   }
 
   ///Create constraint
diff --git a/test/lp_test.cc b/test/lp_test.cc
--- a/test/lp_test.cc
+++ b/test/lp_test.cc
@@ -166,6 +166,14 @@
     c = ((2 >= e) >= 3);
     c = ((2 >= p1) >= 3);
 
+    { //Tests for #430
+      LP::Col v=lp.addCol();
+      LP::Constr c = v >= -3;
+      c = c <= 4;
+      LP::Constr c2;
+      c2 = -3 <= v <= 4;
+    }
+
     e[x[3]]=2;
     e[x[3]]=4;
     e[x[3]]=1;



More information about the Lemon-commits mailing list