# Can't solve a feasible problem

My code and the messsge I got is as below:

``````AlphaD = 1;
AlphaE = 1000;
Nu = 960000
Sigma2 = [3.82102583411200e-15]
H2 = [0.00347932210179565;0.00167181211209093];
N = size(H2, 1);
p_bar = [1.00000000000000e-07;1.00000000000000e-07]
Y = [3.48715139242367e-05;5.90357581584438e-05]
P_max = [1; 1];
D = [0.001;0.001];
Bit = [528;528];
NudivLog2 = Nu/log(2);
I = zeros(N, 1);
for n = 1:N
H2dn = H2([1:n-1, n+1:end]);
p_bardn = p_bar([1:n-1, n+1:end]);
I(n) = H2dn'*p_bardn + Sigma2;
end

rth = Bit./D ;
K = (AlphaD + AlphaE.* P_max)./rth;
%% BEGIN
cvx_begin %quiet
%% VARIABLE
variables p(N) t(N)
%% EXPRESSION
expressions A(N) B(N) loga logb(N) pdn(N)
A = K.*t - (AlphaD + AlphaE.* p);
loga = log(H2'* p + Sigma2);

for n = 1:N
H2dn = H2([1:n-1, n+1:end]);
pdn = p([1:n-1, n+1:end]);
p_bardn = p_bar([1:n-1, n+1:end]);
logb(n) = log(I(n))+ ( H2dn'*(pdn-p_bardn) )/I(n);
end

%% OBJECTIVE
maximize sum(2.* Y.*sqrt(A) - Y.^2.* t)

%% CONSTRAINTS
subject to
1e-7 <= p <= P_max;
t >= rth;
t <= (loga - logb).* NudivLog2;
%% END
cvx_end
``````

## Cones | Errors | Mov/Act | Centering Exp cone Poly cone | Status --------±--------------------------------±-------- 1/ 1 | 8.000e+00 4.367e+00 0.000e+00 | Failed 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed

Status: Failed
Optimal value (cvx_optval): NaN

Failed: NaN @ [NaN;NaN]

I’ve made sure this setting is feasible. All constraints are convex and can be satisfied if p are assigned as p_bar.
Also, this is the result after I lower the precision. Before I do so, I’ll get messege like this:

## Cones | Errors | Mov/Act | Centering Exp cone Poly cone | Status --------±--------------------------------±-------- 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Unbounded

Status: Infeasible
Optimal value (cvx_optval): -Inf

It is saying a maximizing problem is unbounded, infeasible, and gave a optimal value of -Inf.

Change
`loga = log(H2'* p + Sigma2);`
to the equivalent
`loga = -rel_entr(1,H2'* p + Sigma2);`
and use CVXQUAD, as described in my answer at Failed status and optimal value NAN in convex problem . Then it solved for me under SDPT3, although ran into numerical problems under SeDuMi. You would benefit from improving scaling. But perhaps MOSEK will better handle the poor scaling.