How can I use YALMIP in finding ISS Lyapunov functins

877 views
Skip to first unread message

Farzad Zarei

unread,
Feb 28, 2016, 1:43:43 AM2/28/16
to YALMIP
Hello I do not know how to use YALMIP to find the the ISS Lyapuniv functions as it is demonstrated in the attachment. can you help me please?
ISS Lyap.pdf

Johan Löfberg

unread,
Feb 29, 2016, 2:24:45 AM2/29/16
to YALMIP
Lyapunov stability for nonlinear systems is typically addressed using sum-of-squares, when trying to use optimization.

You will have to change your model though, as all constraints have to be polynomial, which your last constraint fails to satisfy

Johan Löfberg

unread,
Feb 29, 2016, 7:14:08 AM2/29/16
to YALMIP
Are you sure about that expression? Seems hard for a polynomial to be globally larger than a norm. I think gamma and alpha are supposed to be class-K functions, not constants.

Johan Löfberg

unread,
Feb 29, 2016, 7:33:54 AM2/29/16
to yal...@googlegroups.com
The code below searches for quartic sum-of-squares functions alpha and gamma, such that the constraint holds

sdpvar x1 x2 e1 e2

u = 4*(x1+e1)-4*(x2+e2)-4.5*(x1+e1)^2-1.5*(x1+e1)^3;
f = [-x2-1.5*x1^2-.3*x1^3;u]

[alpha,ai] = polynomial([x1;x2],4);
[gamma,gi] = polynomial([e1;e2],4);
solvesos([sos(alpha),sos(gamma),sos(-alpha+gamma-(x1*f(1) + f(2)-3*f(1)))],[],[],[ai;gi]);
sdisplay(replace(alpha,ai,value(ai)))
sdisplay(replace(gamma,gi,value(gi)))


Farzad Zarei

unread,
Mar 14, 2016, 1:25:21 PM3/14/16
to YALMIP
Thank you john
You are right gamma and alpha are class K function. I run the codes you sent me. But the answer was SOS decomposition not available. This message was the same for all the SOS codes. And finally it says infeasible matlab problem.
I received the same answer when i run the code in the article "a toolbax for modeling and optimization in matlab" part E. Control synthesis: the answer was there too:
No suitable solver
Problem: -2
Decomposition not available
Can you help me in finding the suitable solver and circumvent the problem?
Thanks a lot

Johan Löfberg

unread,
Mar 14, 2016, 2:12:24 PM3/14/16
to YALMIP
the code above runs perfectly fine if you hae a reasonable sdp solver installed

Farzad Zarei

unread,
Mar 14, 2016, 3:07:36 PM3/14/16
to YALMIP
thank you john
which solver do I have to install? will you give me an address to download it?
the system is from the article "Event-triggered and self-triggered stabilization of distributed networked control systems" which is attached, which I do not how it is estimated the control synthesis, gamma and alpha?

 
5-Event-triggered and self-triggered stabilization.pdf.pdf

Johan Löfberg

unread,
Mar 14, 2016, 3:13:42 PM3/14/16
to YALMIP
mosek is free for academia, otherwise sdpt3 or sedumi

Farzad Zarei

unread,
Mar 14, 2016, 3:48:46 PM3/14/16
to YALMIP
john,
I did not succeeded to get any of the toolboxes. By installing yalmip do necessary toolboxes like sedumi, sdpt3 or mosek will be installed or I have to install them separately?

Johan Löfberg

unread,
Mar 14, 2016, 3:53:12 PM3/14/16
to YALMIP

Farzad Zarei

unread,
Mar 21, 2016, 4:11:01 PM3/21/16
to YALMIP
Dear johan
I have installed the solver spdt3-3.02. But when Irun the codes in the article " YALMIP: A toolbox for modeling and optimizarion in matlab" to find the controller, or the codes you sent me, the answers are:
1.
clc
clear all
x1 = sdpvar(1,1);x2 = sdpvar(1,1);
x=[x1;x2];
z = [x1;x2;x1^2]
K = sdpvar(1,3);
P = sdpvar(3,3);
V = z'*P*z
u = K*z;
f = [-1.5*x1^2-0.5*x1^3-x2;u];
Vdot = jacobian(V,x)*f;
F = (P>0) + (-25<K<25);
F = F + (sos(-Vdot));
options = sdpsettings('solver','sdpt3-3.02','sos.model',2,'sos.newton',1,'sos.congruence',0)
[sol,v,Q] = solvesos(F,[])
double(P)
double(K)

The answer is:
options =

solver: 'sdpt3-3.02'
verbose: 1
debug: 0
usex0: 0
warning: 1
cachesolvers: 0
showprogress: 0
saveduals: 1
removeequalities: 0
savesolveroutput: 0
savesolverinput: 0
saveyalmipmodel: 0
convertconvexquad: 1
radius: Inf
relax: 0
dualize: 0
savedebug: 0
expand: 1
allowmilp: 1
allownonconvex: 1
shift: 0
dimacs: 0
beeponproblem: [-5 -4 -3 -2 -1]
bilevel: [1x1 struct]
bmibnb: [1x1 struct]
bnb: [1x1 struct]
cutsdp: [1x1 struct]
kkt: [1x1 struct]
moment: [1x1 struct]
mp: [1x1 struct]
mpcvx: [1x1 struct]
plot: [1x1 struct]
robust: [1x1 struct]
sos: [1x1 struct]
baron: []
bintprog: [1x1 struct]
bonmin: []
cdd: [1x1 struct]
cbc: [1x1 struct]
clp: [1x1 struct]
cplex: [1x1 struct]
csdp: [1x1 struct]
dsdp: [1x1 struct]
ecos: [1x1 struct]
filtersd: [1x1 struct]
fmincon: [1x1 struct]
fminsearch: [1x1 struct]
frlib: [1x1 struct]
glpk: [1x1 struct]
gurobi: [1x1 struct]
ipopt: [1x1 struct]
intlinprog: []
knitro: [1x1 struct]
linprog: [1x1 struct]
lmilab: [1x1 struct]
lmirank: [1x1 struct]
logdetppa: [1x1 struct]
lpsolve: [1x1 struct]
lsqnonneg: [1x1 struct]
lsqlin: [1x1 struct]
kypd: [1x1 struct]
nag: [1x1 struct]
mosek: [1x1 struct]
nomad: []
ooqp: []
penbmi: [1x1 struct]
penlab: []
pensdp: [1x1 struct]
qpoases: []
qsopt: [1x1 struct]
quadprog: [1x1 struct]
quadprogbb: [1x1 struct]
scip: []
scs: [1x1 struct]
sdpa: [1x1 struct]
sdplr: [1x1 struct]
sdpt3: [1x1 struct]
sdpnal: [1x1 struct]
sedumi: [1x1 struct]
sparsepop: [1x1 struct]
sparsecolo: [1x1 struct]
vsdp: [1x1 struct]
xpress: []

-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 9 parametric variables and 2 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 1 LMIs.
Using image representation (options.sos.model=2). Nonlinear parameterization found
Initially 7 monomials in R^2
Newton polytope (1 LPs).........Keeping 4 monomials (0.3432sec)
Finding symmetries..............Found no symmetries (0.0312sec)

sol =

solvertime: 0
info: 'No suitable solver'
problem: -2
yalmiptime: 2.1210


v =

[]


Q =

[]


ans =

NaN NaN NaN
NaN NaN NaN
NaN NaN NaN


ans =

NaN NaN NaN
2.
And the code you sent me:


sdpvar x1 x2 e1 e2
u = 4*(x1+e1)-4*(x2+e2)-4.5*(x1+e1)^2-1.5*(x1+e1)^3;
f = [-x2-1.5*x1^2-.3*x1^3;u]
[alpha,ai] = polynomial([x1;x2],4);
[gamma,gi] = polynomial([e1;e2],4);
solvesos([sos(alpha),sos(gamma),sos(-alpha+gamma-(x1*f(1) + f(2)-3*f(1)))],[],[],[ai;gi]);
sdisplay(replace(alpha,ai,value(ai)))
sdisplay(replace(gamma,gi,value(gi)))

The answer is:
Polynomial matrix variable 2x1 (full, real, 4 variables)
-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 30 parametric variables and 4 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 0 LMIs.
Using kernel representation (options.sos.model=1).
Initially 6 monomials in R^2
Newton polytope (0 LPs).........Keeping 6 monomials (0sec)
Finding symmetries..............Found no symmetries (0sec)
Initially 15 monomials in R^4
Newton polytope (4 LPs).........Keeping 15 monomials (0.093601sec)
Finding symmetries..............Found no symmetries (0sec)

*******************************************************************
Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep p_infeas d_infeas gap obj cputime
-------------------------------------------------------------------
0 0.000 0.000 1.8e+001 1.7e+001 1.1e+003 0.000000e+000
0
0

Farzad Zarei

unread,
Mar 21, 2016, 4:13:26 PM3/21/16
to YALMIP
Can you tell me what is the problem, or exactly which solver aI need to install?

Johan Löfberg

unread,
Mar 21, 2016, 4:16:31 PM3/21/16
to YALMIP
Why would you dig up and install sdpt3-3.02? it is obsolete since long ago. Most recent version is 4.0

sdpt3 won't work though, as you have a nonlinear parameterization with products of K and P, i.e., the sos sdp is not linear but nonlinear. 

If you copied this code from some paper, it must have mentioned that this is not a standard sos problem

Farzad Zarei

unread,
Mar 22, 2016, 4:16:00 AM3/22/16
to YALMIP
HELLO Johan
Sorry again, I need it for my thesis.
I installed sdpt3-4, but still it do not work properly. The codes and answers are as follow:
Running: yalmiptest
Answer:
+++++++++++++++++++++++++++++++++++++++++++++++
| Searching for installed solvers |
+++++++++++++++++++++++++++++++++++++++++++++++
| Solver| Version/module| Status|
+++++++++++++++++++++++++++++++++++++++++++++++
| MOSEK| LP/QP| found|
| MOSEK| SOCP| found|
| MOSEK| SDP| found|
| MOSEK| GEOMETRIC| found|
| LINPROG| | found|
| QUADPROG| | found|
| SDPT3| 4| found|
| SDPT3| 3.1| found|
| SDPT3| 3.02| found|
| LMILAB| | found|
| FMINCON| geometric| found|
| FMINCON| standard| found|
Running the codes:
yalmip('clear')

x1 = sdpvar(1,1);x2 = sdpvar(1,1);
x=[x1;x2];
z = [x1;x2;x1^2]
P = 1+z +z.^4;
Q=sdpvar(3,3)
options=sdpsettings('solver','','sos.model',2,'sos.newton',1,'sos.congruence',0)
F = (sos(P));
[sol,v,Q]=solvesos(F,[],options)
% Q{1}

Answer is:
sol =

yalmiptime: NaN
solvertime: NaN
info: 'Unknown problem in solver (try using 'debug'-flag in sdpsettings) (Reference to non-existent field 'barx'.)'
problem: 9


v =

[]


Q =

[]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
Running the codes:


clc
clear all
x1 = sdpvar(1,1);x2 = sdpvar(1,1);
x=[x1;x2];
z = [x1;x2;x1^2]
K = sdpvar(1,3);
P = sdpvar(3,3);
V = z'*P*z
u = K*z;
f = [-1.5*x1^2-0.5*x1^3-x2;u];
Vdot = jacobian(V,x)*f;
F = (P>0) + (-25<K<25);
F = F + (sos(-Vdot));

options = sdpsettings('solver','sdpt3-4','sos.model',2,'sos.newton',1,'sos.congruence',0)
[sol,v,Q] = solvesos(F,[],options)
double(P)
double(K)

The answer is:

-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 9 parametric variables and 2 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 1 LMIs.

Initially 7 monomials in R^2

Newton polytope (1 LPs).........Keeping 4 monomials (0.093601sec)

sol =

solvertime: 0
info: 'Solver not applicable (sdpt3-4)'
problem: -4
yalmiptime: 1.9490


v =

[]


Q =

[]


ans =

NaN NaN NaN
NaN NaN NaN
NaN NaN NaN


ans =

NaN NaN NaN
%%%%%%%%%%%%
Running the codes:


sdpvar x1 x2 e1 e2
u = 4*(x1+e1)-4*(x2+e2)-4.5*(x1+e1)^2-1.5*(x1+e1)^3;
f = [-x2-1.5*x1^2-.3*x1^3;u]
[alpha,ai] = polynomial([x1;x2],4);
[gamma,gi] = polynomial([e1;e2],4);

options = sdpsettings('solver','sdpt3-4','sos.model',1,'sos.newton',1,'sos.congruence',0)
[sol,v,Q]=solvesos([sos(alpha),sos(gamma),sos(-alpha+gamma-(x1*f(1) + f(2)-3*f(1)))],[],[],[ai;gi]);
sdisplay(replace(alpha,ai,value(ai)))
sdisplay(replace(gamma,gi,value(gi)))
Q
v
double(gamma)
double(alpha)
the answer is:
Basic solution
Problem status : PRIMAL_INFEASIBLE
Solution status : PRIMAL_INFEASIBLE_CER
Primal - objective: 0.0000000000e+000 eq. inf.: 0.00e+000 max bound inf.: 0.00e+000
Dual - objective: 1.0288177305e+006 eq. inf.: 0.00e+000 max bound inf.: 0.00e+000

Optimizer summary
Optimizer - time: 0.25
Interior-point - iterations : 0 time: 0.08
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Clean primal-dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Primal-dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

0
0

Q =

[]


v =

[]


ans =

NaN


ans =

NaN

Johan Löfberg

unread,
Mar 22, 2016, 4:24:23 AM3/22/16
to YALMIP
In the first model, it appears Mosek has crashed for some reason. It runs without issues on my machine. Turn on debug as the error message tells you to do

In the second model, it works as expected. SDPT3 is not applicable as the problem is nonlinear in K and P

In the third model, you create an options structure to use sdpt3 as solver, but you never use the options, and YALMIP defaults to Mosek. Mosek has problems solving that model on your machine and claims it is infeasible. On my machine, Mosek solves it to near optimality. Are you using an old Mosek or YALMIP verson?

Farzad Zarei

unread,
Mar 22, 2016, 10:16:29 PM3/22/16
to YALMIP
As you said: "SDPT3 is not applicable as the problem is nonlinear in K and P". By which solver I can solve the nonlinear program to find K and P.

Johan Löfberg

unread,
Mar 23, 2016, 3:32:08 AM3/23/16
to YALMIP
With K and P decision variables, the problem is much much harder than a standard SOS problem, and typically cannot be solved. I hope you understand that.

A nonlinear SDP solver is required. PENLAB and PENBMI are the only local nonlinear SDP solvers supported. The built-in global nonlinear solver BMIBNB can address these problems too (requires a local nonlinear solver installed also, for any hope of solving the problem).
Reply all
Reply to author
Forward
0 new messages