I have an element *e* $\in E$ with $E$ the set containing all elements e and $e \in Y_i$ with $Y_i \subseteq E$. Each set $Y_i$ has different attributes. $G_j$ is a set of sets and the following holds: $ Y_i\in\ G_j $ and $\cup_j G_j = E$ Example: $e=5$ and sets $Y_2$={5,2,7}; $Y_{40}$={5,100,7}; ...; $Y_t$={300,400,2,5} are in $G_1$ so: $ G_1=\{Y_2, Y_{40},..., Y_t\}$ 1. In the end, I want to write a sum over a decision variable, that sums all variables found in the different sets for a particular element *e*. This should look likes this -> $\sum\limits^{G_1}_{Y_i \ni e}x_e(Y_i)$ or $\sum\limits^{G_j}_{Y_i}x_{e,Y_i} \; \forall e \in E: e \in Y_i:Y_i \in G_j$ 2. I want a sum over all elements within a set $Y_i$ This should look like this -> $\sum \limits^{Y_i}_e x_{e,Y_i} \; \forall\ Y_i \in G_j: e\in Y_i $ x is a binary decision variable. With my knowledge, I do not see how a solver could work like this. I could have used indices for the attributes found in the sets $Y_i$. This way I would avoid using $Y_i$ as an index. That though would probably add too many unnecessary decision variables that would be set to zero, since not for all elements exists these combinations of attributes. Is there a way to formulate such a thing?