[GIT] ppl/ppl(termination): Completed fill_constraint_system_PR().

Module: ppl/ppl Branch: termination Commit: d6ba16bc72f64aae8474331a12a839dbbb06d859 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=d6ba16bc72f64...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Wed Mar 17 18:46:27 2010 +0400
Completed fill_constraint_system_PR().
---
src/termination.cc | 4 ++ src/termination.templates.hh | 2 +- tests/Polyhedron/termination1.cc | 60 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/src/termination.cc b/src/termination.cc index 4e0a710..2a8f96e 100644 --- a/src/termination.cc +++ b/src/termination.cc @@ -323,6 +323,10 @@ fill_constraint_system_PR(const Constraint_System& cs_before, le_out += c_i.inhomogeneous_term()*Variable(row_index); }
+ // Add the nonpositivity constraints for u_1, u_2 and u_3. + for (dimension_type i = s + 2*r; i-- > 0; ) + cs_out.insert(Variable(i) <= 0); + // FIXME: iterate backwards once the debuggin phase is over. //for (dimension_type j = 2*n; j-- > 0; ) for (dimension_type j = 0; j < 2*n; ++j) diff --git a/src/termination.templates.hh b/src/termination.templates.hh index 247a587..d352a72 100644 --- a/src/termination.templates.hh +++ b/src/termination.templates.hh @@ -28,7 +28,7 @@ site: http://www.cs.unipr.it/ppl/ . */ #include "BD_Shape.defs.hh" #include "Octagonal_Shape.defs.hh"
-#define PRINT_DEBUG_INFO 0 +#define PRINT_DEBUG_INFO 1
#if PRINT_DEBUG_INFO #include <iostream> diff --git a/tests/Polyhedron/termination1.cc b/tests/Polyhedron/termination1.cc index e169729..92a902b 100644 --- a/tests/Polyhedron/termination1.cc +++ b/tests/Polyhedron/termination1.cc @@ -364,6 +364,62 @@ test14() { }
+bool +test15() { + Variable xp1(0); + Variable x1(1); + C_Polyhedron ph(2); + ph.add_constraint(x1 >= 3); + ph.add_constraint(xp1 >= 1); + + return !termination_test_MS(ph); +} + +bool +test16() { + Variable xp1(0); + Variable x1(1); + C_Polyhedron ph(2); + ph.add_constraint(x1 >= 3); + ph.add_constraint(xp1 >= 1); + + return !termination_test_PR(ph); +} + +bool +test17() { + Variable xp1(0); + Variable xp2(1); + Variable x1(2); + Variable x2(3); + C_Polyhedron ph(4); + ph.add_constraint(x1 >= 1); + ph.add_constraint(x2 >= 1); + ph.add_constraint(x1 - x2 <= -1); + ph.add_constraint(xp1 >= 1); + ph.add_constraint(xp2 >= 1); + ph.add_constraint(x1 == xp1); + + return !termination_test_MS(ph); +} + +bool +test18() { + Variable xp1(0); + Variable xp2(1); + Variable x1(2); + Variable x2(3); + C_Polyhedron ph(4); + ph.add_constraint(x1 >= 1); + ph.add_constraint(x2 >= 1); + ph.add_constraint(x1 - x2 <= -1); + ph.add_constraint(xp1 >= 1); + ph.add_constraint(xp2 >= 1); + ph.add_constraint(x1 == xp1); + + return !termination_test_PR(ph); +} + } // namespace
BEGIN_MAIN @@ -381,4 +437,8 @@ BEGIN_MAIN DO_TEST(test12); DO_TEST(test13); DO_TEST(test14); + DO_TEST(test15); + DO_TEST(test16); + DO_TEST(test17); + DO_TEST(test18); END_MAIN
participants (1)
-
Roberto Bagnara