Finding an optimum value of $x$ using CVX


I would like to find the optimum value of x that maximizes the following function using the CVX if possible.

F(x)= \left(1-\frac{x}{z}\right) \log_{2} \left(1+m(x)\right),

where m(x) is given as

m(x)= \frac{2x \sqrt{n^{2}+2n(r C-x)+(r C+x)^{2}}}{n^{2}+x\Big(r C+x-\sqrt{(n+r C)^{2}-2x(n-r C)+x^{2}} \Big)+n \Big(r C-2x+\sqrt{(n+r C)^{2}-2x(n-r C)+x^{2}}\Big)} \cdot

where x \leq C , n,z are fixed integers >0, r\in(0,1).

Thank you very much in advance.

We don’t offer general modeling assistance here. That’s what the reference manual and example library is for. If you start making progress entering your model into CVX and you have specific usage questions, you’re welcome to ask them. This is not specific enough.

However, I doubt your model is even convex. Have you proven it? Please read the FAQ.

Alright. Thank you very much.

F(x) certainly looks concave over most values. However, I believe it is not everywhere concave.

Presuming this formula for m is correct (I leave you to proofread),
m := 2*x*sqrt(n^2+2*n*(r*C-x)+(r*C+x)^2)/(n^2+x*(r*C+x-sqrt((n+r*C)^2-2*x*(n-r*C)+x^2))+n*(r*C-2*x+sqrt((n+r*C)^2-2*x*(n-r*C)+x^2)));

Then at r = 0.1, n = 1, z = 200, C =-50, x = -51, at which point m = -0.98091249, the 2nd derivative of F = 0.0003714, i.e., convex at that point. This is as computed by MAPLE, using 100 digit floating point arithmetic to evaluate the symbolically calculated derivative, so the sign of the result should be correct.

Thank you very much for your kind cooperation. In fact, I believe m is correct. If we assume the scenario under interest in my case, r=0.1, n=10, z=100, and C integer e.g. (10 to 50), so that means the function is convex. x should be also positive since it depends on C. x \leq C. I hope this may help. Really appreciate your help.

At those parameter values and C = 30, F(x) is convex at x = 10 and concave at x = 30.

So CVX is out for your problem. You may need to use a non-convex optimization solver, of which there are several, of both the local and global variety.

Thank you very much for your help. Could you please recommend a non-convex solver that I can use. Really appreciate your help.

In the interests of non-partisanship, I’ll let you decide. There are many listed and available at . Many of these are available under MATLAB.

Great. Thank you very much.