Rev | Line | |
---|
[37] | 1 | function test_sos_sjoberg |
---|
| 2 | |
---|
| 3 | % Regression for a problem in getexponentbase |
---|
| 4 | % that caused issues in matrix sos |
---|
| 5 | |
---|
| 6 | sdpvar x1 x2 |
---|
| 7 | x = [x1 x2]'; |
---|
| 8 | |
---|
| 9 | f = [x2; |
---|
| 10 | -0.5*x1-0.5*x1^3-0.5*x2]; |
---|
| 11 | |
---|
| 12 | g = [0; 0.5]; |
---|
| 13 | h = x1; |
---|
| 14 | |
---|
| 15 | gam = 1.52; |
---|
| 16 | |
---|
| 17 | % V = sum (c_i * x^something) |
---|
| 18 | z = monolist(x,4); |
---|
| 19 | c = sdpvar(length(z),1); |
---|
| 20 | V = c'*z; |
---|
| 21 | |
---|
| 22 | Vx = jacobian(V,x) |
---|
| 23 | |
---|
| 24 | HJI = [Vx*f + f'*Vx.' + h'*h, 1/gam*Vx*g; |
---|
| 25 | 1/gam*g'*Vx.' -1] |
---|
| 26 | |
---|
| 27 | [sol,m,B,residuals] = solvesos( set(sos(-HJI)),[],[],c); |
---|
| 28 | residual = norm(getbase(replace(-HJI-m{1}'*B{1}*m{1},c,double(c))),'inf') |
---|
| 29 | |
---|
| 30 | mbg_asserttrue(residual < 1e-8); |
---|
Note: See
TracBrowser
for help on using the repository browser.