[PPL-devel] [GIT] ppl/ppl(master): Corrected a bug in Pointset_Powerset methods minimize() and maximize().

Enea Zaffanella zaffanella at cs.unipr.it
Sat Aug 15 08:35:45 CEST 2009


Module: ppl/ppl
Branch: master
Commit: b52a2d273f4f96eec4a2ac5bb453756906e52a88
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b52a2d273f4f96eec4a2ac5bb453756906e52a88

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sat Aug 15 08:15:14 2009 +0200

Corrected a bug in Pointset_Powerset methods minimize() and maximize().
We now return false if the powerset is found to be empty.

---

 src/Pointset_Powerset.templates.hh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/Pointset_Powerset.templates.hh b/src/Pointset_Powerset.templates.hh
index ea10566..ff79c36 100644
--- a/src/Pointset_Powerset.templates.hh
+++ b/src/Pointset_Powerset.templates.hh
@@ -887,6 +887,9 @@ Pointset_Powerset<PSET>::maximize(const Linear_Expression& expr,
                                 bool& maximum) const {
   const Pointset_Powerset& x = *this;
   x.omega_reduce();
+  if (x.is_empty())
+    return false;
+
   bool first = true;
 
   PPL_DIRTY_TEMP_COEFFICIENT(supt_n);
@@ -940,6 +943,9 @@ Pointset_Powerset<PSET>::maximize(const Linear_Expression& expr,
                                 Generator& g) const {
   const Pointset_Powerset& x = *this;
   x.omega_reduce();
+  if (x.is_empty())
+    return false;
+
   bool first = true;
 
   PPL_DIRTY_TEMP_COEFFICIENT(supt_n);
@@ -999,6 +1005,9 @@ Pointset_Powerset<PSET>::minimize(const Linear_Expression& expr,
                                 bool& minimum) const {
   const Pointset_Powerset& x = *this;
   x.omega_reduce();
+  if (x.is_empty())
+    return false;
+
   bool first = true;
 
   PPL_DIRTY_TEMP_COEFFICIENT(inft_n);
@@ -1052,6 +1061,9 @@ Pointset_Powerset<PSET>::minimize(const Linear_Expression& expr,
                                 Generator& g) const {
   const Pointset_Powerset& x = *this;
   x.omega_reduce();
+  if (x.is_empty())
+    return false;
+
   bool first = true;
 
   PPL_DIRTY_TEMP_COEFFICIENT(inft_n);




More information about the PPL-devel mailing list