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

Module: ppl/ppl Branch: pip Commit: 0ae52bb8264345fb17c77b0266182266575cc47c URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0ae52bb826434...
Author: François Galea francois.galea@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; }
participants (1)
-
François Galea