summation eliminating some elements
Posted: Sat Jul 20, 2019 9:23 am
i have a set i =1,2,3,4,5,6 and a variable x(i). how to ∑ x(i) eliminating 1 and 5?
Forum for questions on the use of GAMS
https://forum.gamsworld.org/
Code: Select all
set i /1,2,3,4,5,6/ ;
parameter x(i), mysum;
* assign some values
x(i) =ord(i);
mysum = sum(i$(i.val ne 1 and i.val ne 5), x(i));
display mysum;