Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
FilteredSum Operator (Solver Foundation)
Collapse the table of content
Expand the table of content

FilteredSum Operator (Solver Foundation)

Solver Foundation 3.0

Evaluates an expression for each combination of values of some iterator variables where a condition holds, and returns the sum results.

FilteredSum[iters…, cond, expr]

FilteredSum[{p, Products}, m[p] > 0, x[p]]
FilteredSum[{p, Products}, {s, Sources}, m[p] > 0, x[p, s]]
FilteredSum[{i, 5}, i != 3, x[i]]

The condition may not involve decision variables. FilteredSum uses the same iterator forms as Foreach. If no iterators are specified, FilteredSum evaluates the condition. If it is True the result is just expr, if it is False it is zero.

© 2015 Microsoft