I have variables X, Y, Z and W, all are binary
When I declare them in CVX, I do it as
variable X(U,S) binary
variable Y(U,C) binary
variable Z(S,C) binary
variable W(U,S,C) binary
where U, S,C are sum positive numbers
Two of my constraints
for u=1:U
for s=1:S
X(u,s)==sum(W(s,u,:));
end
end
for u=1:U
for s=1:S
for c=1:C
W(s,u,c)<=Y(u,c);
W(s,u,c)<=Z(s,c);
W(s,u,c)>=Y(u,c)+Z(s,c)-1;
end
end
end
They work fine and I get what I expect. But it is so slow.
In order to make it faster, I am vectoring them and instead declare them as
variable X(U*S) binary
variable Y(U*C) binary
variable Z(S*C) binary
variable W(U*S*C) binary
and the tuples are defined as
X=\{x_{u1s1},x_{u1s2},\cdots,x_{u1sS},x_{u2s1},x_{u2s2},\cdots,x_{u2sS},\cdots,x_{uUs1},x_{uUs2},\cdots,x_{uUsS} \}
Y=\{y_{u1c1},y_{u1c2},\cdots,y_{u1cC},y_{u2c1},y_{u2c2},\cdots,y_{u2cC},\cdots,y_{uUc1},y_{uUc2},\cdots,y_{uUcC} \}
Z=\{z_{s1c1},z_{s1c2},\cdots,z_{s1cC},z_{s2c1},z_{s2c2},\cdots,z_{s2cC},\cdots,z_{sSc1},z_{sSc2},\cdots,z_{sScC} \}
W=\{w_{u1s1c1},w_{u1s1c2},\cdots,w_{u1s1cC},w_{u2s1c1},w_{u2s1c2},\cdots,w_{u2s1cC},\cdots,w_{uUs1c1},w_{uUs1c2},\cdots,w_{uUs1cC}, w_{u1s2c1},w_{u1s2c2},\cdots,w_{u1s2cC},w_{u2s2c1},w_{u2s2c2},\cdots,w_{u2s2cC}\}\cdots
How can I express the above constraints in CVX with thesevectorization?