1 | function [fix_up,fix_down] = presolve_fixvariables(A,b,c,lb,ub,monotinicity) |
---|
2 | |
---|
3 | % These are optimally (or w.l.o.g) set to upper bound |
---|
4 | not_in_obj = find(c<=0); |
---|
5 | % Setting to 1 makes Ax<b increase feasible set for these variables |
---|
6 | constrained_blow = all(-A(:,not_in_obj)>=0,1); |
---|
7 | % and they enter via a psd matrix in all sdp constraints |
---|
8 | sdp_positive = monotinicity(not_in_obj) == -1; |
---|
9 | % these variables satisffy all constraints |
---|
10 | can_fix = not_in_obj(find(constrained_blow & sdp_positive)); |
---|
11 | % these variables are still not fixed |
---|
12 | still_on = find(lb==0 & ub==1); |
---|
13 | % so we can fix these |
---|
14 | fix_up = intersect(can_fix,still_on); |
---|
15 | |
---|
16 | % These are optimally (or w.l.o.g) set to lower bound |
---|
17 | not_in_obj = find(c>=0); |
---|
18 | % Setting to 1 makes Ax<b increase feasible set for these variables |
---|
19 | constrained_blow = all(A(:,not_in_obj)>=0,1); |
---|
20 | % and they enter via a psd matrix in all sdp constraints |
---|
21 | sdp_positive = monotinicity(not_in_obj) == 1; |
---|
22 | % these variables satisffy all constraints |
---|
23 | can_fix = not_in_obj(find(constrained_blow & sdp_positive)); |
---|
24 | % these variables are still not fixed |
---|
25 | still_on = find(lb==0 & ub==1); |
---|
26 | % so we can fix these |
---|
27 | fix_down = intersect(can_fix,still_on); |
---|
28 | |
---|