Line | |
---|
1 | function feasible = checkfeasiblefast(p,x,tol) |
---|
2 | |
---|
3 | feasible = 0; |
---|
4 | if ~(all(x < p.ub+tol) & all(x > p.lb-tol)); |
---|
5 | return |
---|
6 | end |
---|
7 | |
---|
8 | if ~isempty(p.F_struc) |
---|
9 | vecres = p.F_struc*[1;x]; |
---|
10 | |
---|
11 | if p.K.f>0 |
---|
12 | if any( -abs(vecres(1:p.K.f)) < - tol) |
---|
13 | return |
---|
14 | end |
---|
15 | end |
---|
16 | |
---|
17 | if p.K.l>0 |
---|
18 | if any(vecres(p.K.f+1:p.K.f+p.K.l) <-tol) |
---|
19 | return |
---|
20 | end |
---|
21 | end |
---|
22 | |
---|
23 | if p.K.q(1)>0 |
---|
24 | top = 1+p.K.f+p.K.l; |
---|
25 | for i = 1:length(p.K.q) |
---|
26 | n = p.K.q(i); |
---|
27 | X = vecres(top:top+n-1);top = top+n; |
---|
28 | if any(X(1)-norm(full(X(2:end))) < -tol) |
---|
29 | return |
---|
30 | end |
---|
31 | end |
---|
32 | end |
---|
33 | |
---|
34 | if p.K.s(1)>0 |
---|
35 | top = 1+p.K.f+p.K.l+p.K.q; |
---|
36 | for i = 1:length(p.K.s) |
---|
37 | n = p.K.s(i); |
---|
38 | X = reshape(vecres(top:top+n^2-1),n,n);top = top+n^2; |
---|
39 | if min(eig(X)) < -tol |
---|
40 | return |
---|
41 | end |
---|
42 | end |
---|
43 | end |
---|
44 | end |
---|
45 | feasible = 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.