using an array of variables and adding a constraint on their sum

Mar 14 at 9:28 AM
Edited Mar 14 at 9:43 AM
Hello,

I can't immediately see how I could use an array of variables and adding a constraint on their sum.
I also would like to express constraints on weighted sums of variables, where weights are functions.
In summary, I would like to express constraints on expressions like

Sum x(i)

Sum x(i) Weight(y(i))

where x and y are Variables.

Of course the size of the array(s) would only be known at run time and it could be large (10-100).

Could you suggest me how to proceed?
Ideally I would like to use Linq, but other ways would ok.

Thanks,

Michel