[PPL-devel] [GIT] ppl/ppl(pip): Fixed one bug in standalone PIP solver.

François Galea francois.galea at uvsq.fr
Wed Oct 28 16:24:05 CET 2009


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

Author: François Galea <francois.galea at uvsq.fr>
Date:   Wed Oct 28 16:23:14 2009 +0100

Fixed one bug in standalone PIP solver.

---

 demos/ppl_pips/ppl_pips.cc |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/demos/ppl_pips/ppl_pips.cc b/demos/ppl_pips/ppl_pips.cc
index fd067af..7b07782 100644
--- a/demos/ppl_pips/ppl_pips.cc
+++ b/demos/ppl_pips/ppl_pips.cc
@@ -232,15 +232,17 @@ public:
         pip.add_constraint(PPL::Constraint(e == 0));
     }
     k = 0;
-    for (i=0; i<num_ctx_rows; ++i) {
-      PPL::Linear_Expression e;
-      for (j=0; j<num_params; ++j)
-        e += context[k++] * PPL::Variable(num_vars+j);
-      e += context[k++];
-      if (ctx_type[i])
-        pip.add_constraint(PPL::Constraint(e >= 0));
-      else
-        pip.add_constraint(PPL::Constraint(e == 0));
+    if (num_params > 0) {
+      for (i=0; i<num_ctx_rows; ++i) {
+        PPL::Linear_Expression e;
+        for (j=0; j<num_params; ++j)
+          e += context[k++] * PPL::Variable(num_vars+j);
+        e += context[k++];
+        if (ctx_type[i])
+          pip.add_constraint(PPL::Constraint(e >= 0));
+        else
+          pip.add_constraint(PPL::Constraint(e == 0));
+      }
     }
     return true;
   }




More information about the PPL-devel mailing list