Trying to setup a simple log minimization problem in CVX


(John Doe) #1

My objective function is:

f(x) = -\sum\limits_{i =1}^m \log(c_i^Tx)

subjected to the L1 norm inequality constraint

\|x\|_1 \leq 1

where c_i is a random vector of size 5x1, and x is my objective variable of size 5x1

I am not sure how to setup CVX so that it takes in all the c_i. As for now, I can only do this via the following code:

c1 = 10*rand(5,1)
c2 = 10*rand(5,1)
c3 = 10*rand(5,1)
n = 5
cvx_begin
    variable x(n)
    minimize( -1*(log(dot(c1,x(n))) + log(dot(c2,x(n))) + log(dot(c3,x(n)))))
    subject to
        norm(x,1) <= 1
cvx_end

Note: for some reason I am getting a MATLAB error when running the above code. Something about using the dot product.

Is it possible to use a sum directly?

Can anyone help me to format my CVX code?


(hua meng) #2

Dear Segfault, I think your objective function is not not convex.


(Mark L. Stone) #3

Your problem is convex. You just have a syntax error. In your dot, you should have x, not x(n).

I don’t think your mathematical display of the objective function is quite what you intended, because there is another index (dimension) on c. The easiest solution is to create a matrix of c values.

m=3;
n=5;
C=10*rand(m,n);
cvx_begin
variable x(n)
minimize(sum(-log(C*x)))
subject to
norm(x,1) <= 1
cvx_end