Package: ppl / 0.10.2-8

b52a2d273f4f96eec4a2ac5bb453756906e52a88 Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From b52a2d273f4f96eec4a2ac5bb453756906e52a88 Mon Sep 17 00:00:00 2001
From: Enea Zaffanella <zaffanella@cs.unipr.it>
Date: Sat, 15 Aug 2009 08:15:14 +0200
Subject: [PATCH] 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);
-- 
1.6.0.6