I have constraints in the following form

x_{s,u} = y_{u,g} z_{s,g},\forall s,u,g

where, x_{s,u}, y_{u,g}, and z_{s,g} are all binary variables.

I think the multiplication of binary variables y_{u,g}, and z_{s,g} can be linearised using the technique in https://or.stackexchange.com/questions/37/how-to-linearize-the-product-of-two-binary-variables.

Let, v_{s,u,g}=y_{u,g} z_{s,g}

Then as per the technique proposed there

we have,

x_{s,u}= v_{s,u,g},\forall s,u,g

and

v_{s,u,g}\le y_{u,g}

v_{s,u,g}\le z_{s,g}

v_{s,u,g}\ge y_{u,g}+z_{s,g}-1

Am I doing it correctly?

Also, I am a bit confused with the indexing.

How can I efficiently model this constraints in CVX?

```
variable x(S,U) binary
variable y(U,G) binary
variable z(S,G) binary
variable v(S,U,G) binary
for s=1:S
for u=1:U
for g=1:G
x(s,u)=v(s,u,g);
v(s,u,g)<=y(u,g);
v(s,u,g)<=z(s,g);
v(s,u,g)>=y(u,g)+z(s,g)-1;
end
end
end
```

Is this the right way to do it?