1 | function res = isrelaxfeasible(F) |
---|
2 | |
---|
3 | |
---|
4 | % Author Johan Löfberg |
---|
5 | % $Id: isrelaxfeasible.m,v 1.3 2005/02/04 10:10:27 johanl Exp $ |
---|
6 | |
---|
7 | % Check if solution avaliable |
---|
8 | currsol = evalin('caller','sdpvar(''getSolution'')'); |
---|
9 | if isempty(currsol) |
---|
10 | disp('No solution available.') |
---|
11 | return |
---|
12 | end |
---|
13 | |
---|
14 | nlmi = size(F.clauses,2); |
---|
15 | spaces = [' ']; |
---|
16 | if (nlmi == 0) & (neq == 0) |
---|
17 | disp('empty LMI') |
---|
18 | return |
---|
19 | end |
---|
20 | |
---|
21 | lmiinfo{1} = 'LMI'; |
---|
22 | lmiinfo{2} = 'Element-wise'; |
---|
23 | lmiinfo{3} = 'Equality constraint'; |
---|
24 | lmiinfo{4} = 'Second order cone constraint'; |
---|
25 | lmiinfo{5} = 'Rotated Lorentz constraint'; |
---|
26 | |
---|
27 | header = {'ID','Constraint','Type','Residual (should be > 0)','Tag'}; |
---|
28 | |
---|
29 | if nlmi>0 |
---|
30 | for j = 1:nlmi |
---|
31 | F0 = relaxdouble(F.clauses{j}.data); |
---|
32 | if any(isnan(F0(:))) |
---|
33 | res = NaN; |
---|
34 | else |
---|
35 | switch F.clauses{j}.type |
---|
36 | case 1 |
---|
37 | res = min(eig(F0)); |
---|
38 | case 2 |
---|
39 | res = min(min(F0)); |
---|
40 | case 3 |
---|
41 | res = -max(max(abs(F0))); |
---|
42 | case 4 |
---|
43 | res = F0(1)-norm(F0(2:end)); |
---|
44 | case 5 |
---|
45 | res = 2*F0(1)*F0(2)-norm(F0(3:end))^2 |
---|
46 | end |
---|
47 | end |
---|
48 | data{j,1} = ['#' num2str(j)]; |
---|
49 | data{j,2} = F.clauses{j}.symbolic; |
---|
50 | data{j,3} = lmiinfo{F.clauses{j}.type}; |
---|
51 | data{j,4} = res; |
---|
52 | data{j,5} = F.clauses{j}.handle; |
---|
53 | end |
---|
54 | end |
---|
55 | |
---|
56 | res = [data{:,4}]; |
---|