[37] | 1 | % ************************************************************************* |
---|
| 2 | % Tighten bounds at root |
---|
| 3 | % ************************************************************************* |
---|
| 4 | function p = root_node_tighten(p,upper); |
---|
| 5 | p.feasible = all(p.lb<=p.ub) & p.feasible; |
---|
| 6 | if 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; |
---|
| 59 | end |
---|