Hello All,

I am trying to code the semi-definite optimization problem which is shown in the picture using CVX.

in the picture above, (i,j) not in E means that node i and j are neighbors.

I wrote the following code so far (this is what I could do so far. It definitely needs improvement.)

```
cvx_begin sdp
agt = struct([]);
neighbors = readcell('neighbors.xlsx');
N = 2;
for i = 1:N
agt(i).neighbors = neighbors{i};
end
variable q
variable W(N,N) symmetric
variable V(N,N) symmetric
subject to
minimize (q)
j = 1;
for i = 1:N
W(i,j)>=0;
j = j+1;
end
j = 1;
for i = 1:N
D =[i,j];
if ~ismember(D,agt(i).neighbors)
W(i,j)=0;
end
j = j+1;
end
dummy = 0;
for i = 1:N
for j = 1:N
dummy = W(i,j)*V(i,j);
V = (1/N)*(dummy + V);
end
end
V-(1/N)*ones(N,1)*ones(1,N) - q*eye(N) == semidefinite(N);
for k = 1 : N
sum( diag( X, k ) ) == 1;
end
```

`cvx_end`

When I run this code, I get the error

Error in * (line 36)

z = feval( oper, x, y );Error in lambda (line 31)

dummy = W(i,j)*V(i,j);

From what I read, we can not use the product of two CVX variables. My main question is about how to resolve this error.

If there is any other suggestions on the rest if code, I greatly appreciate since I am new to CVX.

Thanks!