[gecode-users] Partial sums
Christian Schulte
cschulte at kth.se
Wed Nov 28 16:16:12 CET 2007
Hi Malcolm,
Nice question! First, after some thinking I would say that both provide the
same strength of propagation for both bounds and domain consistency (that is
not obvious, actually). If the terms in the sum had non-unary coefficients
propagation would be different, with the ternary constraints having weaker
propagation.
Then, the number of propagation steps required for version (1) should be
lower than those for (2). However, the propagators for (1) are more costly.
So, I would just try it out, trying (2) first. How many variables are we
talking by the way? Tens? Hundreds? Thousands?
Cheers
Christian
--
Christian Schulte, www.ict.kth.se/~schulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Malcolm Ryan
Sent: Tuesday, November 27, 2007 3:53 AM
To: gecode list
Subject: [gecode-users] Partial sums
If I have integer variables v1 ... vn and I want to compute the
partial sums:
s1 = v1
s2 = v1 + v2
s3 = v1 + v2 + v3
...
sn = v1 + ... + vn
What is the best way to express the constraints? As above (using
linear() constraints) or as:
si = si-1 + vi
Or is there another, better way? Or does it not make any difference?
Malcolm
--
"Progress should mean that we are always changing the world to fit
the vision, instead we are always changing the vision."
- G.K.Chesterton, Orthodoxy
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list