Hi,
I was trying to solve a SDP problem with CVX, while I am pretty sure the objective function and all constraints are convex. It has an unexpected error. The detailed debug information are as follows.
clear all;
val = parameter_setting();
M = 4
K = 3; % number of SUs
N = 2; % number of PUs
sigmaks = 0.01;
sigmad = 0.01;
xi_k=0.05;
xi_ks=0.05;
xi_np=0.05;
h_error_var = 0.05;
q_error_var = 0.05;
eta_h = ((h_error_var)*chi2inv(1-xi_k,2*M))/2;
eta_q = (q_error_var)*chi2inv(1-xi_np,2*M)/2;
Rmin = 0.5;
rmin_total = 2.^(Rmin)-1;
power = 1; power_g = 0.2;
Mk = 24*10^(-3); ak = 150; bk = 0.014; omegak = 1/(1+exp(ak*bk));
Pnp_db = -20;
Pks = val.Pks;
Pnp = 10^(Pnp_db/10);
P_B = 4;
rho = 0.6;
%% cvx optimization
rmin = rmin_total;
h1 = wgn(M,1, power,'linear','complex');
h2 = wgn(M,1, power,'linear','complex');
h3 = wgn(M,1, power,'linear','complex');
g1 = wgn(M,1, power_g,'linear','complex');
g2 = wgn(M,1, power_g,'linear','complex');
nnn = 1;
while(1)
if(nnn == 1)
u1 = 0.0001; epsilon1 = 0.0001;
u2 = 0.0001; epsilon2 = 0.0001;
u3 = 0.0001; epsilon3 = 0.0001;
else
u1 = u1_opt; epsilon1 = epsilon1_opt;
u2 = u2_opt; epsilon2 = epsilon2_opt;
u3 = u3_opt; epsilon3 = epsilon3_opt;
end
cvx_begin SDP quiet
variable W1(M,M) complex semidefinite;
variable W2(M,M) complex semidefinite;
variable W3(M,M) complex semidefinite;
variable V(M,M) complex semidefinite;
variable tk1 ;
variable tk2 ;
variable tk3 ;
variable alpha11 nonnegative;
variable alpha21 nonnegative;
variable alpha31 nonnegative;
variable alpha22 nonnegative;
variable alpha32 nonnegative;
variable alpha33 nonnegative;
variable beta1 nonnegative;
variable beta2 nonnegative;
variable theta1 nonnegative;
variable theta2 nonnegative;
variable theta3 nonnegative;
maximize u1*(Mk-epsilon1*(1+exp(-ak*(tk1-bk)))) + u2*(Mk-epsilon2*(1+exp(-ak*(tk2-bk)))) + u3*(Mk-epsilon3*(1+exp(-ak*(tk3-bk))))
subject to
[alpha11*eye(M)+W1-rmin*(W2+W3+V) (W1-rmin*(W2+W3+V))*h1; h1'*(W1-rmin*(W2+W3+V)) h1'*(W1-rmin*(W2+W3+V))*h1-alpha11*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[alpha21*eye(M)+W1-rmin*(W2+W3+V) (W1-rmin*(W2+W3+V))*h2; h2'*(W1-rmin*(W2+W3+V)) h2'*(W1-rmin*(W2+W3+V))*h2-alpha21*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[alpha31*eye(M)+W1-rmin*(W2+W3+V) (W1-rmin*(W2+W3+V))*h3; h3'*(W1-rmin*(W2+W3+V)) h3'*(W1-rmin*(W2+W3+V))*h3-alpha31*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[alpha22*eye(M)+W2-rmin*(W3+W1+V) (W2-rmin*(W3+V))*h2; h2'*(W2-rmin*(W3+V)) h2'*(W2-rmin*(W3+V))*h2-alpha22*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[alpha32*eye(M)+W2-rmin*(W3+W1+V) (W2-rmin*(W3+V))*h3; h3'*(W2-rmin*(W3+V)) h3'*(W2-rmin*(W3+V))*h3-alpha32*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[alpha33*eye(M)+W3-rmin*(W1+W2+V) (W3-rmin*V)*h3; h3'*(W3-rmin*V) h3'*(W3-rmin*V)*h3-alpha33*eta_h-rmin*(sigmaks+sigmad/(1-rho))]==semidefinite(M+1);
[beta1*eye(M)-(W1+W2+W3+V) -(W1+W2+W3+V)*g1; -g1'*(W1+W2+W3+V) -beta1*eta_q-g1'*(W1+W2+W3+V)*g1 + Pnp] ==semidefinite(M+1);
[beta2*eye(M)-(W1+W2+W3+V) -(W1+W2+W3+V)*g2; -g2'*(W1+W2+W3+V) -beta2*eta_q-g2'*(W1+W2+W3+V)*g2 + Pnp] ==semidefinite(M+1);
[theta1*eye(M)+(W1+W2+W3+V) (W1+W2+W3+V)*h1; h1'*(W1+W2+W3+V) -theta1*eta_h+h1'*(W1+W2+W3+V)*h1+sigmaks-tk1/rho] == semidefinite(M+1);
[theta2*eye(M)+(W1+W2+W3+V) (W1+W2+W3+V)*h2; h2'*(W1+W2+W3+V) -theta2*eta_h+h2'*(W1+W2+W3+V)*h2+sigmaks-tk2/rho] == semidefinite(M+1);
[theta3*eye(M)+(W1+W2+W3+V) (W1+W2+W3+V)*h3; h3'*(W1+W2+W3+V) -theta3*eta_h+h3'*(W1+W2+W3+V)*h3+sigmaks-tk3/rho] == semidefinite(M+1);
trace(W1+W2+W3+V) <= P_B;
cvx_end
fun_epsilon1 = @(epsilon1) (epsilon1*(1+exp(-ak*(tk1-bk))) - Mk);
fun_epsilon2 = @(epsilon2) (epsilon2*(1+exp(-ak*(tk2-bk))) - Mk);
fun_epsilon3 = @(epsilon3) (epsilon3*(1+exp(-ak*(tk3-bk))) - Mk);
fun_u1 = @(u1) (u1*(1+exp(-ak*(tk1-bk))) - 1);
fun_u2 = @(u2) (u2*(1+exp(-ak*(tk2-bk))) - 1);
fun_u3 = @(u3) (u3*(1+exp(-ak*(tk3-bk))) - 1);
epsilon1_opt = NewtonRaphson(fun_epsilon1,0.0001);
epsilon2_opt = NewtonRaphson(fun_epsilon2,0.0001);
epsilon3_opt = NewtonRaphson(fun_epsilon3,0.0001);
u1_opt = NewtonRaphson(fun_u1, 0.0001);
u2_opt = NewtonRaphson(fun_u2, 0.0001);
u3_opt = NewtonRaphson(fun_u3, 0.0001);
if(abs(u1_opt*(Mk-epsilon1*(1+exp(-ak*(tk1-bk)))))<0.001 &abs(u2_opt*(Mk-epsilon2*(1+exp(-ak*(tk2-bk)))))<0.001 &abs(u3_opt*(Mk-epsilon3*(1+exp(-ak*(tk3-bk)))))<0.001 )
break;
end
nnn = nnn + 1;
end
Here is the error msg:
Error using *
Inner matrix dimensions must agree.
Error in cvxprob/eliminate (line 137)
P = P * cvx_invert_structure( xR );
Error in cvxprob/solve (line 18)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );
Error in cvx_end (line 88)
solve( prob );
Error in worst_case_max_sum (line 109)
cvx_end
I tried to use the same algorithm to solve other questions, and it can get the correct results. I think the problem might come from the constraints. But not sure. Any help or advises would be really appreciable.