source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/dev/tests-mbg/sos/sos17.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.0 KB
Line 
1function massive
2ops{1} = sdpsettings('sos.cong',0,'sos.model',1,'verbose',0);
3ops{2} = sdpsettings('sos.cong',1,'sos.model',2,'verbose',0);
4ops{3} = sdpsettings('sos.cong',0,'sos.newton',0,'verbose',0,'sos.extlp',0);
5sdpvar x s t u
6
7sdpvar x y a bb c
8V = x^2*a+bb*y^2+x*y+3;
9F=set(sos(V))+set([a-4 bb c]);
10obj=a;
11for i = 1:length(ops)
12    i
13    fail = regresstest(F,obj,ops{i},[a bb c]);
14    mbg_asserttolequal(fail,0);
15end
16
17
18
19
20
21function fail  = regresstest(F,obj,ops,pv);
22
23if nargin==3
24    pv = [];
25end
26
27ops.sos.model = 1;
28solvesos(F,obj,ops,pv);
29obj1 = double(obj);
30p1s = checkset(F(find(is(F,'sos'))));
31p1e = checkset(F(find(~is(F,'sos'))));
32
33ops.sos.model = 2;
34solvesos(F,obj,ops,pv);
35obj2 = double(obj);
36p2s = checkset(F(find(is(F,'sos'))));
37p2e = checkset(F(find(~is(F,'sos'))));
38
39fail = 0;
40
41if abs(obj1-obj2) > 1e-4
42    fail = 1;
43end
44
45if any(p1s>1e-4)
46   fail = 2;
47   p1s
48end
49if any(p2s>1e-4)
50   fail = 2;
51   p2s
52end
53if any(p1e<-1e-4)
54   fail = 2;
55   p1e
56end
57if any(p2e<-1e-4)
58   fail = 2;
59   p2e
60end
61if fail==0
62    disp('Correct solution');
63end
Note: See TracBrowser for help on using the repository browser.