# Writing a constraint in DCP complient format

I have the following optimization problem.

\hspace{35pt}\max_{p_{n,k} w_{n,k}} t

subjected to

\hspace{35pt}t<= \sum_{n=1}^{{N_l}} w_{k,n} \log_2 \bigg(1 +\frac{p_{k,n} H_{k,n}} {w_{n,k} C}\bigg)

\hspace{35pt}p_{k,n}>=0

\hspace{35pt}w_{k,n}>=0

\hspace{35pt}sum(sum(p)) <= Pmax

\hspace{35pt}sum(w,2)<=1

p and w are my primal variables, rest are constants.

The term in the RHS of the constraint is concave as

\hspace{35pt}f = w \cdot \log_2(1+p/w)

is concave.

I am adding the 1st constraint in cvx in a loop

for k = 1:K

\hspace{35pt}t<= sum(

\hspace{35pt}w(:,k).*log(w(:,k).*c + p(:,k).*h(k)) -

\hspace{35pt}entr(w(:,k)) +

\hspace{35pt}(w(:,k).*log(c)))

end

But CVX is not allowing me to write this constraint. Can someone help me represent it in DCP complaint format?

The full list of supported functions in CVX is here. Check out the rel_entr function in particular; that may help. If you cannot express your model in terms of these functions and according to the DCP ruleset, CVX cannot solve your problem.

w*log2(1+p/w) = -rel_entr(w,w+p)/log(2).
See x\log(1+1/x) using CVX , including the warning there. Note that mcg’s May 27, 2013 answer has a typo, and should be -rel_entr(x,x+1), not -rel_entr(x+1,x).

Edit: Didn’t see mcg’s comment before posting, but this is what he was referring to.

Edit 2: Corrected to -rel_entr(w,w+p)/log(2), rather than -rel_entr(w+p,w)/log(2)

Forget my comment, this is more specific and direct, thank you!

Sir I used the rel_entr operator as you advised.
But cvx takes a lot of time to run it. Can I remodel the problem to speed up the process?
This is my sample data+code file.

Code

Also during optimization CVX gives me

Gives me the following message

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------

250/250 | 1.876e+00 2.445e-01 0.000e+00 | Inaccurate/Solved

250/250 | 6.064e-02 2.983e-04 0.000e+0 | Solved

What does Inaccurate/Solved mean? can I relay on the solution?

Sir, will using other solvers rather than SDPT3/remodeling the problem
would help speeding up the process?

Possibly. But the real problem is that CVX simply doesn’t handle models like these well, and there’s really nothing that can be done about that.

Thanks a lot…