Why yalmip give me invalid answer?

(Elham Banapoor) #1

I write this problem in yalmip

in this format:

clc,clear,close all
% time structure 
t0=0;         %intial time
tf=10;        %final time
dt=0.01;        %sampling time
time=t0:dt:tf-dt %time vector

%% system structure  ======> x(k+1)=A*x(k)+B*u(k)
A = [1.02 -0.1
    0.1 0.98]
B = [0.5 0
    0.05 0.5]
G=[0.3 0;0 0.3]
[nx nu]=size(B)

%% Mpc parameter
Q  = eye(nx);
R  = eye(nu)*50;
Qf = eye(nu)*50;

sigmax=[1 0;0 1]
sigmaw=[1 0;0 1]
mux = [1;5]

K = sdpvar(repmat(nu,1,N),repmat(nx,1,N))
muu = sdpvar (repmat(nu,1,N),repmat(1,1,N) )
sigmax = sdpvar (repmat (nx,1,N),repmat(nu,1,N))
sigmax2 = sdpvar (repmat (nx,1,N),repmat(nu,1,N))
mux = sdpvar (repmat(nu,1,N),repmat(1,1,N) )

 for k=1:N;
 constant2 =[ sigmax2{k}  (A*sigmax{k}+B*K{k}*sigmax{k})  G*sigmaw
     (A*sigmax{k}+B*K{k}*sigmax{k})'  sigmax{k}   zeros(2)
     ( G*sigmaw)'             zeros(2)       sigmaw]>=0
     constant3 =[K{k}*sigmax{k}*K{k} (K{k}*sigmax{k})'
           (K{k}*sigmax{k})  sigmax{k}]>=0

objective =objective +trace((Q+K{k}*R*K{k})*sigmax{k})+(mux{k})'*Q*(mux{k})+(muu{k})'*R*muu{k}

option = sdpsettings('solver','penlab')
a=optimize (constrant,objective,option)

u= value(muu)

but my answer is zero and its incorrect.
And I want to solve with cvx but I couldent formulate in true form,how i can write this cost function in cvx ?

(Mark L. Stone) #2

This is not a linear SDP (LMI) as you have formulated it. In YALMIP, you called penlab as a solver to solve this nonlinear (bilinear?) SDP. Penlab is a local optimizer for non-convex problems; therefore, even if it found a local minimum, it may not be the global minimum.

Perhaps Johan can give you reformulation tips at https://groups.google.com/forum/#!categories/yalmip

(Elham Banapoor) #3

when i use other solvers it has the same answer .

how i can use cvx ?
my constraints are linear and convex but i think need to formulate cost function and i cant do it.

(Mark L. Stone) #4

You are multiplying variables, which is nonlinear. If some of what you are declaring sdpvar are actually supposed to be input data, then perhaps it would be linear and convex.

(Elham Banapoor) #5


How i can formulate the trace in the quadratic or norm form?

(Mark L. Stone) #6

Your problem is not convex.

I see you have posted at https://groups.google.com/forum/?fromgroups#!topic/yalmip/cknMU5-NYL8 , where Johan is providing you expert advice.


I have an optimization problem that can’t be solved, but I don’t know why I can’t post a new topic on this forum.Can you help me?Thank you very much!

(Mark L. Stone) #8

Why is is that you can’t post a new topic to this forum? I believe that if the forum software flags your attempted post for moderation, it should appear in a list to moderators for approval, in which case I could approve it and it would appear on the forum.

Forum posters such as myself reply to public posts on the forum, not to private email support requests.