Line | |
---|
1 | function test_quadratic_in_max |
---|
2 | |
---|
3 | sdpvar x y |
---|
4 | obj = -x-y; |
---|
5 | F = set(max([x^2+y^2 x+y]) < 3); |
---|
6 | sol = solvesdp(set(max([x^2+y^2 x+y]) < 3),obj) |
---|
7 | mbg_asserttrue(sol.problem == 0) |
---|
8 | mbg_asserttolequal(double(obj),-sqrt(3/2)*2, 1e-4); |
---|
9 | |
---|
10 | sdpvar x y |
---|
11 | obj = -x-y; |
---|
12 | sol = solvesdp(set(0 < min([-x^2-y^2 -x-y]) +3),obj) |
---|
13 | mbg_asserttrue(sol.problem == 0) |
---|
14 | mbg_asserttolequal(double(obj),-sqrt(3/2)*2, 1e-4); |
---|
15 | |
---|
16 | sdpvar x y |
---|
17 | obj = -x-y; |
---|
18 | sol = solvesdp(set(max([1 x y x^2]) < min([-x^2-y^2 -x-y]) +3),obj) |
---|
19 | mbg_asserttrue(sol.problem == 0) |
---|
20 | mbg_asserttolequal(double(obj),-2, 1e-4); |
---|
21 | |
---|
22 | sdpvar x y |
---|
23 | obj = -x-y; |
---|
24 | sol = solvesdp(set(abs([1 x y x^2]) < min([-x^2-y^2 -x-y]) +3),obj) |
---|
25 | mbg_asserttrue(sol.problem == 14) |
---|
26 | |
---|
27 | |
---|
Note: See
TracBrowser
for help on using the repository browser.