# What is causing the final Status: Inaccurate/Solved? and how can I modify my code to get it Solved?

I can’t figure out why the result I get has status inaccurate/solved.

I have the following optimization problem: I have formulated the above optimization problem as follows:

T=0.1;
B=10^6;
K= 2;
N= 2;
NumberOfUsersInSubcarrier (1:N)=0;
NOMA_max = 2;
UE_SCid (1:K) = 0;
R_max = 140;
L = 15 * 10^4;
B_sub = B/N;
z = 10^-28; % effective capacitance coefficient
C = 10^2; % number of CPU cycles required per bit

for i=1:K
CG (i) = complex(randn(1),randn(1))/sqrt(2); % exponential random distribution with mean value 1
end

for i=1:K
SC_id = randi(N);
while (NumberOfUsersInSubcarrier(SC_id)>=NOMA_max) % each SBS can serve up to NOMA_max_users*N users
SC_id = randi(N);
end
NumberOfUsersInSubcarrier(SC_id)=NumberOfUsersInSubcarrier(SC_id) + 1;
UE_SCid (i) = SC_id; % save the UE’s subcarrier
end

cvx_begin
variable p(2)
variable l(2)
variable r(2)

``````minimize sum(z*C^3*pow_p(l,3)/T^2+p*T)

subject to
r >= (L-l)./(B_sub*T)   % Rate constraint
p >= 0                  % Power constraint
l >= 0                  % Local data constraint 1
l <= L                  % Local data constraint 2

% MAC contraints
r(1) <= log(1+p(1)*norm(CG(1))^2)
r(2) <= log(1+p(2)*norm(CG(2))^2)
r(1)+r(2) <= log(1+p(1)*norm(CG(1))^2 + p(2)*norm(CG(2))^2)
``````

cvx_end

After running the problem I get the following message result:

>> cvx_code
CVX Warning:
_ Models involving “log” or other functions in the log, exp, and entropy_
_ family are solved using an experimental successive approximation method._
_ This method is slower and less reliable than the method CVX employs for_
_ other models. Please see the section of the user’s guide entitled_
_ The successive approximation method_
_ for more details about the approach, and for instructions on how to_
_ suppress this warning message in the future._
_ _
Successive approximation method to be employed.
_ For improved efficiency, SDPT3 is solving the dual problem._
_ SDPT3 will be called several times to refine the solution._
_ Original size: 29 variables, 10 equality constraints_
_ 3 exponentials add 24 variables, 15 equality constraints_
-----------------------------------------------------------------
_ Cones | Errors |_
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
_ 2/ 2 | 7.550e+00 4.276e+00 0.000e+00 | Inaccurate/Solved_
_ 2/ 2 | 2.650e+00 4.322e-01 0.000e+00 | Solved_
_ 2/ 2 | 9.921e-02 6.676e-04 0.000e+00 | Solved_
_ 2/ 2 | 1.059e-02 7.579e-06 0.000e+00 | Solved_
_ 0/ 0 | 1.288e-03 0.000e+00 0.000e+00 | Inaccurate/Solved_
_ 0/ 0 | 1.268e-04 0.000e+00 0.000e+00 | Inaccurate/Solved_
_ 0/ 0 | 1.752e-04 0.000e+00 0.000e+00 | Inaccurate/Solved_
-----------------------------------------------------------------
Status: Inaccurate/Solved
Optimal value (cvx_optval): +67.8698

Can someone please help me with what might be the cause of the Inaccurate/Solved status and what should I do in order to reach a solved status?

I think Inaccurate/solved is resulting because of the poor scaling n the problem. In particular ,`z = 1e-28` is causing difficulty in the objective function, because it makes the first additive term in the objective function of vastly different order of magnitude than the second term. As a result, the variable l is not well determined numerically to the solver. So as is, the optimal objective value is determined fairly well, but `l` is not well determined at all.

If `z` is chosen substantially larger, then the problem becomes better behaved.

Given your use of log, I advise you to follow the advice in CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions . In particular, change the MAC constraints to

``````r(1) <= -rel_entr(1,1+p(1)*norm(CG(1))^2)
r(2) <= -rel_entr(1,1+p(2)*norm(CG(2))^2)
r(1)+r(2) <= -rel_entr(1,1+p(1)*norm(CG(1))^2 + p(2)*norm(CG(2))^2)
``````

However, this does not fix the Inaccurate/solved issue. You need to change `z` to do that.

1 Like

You were absolutely right. I have made the changes to the code you recommended and I have also changed the value of z to 10^-16 based on your suggestions and the final status now is always ‘Solved’. Thanks a million!

However I am having another problem which I think is relevant to this topic, therefore I will ask here instead of opening another thread.

The final values of p after the cvx has been solved, are always greater or equal to zero (which has been set as one of the constraint) and the maximum value I have gotten after running my code 1 million times was more or less around 2000. However, after adding another constraint for the maximum value of p:

p <= P_max

where P_max = (zC^3L^3)/(T^2) = 33750000, I thought this constraint could not possibly cause any problems since the value of p always ends up to be significantly lower than that. But instead, now the final status has become:

Status: Failed
Optimal value (cvx_optval): NaN

and the final p values of the failed convex game end up being:

p =

1.0e+07 *

``````3.3749
0.0002
``````

I can’t understand how this constraint is causing the cvx problem to fail, especially since the P_max has been set so high which should not cause any changes at all based on the greatest value of p when no maximum limit constraint has been set. Can someone share some wisdom pleeease?

Large input numbers anywhere in your problem specification can cause problems for the solvers called by CVX. it is true that the theoretical so0lution is unaffected by adding a non-binding constraint to what was the optimal solution, But doing so can cause havoc with solvers. Either use a relatively small magnitude bound constraint, or don;t use a bound constraint at all.

I have a question.
When the problem has good scaling, the ‘log’ is automatically approximated by the solver, e.g., SeDuMi.
Is there possible that the Successive approximation method employed for the ‘log’ function may result in the inaccurate\solved solution?

The the Successive approximation method is unreliable. Poor numerical scaling exacerbates the unreliability.

Always try to have good numerical scaling. If possible, use CVX 2.2 with Mosek 9.x. If Mosek is not available to you, follow the advice in the link in my first post of this thread,

OK. I will have a try.