Rev | Line | |
---|
[37] | 1 | function test_exp |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | sdpvar x y |
---|
| 5 | obj = -x; |
---|
| 6 | sol = solvesdp(set(exp(2*x + 1) < 3),obj,sdpsettings('solver','fmincon')); |
---|
| 7 | |
---|
| 8 | mbg_asserttrue(sol.problem == 0) |
---|
| 9 | mbg_asserttolequal(double(obj),-0.04930614506222, 1e-4); |
---|
| 10 | |
---|
| 11 | sdpvar x y |
---|
| 12 | obj = -x-y; |
---|
| 13 | sol = solvesdp(set(exp(max([2*x+1 3*y+2])) < 3),obj,sdpsettings('solver','fmincon')); |
---|
| 14 | |
---|
| 15 | mbg_asserttrue(sol.problem == 0) |
---|
| 16 | mbg_asserttolequal(double(obj),0.25115642610991, 1e-4); |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | sdpvar x y |
---|
| 20 | obj = -x-y; |
---|
| 21 | sol = solvesdp(set(exp(min([2*x+1 3*y+2])) < 3),obj,sdpsettings('solver','fmincon','warning',0)); |
---|
| 22 | mbg_asserttrue(sol.problem == -4) |
---|
| 23 | |
---|
| 24 | sdpvar x y |
---|
| 25 | obj = -x-y; |
---|
| 26 | sol = solvesdp(set(max([exp(2*x+1) exp(3*y+2)]) < 3),obj,sdpsettings('solver','fmincon')); |
---|
| 27 | |
---|
| 28 | mbg_asserttrue(sol.problem == 0) |
---|
| 29 | mbg_asserttolequal(double(obj),0.25115642610991, 1e-4); |
---|
Note: See
TracBrowser
for help on using the repository browser.