Line | |
---|
1 | function sos_rostalski |
---|
2 | |
---|
3 | % This test checks that YALMIP correcly detects |
---|
4 | % a trivially infeasible SOS problem, when the |
---|
5 | % image model is used. for kernel model, the solver |
---|
6 | % should fail, but doesn't due to numerical reasons |
---|
7 | |
---|
8 | x=sdpvar(2,1); |
---|
9 | p = x(1)^8+x(2)^7+x(1)*x(2); |
---|
10 | |
---|
11 | axu=[1;1]; |
---|
12 | bxu=[1]; |
---|
13 | f=axu'*x+bxu |
---|
14 | A=[ 1 0; |
---|
15 | -1 0; |
---|
16 | 0 1; |
---|
17 | 0 -1]; |
---|
18 | B=[1;1;1;1]; |
---|
19 | h=[A*x-B]; |
---|
20 | |
---|
21 | s = []; |
---|
22 | F= set([]); |
---|
23 | v= monolist(x,2); % all monomials of total degree<2 |
---|
24 | |
---|
25 | for i = 1:4; |
---|
26 | c = sdpvar(length(v)); |
---|
27 | s = [s v'*c*v] |
---|
28 | F = F + set(c>0); |
---|
29 | end |
---|
30 | |
---|
31 | |
---|
32 | sol = solvesos(set(sos(p-f+s*h))+F,[],sdpsettings('sos.model',2)) |
---|
33 | |
---|
34 | mbg_asserttolequal(sol.problem,2); |
---|
Note: See
TracBrowser
for help on using the repository browser.