I have a problem about partitioning . with 3 set $i,j,k$ , $i=1,..,32 $ Represents the number of classes, $j=1,..,512 $ Represents the number of student, $k=1,..,40 $ Represents the type of student.
set $j=\{ 1,...,512\}$ , and subsets $t_k$ of $j$ ,Which indicates student $j$th belongs to which type. for example , if we consider type $k=1$, then all student with type $'1'$ are $t_1= \{ 2,10,78,69,114,500\}$.
These subsets are known. for example $t_1= \{ 2,10,78,69,114,500\}$ and $t_2=\{8,42,50\}$ ,...
I want to code in gams this sum in GAMS , $ \sum_{i,j} a_{i,j} x_{i,j} \ \ \ \ \forall i , \ \ j\in t_k$
I know when we want to use subset we can write
set j / 1*512/,
t(j)
but in this case, The subset has already been specified .
i use this way
set
j/1*512/
t(j)/2,10,78,69,114,500/
;
its right for one case "$t_1$ "
I don't know how can I define this type of subset such that Work for all sub set, and how can I define this summation?
In the first few iterations of this question the math was just wrong. It is no surprise that in that case the translation into GAMS is very difficult.
Now we have:
Of course for a real model the set elements would have proper meaning, like:
Now, we can do:
We can use this in expressions as
This would correspond to:
$$v_k = \sum_{i,j|t(k,j)} a_{i,j} x_{i,j}$$
I.e. $ is a 'such-that' operator, just like | in math.