Rev | Line | |
---|
[37] | 1 | function ex14_1_1 |
---|
| 2 | |
---|
| 3 | sdpvar x1 x2 x3 objvar |
---|
| 4 | |
---|
| 5 | F = set([]); |
---|
| 6 | F = F + set(- x3 + objvar == 0); |
---|
| 7 | F = F + set(2*sqr(x2) + 4*x1*x2 - 42*x1 + 4*POWER(x1,3) - x3 <= 14); |
---|
| 8 | F = F + set((-2*sqr(x2)) - 4*x1*x2 + 42*x1 - 4*POWER(x1,3) - x3 <= -14); |
---|
| 9 | F = F + set(2*sqr(x1) + 4*x1*x2 - 26*x2 + 4*POWER(x2,3) - x3 <= 22); |
---|
| 10 | F = F + set((-2*sqr(x1)) - 4*x1*x2 + 26*x2 - 4*POWER(x2,3) - x3 <= -22); |
---|
| 11 | F = F + set(5 > x1 > -5) + set(-5 < x2 < 5); |
---|
| 12 | |
---|
| 13 | sol = solvesdp(F,objvar,sdpsettings('solver','bmibnb')) |
---|
| 14 | |
---|
| 15 | mbg_asserttolequal(sol.problem,0); |
---|
| 16 | mbg_asserttolequal(double(objvar), 0, 1e-4); |
---|
| 17 | |
---|
| 18 | double([x1 x2 x3]) |
---|
| 19 | |
---|
| 20 | function y = sqr(x) |
---|
| 21 | y = x*x; |
---|
Note: See
TracBrowser
for help on using the repository browser.