i\in\{1,\dots,N\}
g\in\{1,\dots,N\}
x_{i,g} binary decision variable
y_{i,j,g} binary decision variable
I want to maximize \sum_{i<j}\sum_g w_{i,j} y_{i,j,g}
subject to
\begin{align}
y_{i,j,g} &\le x_{i,g} &&\text{for all $i<j$ and all $g$} \\
y_{i,j,g} &\le x_{j,g} &&\text{for all $i<j$ and all $g$} \\
\end{align}
I declare the variable as
variable X(N,G) binary
variable Y(N,N,G) binary
How can I express the objective and the last two constraints?