sum#
- VarDict1D.sum()[source]#
Sum all variables in an expression.
- Returns:
- xpress.expression
Examples
Create xpress problem:
>>> import xpress as xp >>> import warnings >>> warnings.filterwarnings('ignore', category=xp.LicenseWarning)
>>> prob = xp.problem()
Create index-set:
>>> nodes = IndexSet1D(['A', 'B', 'C'], name='node')
Add variables:
>>> from opti_extensions.xpress import addVariables >>> node_select = addVariables(prob, nodes, name='node-select', vartype=xp.binary)
Sum all variables:
>>> node_select.sum() node-select(A) + node-select(B) + node-select(C)