source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/dev/mpbbmilp.m @ 37

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

Added original make3d

File size: 1.2 KB
Line 
1function [sol,dgn,Z,J] = mpbbmilp(F,obj,options,parametric)
2
3% Figure out binary variables
4binary = recover(intersect(getvariables(F),yalmip('binvariables')));
5
6if isempty(options)
7    options = sdpsettings('relax',1);
8else
9    options = sdpsettings(options,'relax',1);
10end
11
12% Solve relaxed problem recursively
13[sol,dgn,Z,J] = sub_mpmilp(F,obj,options,parametric,binary,[])
14
15function [sol,dgn,Z,J] = sub_mpmilp(F,obj,options,parametric,binary,fixed)
16
17% Solve relaxed problem, extract only binary solution
18disp(['-> Fixed variables : ' num2str(fixed)]);
19
20[sol,dgn,Z,J] = solvemp(F,obj,options,parametric,binary);
21if isempty(sol)
22    return
23end
24
25% Find parametrically integer solutions
26not_integer = find((sum(abs([sol{1}.Fi{:}]),2) >1e-8) | sum(abs([sol{1}.Gi{:}]-round([sol{1}.Gi{:}])),2)>1e-8);
27
28if ~isempty(not_integer)
29
30    j = not_integer(1);
31
32    sol_down = sub_mpmilp(F+set(binary(j) == 0),obj,options,parametric,binary,[fixed -j]);
33    sol_up   = sub_mpmilp(F+set(binary(j) == 1),obj,options,parametric,binary,[fixed j]);
34   
35    if isempty(sol_down)
36        sol = sol_up;
37    elseif isempty(sol_up)
38        sol = sol_down;
39    else
40        sol = {rmovlps({sol_down{1},sol_up{1}})};
41    end
42else
43    disp('-> Integer node found')
44end
45
46
47
Note: See TracBrowser for help on using the repository browser.