Solver not working, "you have NaN in your constraints"

145 views
Skip to first unread message

Mohammed Yazid Lyazidi

unread,
May 19, 2014, 1:21:56 PM5/19/14
to yal...@googlegroups.com
Hello everyone,

I'm currently having some problems running Yalmip with SeDumI as solver. My optimization problem concerns the minimization of total transmit power W (NxN matrix) with taking in account the queue length of each user Q_i(t) in a MIMO system.
I'm also adding an auxiliary variable s(j) for my problem that takes discrete values: 0 or 1.
I have also the SINR constraint that is modified with regards to this value s(j).
The increase of the user i queue length is modeled by this model: Q_i(t+1) = max( Q_i(t)-s(j)) + beta; with beta a given value.

here's my data code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%Cleaning%%%%%%%%%
close all
clear all
clc

%%%%%%%%%%%%Simulation Parameters%%%%%%%
V=5;
K=25;
gamma=5;
N=4;
beta=0.5;
T=50;

%%%%%preallocating%%%%%%
Q=zeros(T,K);
A=zeros(1,K);
sum_QxS=zeros(T,1);

%defining the SDP variables
S=sdpvar(2,2,K);
W=sdpvar(N,N,K);

% gaussian channel%%%
h=(1/sqrt(2))*(randn(N,1,K)+1i*randn(N,1,K));
H=zeros(N,N,K); %H=h*h'

sum_trace_W=0;
b=0;
I=[0 1;1 0];

%%%%%coding 

for j=1:K
     H(:,:,j)=h(:,1,j)*h(:,1,j)';
     s(j)=0.5*trace(I*S(:,:,j)); %%%%S is 2x2 matrix with rank =1,2
end

for j=1:K
           sum_trace_W=sum_trace_W+trace(W(:,:,j));
           b=b+trace(H(:,:,j).*W(:,:,j));
end

for j=1:K
       A(j)=gamma*(1+b-trace(H(:,:,j).*W(:,:,j)));
end


for j=1:K
       for l=1:T-1
          Q(l+1,j)=max(Q(l,j)-s(j),0)+beta;
       end
end


for i=1:K
          sum_QxS=sum_QxS+s(i)*Q(:,i);
end

for j=1:K
      F=[(1+gamma)*trace(H(:,:,j).*W(:,:,j))+ A(j)*(1-s(j))>=(1+b)*gamma];  %% SINR constraint
      F=[F, S(:,:,j)>=0, S(1,1,j)==1, S(2,2,j)==1, W(:,:,j)>=0]; %%%%SDP constraints
      obj=V*sum_trace_W - sum_QxS; %%%%objective funtion
      option = sdpsettings('solver','sedumi'); % setting the solver on SeDuMi 
      solvesdp(F,obj,option);
      obj=double(obj);
      Wf(:,:,j)=double(W(:,:,j));
      Sf(:,:,j)=double(S(:,:,j));
end
      
    
%%%

My objective here is to have the objective function and its values changing in time. I still don't understand where the NaN problem occurs in the constraints.
If some of you could help me please with this problem I'll be very thankful.
I'm sorry if my optimization problem is not very clear. I would explain it further if necessary.

Thank you.
     

Johan Löfberg

unread,
May 19, 2014, 1:30:12 PM5/19/14
to yal...@googlegroups.com

Mohammed Yazid Lyazidi

unread,
May 26, 2014, 1:32:31 PM5/26/14
to yal...@googlegroups.com
Hi!

I'm having troubles with the matlab code using SEDUMI.

I have an error message saying "solver not applicable"


%%%%%%%%%%%%Cleaning%%%%%%%%%
close all
clear all
clc
%%%%%%%%%%%%Simulation Parameters%%%%%%%

V=1;
K=28;
gamma=0.025;
N=4;
beta=0.5;
T=150;
Q=ones(T,K);
sum_QxS=zeros(T,1);

S=sdpvar(2,2,K,T);
W=sdpvar(N,N,K);

h=(1/sqrt(2))*(randn(N,1,K)+1i*randn(N,1,K));
H=zeros(N,N,K); %H=h*h'

B1=[1 -1;-1 1];
B2=[0 1;1 0];

for j=1:K
     H(:,:,j)=h(:,1,j)*h(:,1,j)';
end

sum_trW=0;
sum_trHxW=0;
for j=1:K
       sum_trW=sum_trW+trace(W(:,:,j));
       sum_trHxW=sum_trHxW+trace(H(:,:,j).*W(:,:,j));
end

for j=1:K
    A(j)=1.1*gamma*(1+sum_trHxW-trace(H(:,:,j).*W(:,:,j)));
end

for j=1:K
       for l=1:T-1
          Q(l+1,j)=max(Q(l,j)-0.25*trace(B1*S(:,:,j)),0)+beta;
       end
end

for l=1:T
  for i=1:K
          sum_QxS(l)=sum_QxS(l)+Q(l,i)*0.25*trace(B1*S(:,:,i));
  end
end

for j=1:K
      F=[(1+gamma)*trace(H(:,:,j).*W(:,:,j))+ A(j)*0.5*trace(B2*S(:,:,j))==(1+sum_trHxW)*gamma];
      F=[F, W(:,:,j)>=0, S(:,:,j)>=0, S(1,1,j)==1, S(2,2,j)==1];
      F=[F, sum_trW==0.05];
      obj=V*sum_trW*ones(T,1) - sum_QxS; %objective funtion
      option = sdpsettings('solver','sedumi'); % setting the solver on SeDuMi 
      solvesdp(F,obj,option);
      obj=double(obj);
      Wf(:,:,j)=double(W(:,:,j)); 
      Sf(:,:,j)=double(S(:,:,j)); 
end

for j=1:K
      u(:,1,j)=svd(Wf(:,:,j));
      t(j)=sqrt(trace((Wf(:,:,j))));
      wpc(:,1,j)=t(j)*u(:,1,j)/norm(u(:,1,j));
end

g=0;
for j=1:K
      for k=1:K
          if k~=j
             g=g+abs(wpc(:,1,k)'*h(:,1,j))^2;
          end
      end
    sinr(j)=(abs(wpc(:,1,j)'*h(:,1,j))^2)/((g/T)+1);
    if sinr(j)<gamma
        wpc(:,1,j)=0;
    end
end

for i=1:K
    if wpc(:,1,i)==0
        n(i)=0;
    else
    n(i)=10*log(norm(wpc(:,1,i))^2);
    end
end
nt=sum(n)/T;

The main problem here is the Queue-length (Q) updating each time.      

    
    
    

Johan Löfberg

unread,
May 26, 2014, 2:41:49 PM5/26/14
to yal...@googlegroups.com
I don't understand how your question differs from the original question. You cannot index into an sdpvar into an initially defined double (Q) due to MATLAB limitations. I've answered per email in detail last week, with code.
Reply all
Reply to author
Forward
0 new messages