[gecode-users] Partial sums

Malcolm Ryan malcolmr at cse.unsw.EDU.AU
Tue Nov 27 03:52:53 CET 2007


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







More information about the gecode-users mailing list