CVX optimisation prroblem


(Shreyas Pimpalgaonkar) #1

I am unable to code the following optimisation problem in cvx.

Here, W is an nxn weight matrix and x is an nx1 vector. I want to find a weight matrix W that minimises the following objective function.

\begin{array}{r}{\varepsilon(W)=\sum_{i=1}^{n}\left\|x_{i}-\sum_{j \ne i} W_{(i, j)} x_{j}\right\|} \\ {\text { s.t. } \sum_{j} W_{(i, j)}=1}\end{array}

(Mark L. Stone) #2

Have you read the CVX Users’ Guide http://cvxr.com/cvx/doc/? This problem is quite straightforward to enter in CVX. After you have read the CVX Users’ Guide, if you are still stuck on something, please describe where you need help.


(Shreyas Pimpalgaonkar) #3

Thanks for your reply.

Yes I read the documentation for a long time but still couldn’t identify a case similar to mine where I’m iterating over the elements of a vector and elements of matrix and has sum of norms in it.

I am not that familiar with high level optimisation theory as well.

It would be great help if you direct me to a similar example in the documentation, or provide me some hints to represent my objective function as a product of matrices and then I could maybe use sum and norms functions.


(Mark L. Stone) #4

Each argument of the norm is a scalar, so the norm (regardless of “p’”) just amounts to absolute value of its argument. You can compute the objective in this case the same as you would if W were a numerical matrix in MATLAB.

You are allowed in CVX to do the following:

Objective = 0
for i=1:n
 Objective = Objective + cvx_expression_this_time_through_for_loop
end
minimize(Objective)

Vectorization (avoiding for loops) is faster in CVX model processing time when you can do it, but for loops are always valid.