# Cvx status is falied, how to solve this problem?

``````clc,clear;
close all;

%% paramters
qs = [20,-40]';
qe = [20,40]';
p_u = [5,5,0]';
p_e = [5,10,0]';
p_irs = [0,0,20]';
Nt = 4;
w = rand(Nt,1)+1i*rand(Nt,1);
irs_nz =  4;
irs_ny = 4;
irs_antenna_number  = irs_nz*irs_ny;
lambda = 1;
d = 1/2*lambda;
M = irs_nz*irs_ny;
v = exp(1i*2*pi*rand(M,1));
Phi = diag(v);
dis  = norm(qe-qs);
T =10;
delta_T = 1;
N = floor(T/delta_T);
noise_power = 1e-8;
beta0 = 1e-3;
gamma = beta0/noise_power;
alpha = 3;
kappa = 2;
H_uav = 25;
iter_num = 20;

%% fixed channel
d_irs_u = norm(p_irs-p_u);
d_irs_e = norm(p_irs-p_e);
theta_AOD_irs_u = acos(p_u(1)/sqrt(p_u(1)^2+p_u(2)^2));
phi_AOD_irs_u = acos(p_irs(3)/sqrt(p_u(1)^2+p_u(2)^2+p_irs(3)^2));
theta_AOD_irs_e =  acos(p_e(1)/sqrt(p_e(1)^2+p_e(2)^2));
phi_AOD_irs_e =acos(p_irs(3)/sqrt(p_e(1)^2+p_e(2)^2+p_irs(3)^2));
vec_irs_u_y = exp(-1i*2*pi*d/lambda*(0:irs_ny-1)'*cos(theta_AOD_irs_u)*sin(phi_AOD_irs_u));
vec_irs_u_z = exp(-1i*2*pi*d/lambda*(0:irs_nz-1)'*cos(phi_AOD_irs_u));
vec_AOD_irs_u = kron(vec_irs_u_y,vec_irs_u_z);

vec_irs_e_y = exp(-1i*2*pi*d/lambda*(0:irs_ny-1)'*cos(theta_AOD_irs_e)*sin(phi_AOD_irs_e));
vec_irs_e_z = exp(-1i*2*pi*d/lambda*(0:irs_nz-1)'*cos(phi_AOD_irs_e));
vec_AOD_irs_e = kron(vec_irs_e_y,vec_irs_e_z);

h_iu_hat = sqrt(d_irs_u^(-alpha))*vec_AOD_irs_u;
h_ie_hat = sqrt(d_irs_e^(-alpha))*vec_AOD_irs_e;

q = rand(N,2,iter_num+1);
q(:,1,1)=linspace(qs(1),qe(1),T);
q(:,2,1)=linspace(qs(2),qe(2),T);
W1=zeros(2,2,N);
W2=zeros(2,2,N);

iter=1;
theta_n = zeros(N,1);
phi_n = zeros(N,1);
theta_aoa_n = zeros(N,1);
for idx=1:N
theta_n(idx) = acos(q(idx,1,iter)/sqrt(q(idx,1,iter)^2+q(idx,2,iter)^2));
phi_n(idx)  = acos(abs(p_irs(3)-H_uav)/sqrt(q(idx,1,iter)^2+q(idx,2,iter)^2+p_irs(3)^2));
theta_aoa_n(idx) = atan(abs(q(idx,2,iter)-p_irs(2))/abs(q(idx,1,iter)-p_irs(1)));

h_au_hat =  exp(-1i*pi*(0:Nt-1)'*sin(pi/10));
h_ae_hat =  exp(-1i*pi*(0:Nt-1)'*sin(pi/15));

vec_irs_y = exp(-1i*2*pi*d/lambda*(0:irs_ny-1)'*cos(theta_n(idx))*sin(phi_n(idx)));
vec_irs_z = exp(-1i*2*pi*d/lambda*(0:irs_nz-1)'*cos(phi_n(idx)));
vec_AOD_irs = kron(vec_irs_y,vec_irs_z);
vec_AOA_irs = exp(-1i*pi*(0:Nt-1)'*sin(theta_aoa_n(idx)));
H_ai_hat = vec_AOD_irs*vec_AOA_irs';
W1(:,:,idx) = [h_au_hat'*w;h_iu_hat'*Phi*H_ai_hat*w]*[h_au_hat'*w;h_iu_hat'*Phi*H_ai_hat*w]';
W1(:,:,idx) = (W1(:,:,idx)'+W1(:,:,idx))/2;
W2(:,:,idx) = [h_ae_hat'*w;h_ie_hat'*Phi*H_ai_hat*w]*[h_ae_hat'*w;h_ie_hat'*Phi*H_ai_hat*w]';
W2(:,:,idx) = (W2(:,:,idx)'+W2(:,:,idx))/2;
end
u0 = zeros(2,N);
s0 = zeros(2,N);
b0 =zeros(1,N);
for idx=1:N
u0(1,idx)=sqrt(norm([q(idx,:,iter),H_uav]'-p_u)^(-alpha));
u0(2,idx)=sqrt(norm([q(idx,:,iter),H_uav]'-p_irs)^(-kappa));
s0(1,idx)=sqrt(norm([q(idx,:,iter),H_uav]'-p_e)^(-alpha));
s0(2,idx)=sqrt(norm([q(idx,:,iter),H_uav]'-p_irs)^(-kappa));
b0(idx) = real(gamma*s0(:,idx)'*W2(:,:,idx)*s0(:,idx));
end

cvx_begin
variable  a(N,1)
variable  b(N,1)
variables q1(2,N) u(2,N) s(2,N)

sum=0;
for n=1:N
sum = sum + (log(1+a(n))-log(1+b0(n))-(b(n)-b0(n))/(1+b0(n)))/log(2);
end
maximize (sum)
subject to

for n=1:N
a(n)<=real(gamma*u0(:,n)'*W1(:,:,n)*u0(:,n)+2*gamma*u0(:,n)'*W1(:,:,n)*(u(:,n)-u0(:,n)));
real(gamma*s(:,n)'*W2(:,:,n)*s(:,n))<=b(n);

end

cvx_end
``````

Here is the entire output. Apparently, CVX did not solve the dual, because the output doesn’t say that it did. Apparently, Mosek’s presolve doesn’t have a very high pinion of the model, because it declared dual ill-posed without even invoking the interior point optimizer. I will defer to Mosek personnel for further assessment.

## Calling Mosek 10.0.34: 120 variables, 40 equality constraints

MOSEK Version 10.0.34 (Build date: 2023-1-5 10:25:54)
Platform: Windows/64-X86

Problem
Name :
Objective sense : minimize
Type : CONIC (conic optimization problem)
Constraints : 40
Affine conic cons. : 0
Disjunctive cons. : 0
Cones : 20
Scalar variables : 120
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.06
Optimizer terminated. Time: 0.19

Interior-point solution summary
Problem status : ILL_POSED
Solution status : DUAL_ILLPOSED_CER
Primal. obj: 0.0000000000e+00 nrm: 1e+00 Viol. con: 0e+00 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 0 time: 0.09
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Failed
Optimal value (cvx_optval): NaN

++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++

Using SeDuMi with CVX’s Successive Approximation method, resulted in

``````Status: Inaccurate/Solved
Optimal value (cvx_optval): +239.48
``````

with `s` = matrix of all zeros.

Changing `s` from variable to input data of a matrix of all zeros, Mosek still declared the problem to be dual ill-posed.

thank you, when i use SeDuMi to solve this problem, the solution does not satisify some constraints. How to deal with this problem?

It seems your problem formulation is not very good. Wait for someone from Mosek to post. But you may have to wait until Monday morning in Europe.

It looks clearly unbounded because you can make `u` arbitrarily large in the correct entries and therefore also `a` arbitrarily large. It has some large coefficients so it poses problems and that’s why you may see failure/infeasibilty certificate/illposedness certificate depending on how it gets presolved etc.

yes, you are right. some variables are too large or too small, which causes numerical problem. can i set the region of this variables to avoid numerical problem?

This is your model, so you decide. We don’t know what you want to achieve. You are probably missing something since currently it is a bit weird: the `u` and `s` are completely decoupled, the optimal `s` is zero and the problem is unbounded in `u`.

1 Like