You have NaNs in your constraints!, iterating, for loop
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Junhwi Mun
le 8 Juin 2020
Réponse apportée : Johan Löfberg
le 10 Juin 2020
Hi, I am trying to run the code, iterating 'e_1' in the bold text. When I don't interate, equally fixing the 'e_1' without for loop, it perfectly works.
What I thought was putting constraints and objective in the for loop, then it gives solutions, Pfeasible, per each 'e_1'
I basically use tool 'YALMIP' to solve optimization problem and the code I run is shown below:
I would be appreciated whatever you give some tips!
%Compare under e_1
%Data-based
ops = sdpsettings('solver','mosek','verbose',1,'debug',1);
Y=sdpvar(2,10);
delta = 0.7637;
A= [0.2, 1.3; 0.1, 1.2];
B= [1; 2];
D= [0.45 0.45; 0.3 -0.3];
t=0:9;
U=chirp(t,0.2,3,0.6);
[x] = data_dstate(); %data-based state: xdb
xdb=transpose(x);%X_{0,N}=(2x10)
for i=1:10
dxx(:,i)= A*(x(i,:))' + B*U(1,i) + D*(x(i,:))'*U(1,i);
end
dx= dxx;%X_{1,N}=(2x10)
for i=1:10
Vv(:,i)= [xdb(1,i)*U(1,i); xdb(2,i)*U(1,i)];
end
V=Vv;%V_{0,N}=(2x10)
for e_1=0:0.2:2 %BOLD STARTS HERE
ops = sdpsettings('solver','mosek','verbose',1,'debug',1);
e_2=sdpvar(1,1);
M_2 = [Y*dx'+ dx*Y'+ e_2*delta^2 *eye(2,2), Y*U', zeros(2,2), -Y*V';
U*Y', -e_1, zeros(1,2), zeros(1,2);
zeros(2,2), zeros(2,1), -P2./e_1, P2;
-V*Y', zeros(2,1), P2, -e_2*eye(2,2)];%LMI,(7x7)-data
M=[P1*A'+ A*P1+ B*y'+ y*B'+ e_1*D*P1*D' , y; y' , -e_1];%LMI-model
con2 = [e_2>=0, P2>=0, P2==xdb*Y', M_2<=0]; %constraints
con1=[P1>=0, M<=0]; %constraints
ob2 = -log(det(P2)); %objective
optimize(con2, ob2, ops)
ob1= -log(det(P1)); %objective
optimize(con1, ob1, ops)
end %BOLD ENDS HERE
%data-based solution
Pfeasible2 = value(P2);%(2x2)
Yfeasible2 = value(Y);%(2x10)
G_k = (Yfeasible2)'/(Pfeasible2);%(10x2)
K_db = U* G_k; %(1x2)
%data-based solution
Pfeasible1 = value(P1);
yfeasible1 = value(y);
K_mb = (yfeasible1)'/(Pfeasible1);% (yfeasible1)'*inv(Pfeasible1);
%Figure3-1
plot(e_1,det(Pfeasible2))
hold on
plot(e_1,det(Pfeasible1))
2 commentaires
Walter Roberson
le 8 Juin 2020
Is it the fact that you are iterating, or is it the fact that your e_1 becomes non-zero ?
Réponse acceptée
Johan Löfberg
le 10 Juin 2020
You are better off posting this question to the YALMIP Google groups, which you did but you never replied to the questions you received there. When you do that, also make sure the code is reproducible (it is not at the moment since data_dstate is some non-standard call)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!