Line | |
---|
1 | function [equalities,redundant] = mpt_detect_fixed_rows(Matrices) |
---|
2 | |
---|
3 | A = [ Matrices.G -Matrices.E]; |
---|
4 | b = Matrices.W; |
---|
5 | lb = Matrices.lb; |
---|
6 | ub = Matrices.ub; |
---|
7 | |
---|
8 | fixed = find(lb == ub); |
---|
9 | if ~isempty(fixed) |
---|
10 | b = b-A(:,fixed)*lb(fixed); |
---|
11 | A(:,fixed) = []; |
---|
12 | ub(fixed)=[]; |
---|
13 | lb(fixed)=[]; |
---|
14 | end |
---|
15 | |
---|
16 | [AA, BB, AAeq, BBeq,indeq] = mpt_ineq2eq(A, b); |
---|
17 | if ~isempty(indeq) |
---|
18 | i = indeq(:,1); |
---|
19 | j = indeq(:,2); |
---|
20 | equalities = unique(i); |
---|
21 | redundant = unique([i;j]); |
---|
22 | equalities = setdiff(equalities,intersect(i,j)); % The case [43 51;51 89;89 97] |
---|
23 | AL0A = (A>0).*A; |
---|
24 | AG0A = (A<0).*A; |
---|
25 | bi_up = AL0A*ub+AG0A*lb; |
---|
26 | redundant = unique([redundant;find([bi_up<b])]); |
---|
27 | else |
---|
28 | AL0A = (A>0).*A; |
---|
29 | AG0A = (A<0).*A; |
---|
30 | bi_up = AL0A*ub+AG0A*lb; |
---|
31 | redundant = unique(find(bi_up<b)); |
---|
32 | equalities = []; |
---|
33 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.