source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/modules/global/root_node_tighten.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.9 KB
Line 
1% *************************************************************************
2% Tighten bounds at root
3% *************************************************************************
4function p = root_node_tighten(p,upper);
5p.feasible = all(p.lb<=p.ub) & p.feasible;
6if p.options.bmibnb.roottight & p.feasible
7    lowersolver = eval(['@' p.solver.lowercall]);
8    c = p.c;
9    Q = p.Q;
10    mt = p.monomtable;
11    p.monomtable = eye(length(c));
12    i = 1;
13   
14    % Add an upper bound cut?
15    if (upper < inf)
16        % p.c'*x+p.f < upper
17        p.F_struc = [p.F_struc(1:p.K.f,:);upper-p.f -p.c';p.F_struc(1+p.K.f:end,:)];
18        p.K.l = p.K.l + 1;
19    end
20   
21    while i<=length(p.linears) & p.feasible
22        j = p.linears(i);
23        if p.lb(j) < p.ub(j) & (ismember(j,p.branch_variables) | (p.options.bmibnb.roottight == 2))
24            p.c = eyev(length(p.c),j);
25            output = feval(lowersolver,p);
26            if (output.problem == 0) & (output.Primal(j)>p.lb(j))
27                p.lb(j) = output.Primal(j);
28                p = updateonenonlinearbound(p,j);
29                p = clean_bounds(p);
30            end
31            if output.problem == 1
32                p.feasible = 0;
33            elseif p.lb(j) < p.ub(j) % We might have updated lb
34                p.c = -eyev(length(p.c),j);
35                output = feval(lowersolver,p);
36                if (output.problem == 0) & (output.Primal(j) < p.ub(j))
37                    p.ub(j) = output.Primal(j);
38                    p = updateonenonlinearbound(p,j);
39                    p = clean_bounds(p);
40                end
41                if output.problem == 1
42                    p.feasible = 0;
43                end
44                i = i+1;
45            end
46        else
47            i = i + 1;
48        end
49    end
50    if upper < inf
51        p.F_struc(1+p.K.f,:) = [];
52        p.K.l = p.K.l - 1;
53    end
54    p.lb(p.lb<-1e10) = -inf;
55    p.ub(p.ub>1e10) = inf;
56    p.c = c;
57    p.Q = Q;
58    p.monomtable = mt;
59end
Note: See TracBrowser for help on using the repository browser.