Professional Documents
Culture Documents
_______________________
Saeed Varzandian
YALMIP
YALMIP is a modelling language for advanced modeling and solution of convex and nonconvex optimization problems. It is implemented as a free (as in no charge) toolbox for MATLAB. Created by: Johan Lfberg Linkping Universitet (Sweden)
F ( x )= F 0 + x i F i > 0
i =1
LMI is can be considered as an optimization problem of the following kind: min h subject to F >(=) 0 that can be solved with YALMIP's semidefinite programming (sdp) tool.
SDPVAR
Create symbolic decision variable You can create a sdpvar variable by: X = SDPVAR(n) Symmetric nxn matrix X = SDPVAR(n,n) Symmetric nxn matrix X = SDPVAR(n,m) Full nxm matrix (n~=m) Definition of multiple scalars can be simplified SDPVAR x y z w The parametrizations supported are X = SDPVAR(n,n,'full') Full nxn matrix X = SDPVAR(n,n,'symmetric') Symmetric nxn matrix Other available forms: Diagonal, Symmetric Toeplitz, Unsymmetric Hankel, Symmetric Hankel, Skew-symmetric, ... A scalar is defined as a 1x1 matrix
SET
Define the constraints The second most important concept in YALMIP is the set object. A set object is basically a collection of sdpvar objects constrained to have some property. F = set ( X > 0 ) or F = set ( X^2+eye(2)==Y ) For adding multiple constraints, simply use '+' : F = set(P>eye(2)) + set(A'*P+P*A<0)
SEE
See the base matrices With see, it is possible to see what the base matrices look like. see(F) see( eye(e)+F' )
SOLVESDP
Computes solution to optimization problem DIAGNOSTIC = SOLVESDP(F,h,options) SOLVESDP is the common command to solve optimization problems of the following kind min h
subject to F >(=) 0 OUTPUT diagnostic : Diagnostic information INPUT F : Object describing the constraints. Can be []. h : SDPVAR object describing the objective h(x). Can be []. options : Options structure. See SDPSETTINGS. Can be [].
DOUBLE
Obtain solution for a variable double(P) X_feasible=double(X)
10
EXAMPLES 1) sdpvar x1 x2 x3 x4 L=set([4+x1+2*x2 x2+x3+2; x2+x3+2 3*x2+x4] > 0); see(L) Constant matrix 4 2 2 0 Base matrices 1 0 0 0 2 1 0 1 1 3 1 0
4+ x 1+ 2x 2 x 2+ x 3 + 2 >0 x 2 + x 3+ 2 3x 2+ x 4
[ ] [ ] [ ] [ ] [ ]
3 4
0 0 0 1 Used variables 1 2
11
2) x1=sdpvar(1,1); x2=sdpvar(1,1); L=set([1-x1 x1+x2 x1+x2 2-x2 x1 0 +set(x1+x2<1); Z=solvesdp(L,[]); x1_feasible=double(x1) x2_feasible=double(x2) x1_feasible = -0.3562 x2_feasible = 0.2921 x1 ; 0 ; 1+x2] > 0)...
12
3)Lyapunov analysis using semidefinite programming % Create a stable matrix A = [-1 2;0 -2]; % Create symmetric matrix (full syntax) P = sdpvar(2,2,'symmetric'); % Add SETs for stability F = set(P>eye(2)) + set(A'*P+P*A<0) % Find feasible solution, minimize trace(P) solution = solvesdp(F,trace(P)); % Extract numerical solution P_feasible = double(P) P_feasible = 1.0000 0.0000 0.0000 1.0000 % Check solution eig(P_feasible) ans = 1.0000 1.0000 eig(A'*P_feasible+P_feasible'*A) ans = -5.2361 -0.7639
13
Further reading
1. Type: >> yalmipdemo for various examples and more useful commands.
14
15