Initializing help system before first use

xpress.Sum

xpress.Sum


Purpose
Alternative sum operator for an arbitrary number of objects created by a Python list, tuple, generator, NumPy array, dictionary, etc.
Synopsis
a = xpress.Sum (t1, t2, ...)
Example
The following are allowed uses of the Sum operator:
N = 20
S = range (S)
x = [xpress.var () for i in S]
y = [xpress.var (vartype = xpress.binary) for i in S]
p = xpress.problem ()
p.addVariable (x, y)
p.setObjective (x[0] + xpress.Sum (x[i]**2 for i in S))
p.addConstraint (xpress.Sum (x,y) <= 100)
p.addConstraint (xpress.Sum (x[:i]) + xpress.Sum (y[:i])
                 <= log (10 + i) for i in S)
Further information

The Sum operator is functionally equivalent to Python's native sum operator. However, it is strongly advised to use the Xpress' Sum operator when constructing large expressions involving variables, as doing otherwise might slow down the execution significantly.