Rev | Line | |
---|
[37] | 1 | function test_sort |
---|
| 2 | |
---|
| 3 | x = sdpvar(2,1); |
---|
| 4 | |
---|
| 5 | assign(x,1); |
---|
| 6 | sol = solvesdp(set(x > 0.1),-entropy(x),sdpsettings('usex0',1)); |
---|
| 7 | |
---|
| 8 | mbg_asserttrue(sol.problem == 0); |
---|
| 9 | mbg_asserttolequal(double(sum(x)),0.73567246610151,1e-4); |
---|
| 10 | |
---|
| 11 | x1 = sdpvar(1,1); |
---|
| 12 | y = sdpvar(1,1); |
---|
| 13 | x2 = sdpvar(1,1); |
---|
| 14 | x = [x1;x2]; |
---|
| 15 | |
---|
| 16 | assign(x,1); |
---|
| 17 | sol = solvesdp(set([x;y] > 0.1),-entropy(x)+y,sdpsettings('usex0',1)); |
---|
| 18 | |
---|
| 19 | mbg_asserttrue(sol.problem == 0); |
---|
| 20 | mbg_asserttolequal(double(sum(x)),0.73567246610151,1e-4); |
---|
Note: See
TracBrowser
for help on using the repository browser.