Skip to main content
removed capitals from title
Link
YCor
  • 63.9k
  • 5
  • 187
  • 286

Double Summationsummation of Matricesmatrices as Constraintsconstraints in Convex Optimzationconvex optimization in CVX

converted image to TeX
Source Link
David Roberts
  • 35.4k
  • 11
  • 124
  • 349

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq 53

The screenshot of the optimization problem.: \begin{align} \text{minimize} &\qquad s\\ \text{subject to} & \qquad \begin{cases} W - \mathbf{11}^T/n \preceq sI\\ W = \sum_{i,j=1}^n\frac1n P_{ij}W_{ij}\\ P_{ij}\geq 0,\quad P_{ij}=0\text{ if }\{i,j\}\not\in E\\ \sum_{j} P_{ij} = 1,\quad \forall i \end{cases} \end{align}

  1. In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX. \begin{equation} W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j} \end{equation}

  2. Also, in this problem, $E$ is a set of neighbors of a node $i$. Constraint "$P_{ij}=0$ if $\{i,j\}\not\in E$" means that $P_{ij}$ is zero if nodes $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

For $n=3$, neighbors.xlsx can look like:

screenshot of neighbors.xlsx

This means node 1 is neighbor with node 2, node 2 is neighbor with node 1 and 3, and node 3 is neighbor with node2.

I have the written the following piece of code for that in Matlab. It does not work. Any help is greatly appreciated.

cvx_begin sdp
    agt = struct([]);
    neighbors = readcell('neighbors.xlsx');
    N = 2;
    for i = 1:N
      agt(i).neighbors = neighbors{i};
    end
    variable s
    variable P(N,N) symmetric
    variable W_ij(N,N) symmetric
    expression W
    
    minimize (s)
    
subject to     

P(:) >= 0;

    j = 1;
    for i = 1:N
        D =[i,j];
        if ~ismember(D,agt(i).neighbors)
            P(i,j)== 0;
        end
        j = j+1;
    end


    for i = 1:N
        for j = 1:N
            W = P(i,j).*W_ij;
        end    
    end
    W = (1/N).*W;
    W-(1/N)*ones(N,1)*ones(1,N) - s*eye(N) == semidefinite(N);

cvx_end

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq 53

The screenshot of the optimization problem.

  1. In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX. \begin{equation} W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j} \end{equation}

  2. Also, in this problem, $E$ is a set of neighbors of a node $i$. Constraint "$P_{ij}=0$ if $\{i,j\}\not\in E$" means that $P_{ij}$ is zero if nodes $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

For $n=3$, neighbors.xlsx can look like:

screenshot of neighbors.xlsx

This means node 1 is neighbor with node 2, node 2 is neighbor with node 1 and 3, and node 3 is neighbor with node2.

I have the written the following piece of code for that in Matlab. It does not work. Any help is greatly appreciated.

cvx_begin sdp
    agt = struct([]);
    neighbors = readcell('neighbors.xlsx');
    N = 2;
    for i = 1:N
      agt(i).neighbors = neighbors{i};
    end
    variable s
    variable P(N,N) symmetric
    variable W_ij(N,N) symmetric
    expression W
    
    minimize (s)
    
subject to     

P(:) >= 0;

    j = 1;
    for i = 1:N
        D =[i,j];
        if ~ismember(D,agt(i).neighbors)
            P(i,j)== 0;
        end
        j = j+1;
    end


    for i = 1:N
        for j = 1:N
            W = P(i,j).*W_ij;
        end    
    end
    W = (1/N).*W;
    W-(1/N)*ones(N,1)*ones(1,N) - s*eye(N) == semidefinite(N);

cvx_end

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq 53: \begin{align} \text{minimize} &\qquad s\\ \text{subject to} & \qquad \begin{cases} W - \mathbf{11}^T/n \preceq sI\\ W = \sum_{i,j=1}^n\frac1n P_{ij}W_{ij}\\ P_{ij}\geq 0,\quad P_{ij}=0\text{ if }\{i,j\}\not\in E\\ \sum_{j} P_{ij} = 1,\quad \forall i \end{cases} \end{align}

  1. In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX. \begin{equation} W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j} \end{equation}

  2. Also, in this problem, $E$ is a set of neighbors of a node $i$. Constraint "$P_{ij}=0$ if $\{i,j\}\not\in E$" means that $P_{ij}$ is zero if nodes $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

For $n=3$, neighbors.xlsx can look like:

screenshot of neighbors.xlsx

This means node 1 is neighbor with node 2, node 2 is neighbor with node 1 and 3, and node 3 is neighbor with node2.

I have the written the following piece of code for that in Matlab. It does not work. Any help is greatly appreciated.

cvx_begin sdp
    agt = struct([]);
    neighbors = readcell('neighbors.xlsx');
    N = 2;
    for i = 1:N
      agt(i).neighbors = neighbors{i};
    end
    variable s
    variable P(N,N) symmetric
    variable W_ij(N,N) symmetric
    expression W
    
    minimize (s)
    
subject to     

P(:) >= 0;

    j = 1;
    for i = 1:N
        D =[i,j];
        if ~ismember(D,agt(i).neighbors)
            P(i,j)== 0;
        end
        j = j+1;
    end


    for i = 1:N
        for j = 1:N
            W = P(i,j).*W_ij;
        end    
    end
    W = (1/N).*W;
    W-(1/N)*ones(N,1)*ones(1,N) - s*eye(N) == semidefinite(N);

cvx_end
Fixed markdown
Source Link
David Roberts
  • 35.4k
  • 11
  • 124
  • 349

I want to implement the following optimization problem from the following paper Randomized Gossip AlgorithmsRandomized Gossip Algorithms, Page 10 Eq 53

The screenshot of the optimization problem.

1- In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX.The screenshot of the optimization problem.

\begin{equation}
W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j}
\end{equation}

2- Also, in this problem, $E$ is a set of neighbors of a nod $i$. Constraint $P_{ij}=0~if~ \{i,j\}\not\in{E}$ means that $P_{ij}$ is zero if node $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

  1. In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX. \begin{equation} W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j} \end{equation}

  2. Also, in this problem, $E$ is a set of neighbors of a node $i$. Constraint "$P_{ij}=0$ if $\{i,j\}\not\in E$" means that $P_{ij}$ is zero if nodes $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

screenshot of neighbors.xlsxscreenshot of neighbors.xlsx

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq 53

The screenshot of the optimization problem.

1- In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX.

\begin{equation}
W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j}
\end{equation}

2- Also, in this problem, $E$ is a set of neighbors of a nod $i$. Constraint $P_{ij}=0~if~ \{i,j\}\not\in{E}$ means that $P_{ij}$ is zero if node $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

screenshot of neighbors.xlsx

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq 53

The screenshot of the optimization problem.

  1. In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I would appreciate if you help me with implementing the following constraint in CVX. \begin{equation} W=\frac{1}{n}\sum_{i,j=1}^{n}P_{i,j}W_{i,j} \end{equation}

  2. Also, in this problem, $E$ is a set of neighbors of a node $i$. Constraint "$P_{ij}=0$ if $\{i,j\}\not\in E$" means that $P_{ij}$ is zero if nodes $i$ and $j$ are not neighbors. Does anyone can help with how to implement this neighborhood relationship?

screenshot of neighbors.xlsx

Source Link
Loading