[PPL-devel] [GIT] ppl/ppl(master): Modified computational weight for propagate_constraints.

Enea Zaffanella zaffanella at cs.unipr.it
Tue Jul 14 11:06:25 CEST 2009


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Tue Jul 14 11:05:13 2009 +0200

Modified computational weight for propagate_constraints.

---

 src/Box.templates.hh |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/Box.templates.hh b/src/Box.templates.hh
index e9ace50..76379b8 100644
--- a/src/Box.templates.hh
+++ b/src/Box.templates.hh
@@ -2601,7 +2601,12 @@ void
 Box<ITV>
 ::propagate_constraints_no_check(const Constraint_System& cs,
                                  const dimension_type max_iterations) {
-  PPL_ASSERT(cs.space_dimension() <= space_dimension());
+  const dimension_type space_dim = space_dimension();
+  PPL_ASSERT(cs.space_dimension() <= space_dim);
+
+  const Constraint_System::const_iterator cs_begin = cs.begin();
+  const Constraint_System::const_iterator cs_end = cs.end();
+  const dimension_type cs_size = std::distance(cs_begin, cs_end);
 
   Sequence copy;
   bool changed;
@@ -2609,11 +2614,10 @@ Box<ITV>
   do {
     ++num_iterations;
     copy = seq;
-    for (Constraint_System::const_iterator i = cs.begin(),
-	   cs_end = cs.end(); i != cs_end; ++i)
+    for (Constraint_System::const_iterator i = cs_begin; i != cs_end; ++i)
       propagate_constraint_no_check(*i);
 
-    WEIGHT_ADD(1);
+    WEIGHT_ADD_MUL(cs_size, space_dim);
     // Check if the client has requested abandoning all expensive
     // computations.  If so, the exception specified by the client
     // is thrown now.




More information about the PPL-devel mailing list