Hi All

I am new to this tool. While solve a simple maximizing problem

cvx_begin

cvx_solver sedumi

cvx_quiet(true);

variable g;

maximize (log(1+g)/log(2))

subject to

g <= Gmax

cvx_end

where g is the variable to be determined.

I am getting an answer g=36180789.8355423 where Gmax =6015.10448126006

Could someone please help me to find the reason for not satisfying the inequality constraint?

Remove the statement `cvx_quiet(true);`

. Then re-run it and you will see the solver 9actually, CVX successive approximation method) output. I ran it with a stock CVX 2.2 (ii.e., no CVXQUAD) and sedumi as solver. The optimal solution has g = 6.014989425672330e+03, which is correct to within a sloppy tolerance. Running it with Mosek as solver using its native exponential cone capability, produced optimal g within 0.001 of the true optimum, which is within tolerance.

So I don’t know how you got the result you did. And neither will you until you run it without `cvx_quiet(true)`

. I will note that you did not show us a complete reproducible problem. Perhaps Gmax wasn’t really your intended value at the time the program was run?

Hi Mark, Thank you very much for the response. This is the code i was using

```
clc
clear all
close all
w=2*10^7;
No=10^(-19.9);
N=No*w;
n=5; % number of points that you want
center = [0 ,1]; % center coordinates of the circle [x0,y0]
radius = 10; % radius of the circle
angle = 2*pi*rand(n,1);
ho=1.42*10^-4;
r = radius*sqrt(rand(n,1));
X = r.*cos(angle)+ center(1);
Y = r.*sin(angle)+ center(2);
% plot(X,Y,'.k')
D=[X';Y'];
w=sqrt(D(1,1:n).^2+D(2,1:n).^2);
w=sort(w,'descend');
hmax=300;
hmin=10;
pmax=10^-2;
pmin=0;
Gmin=((pmax/n)*ho)./(w.^2+hmax.^2);
Gmax=((pmax/n)*ho)./(w.^2+hmin.^2);
Gmin=Gmin./N;
Gmax=Gmax./N;
for count=1:n
[g(count),uto(count)]=utopia(Gmax(count),Gmin(count))
end
function [g,u] = utopia(Gmax,Gmin)
cvx_begin
cvx_solver sedumi
cvx_quiet(true);
variable g;
maximize (log(1+g)/log(2))
subject to
g <= Gmax;
cvx_end
u=cvx_optval;
end
```

I skipped

```
for count=1:n
[g(count),uto(count)]=utopia(Gmax(count),Gmin(count))
end
function [g,u] = utopia(Gmax,Gmin)
```

and Gmax was a 1 by 5 vector. The`g`

prior to `variable g`

(i…e, the value returned by utopia) will be ignored and have no consequence to CVX. CVX solved the problem correctly, based on using that first element (which is the MATLAB default behavior) of the Gmax vector. However, you should provide a scalar for Gmax. And turn off quiet and look at the output.

Now i rerun the same code and i am getting the correct result. Since I am new to this tool, could you please give some tips regarding the scaling of variable in the optimization. I am telecommunication researcher, usually my variables to be optimized takes value of the order of 10^-6.

Try to get everything (other than numbers which are exactly zero) as close as you can to 1 in magnitude.1e-3 to 1e3 would be good, if possible.

Thank you very much for the tips and quick response

A question I also care about, thank you for your answer