source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/solvers/calllinprog.m @ 37

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

Added original make3d

File size: 2.6 KB
Line 
1function output = calllinprog(interfacedata)
2
3% Author Johan Löfberg
4% $Id: calllinprog.m,v 1.6 2005/05/07 13:53:20 joloef Exp $
5
6% Standard input interface
7options = interfacedata.options;
8F_struc = interfacedata.F_struc;
9c       = interfacedata.c;
10K       = interfacedata.K;
11Q       = interfacedata.Q;
12lb      = interfacedata.lb;
13ub      = interfacedata.ub;
14
15showprogress('Calling LINPROG',options.showprogress);
16
17if isempty(F_struc)
18    Aeq = [];
19    beq = [];
20    A = [];
21    b = [];
22else
23    Aeq = -F_struc(1:1:K.f,2:end);
24    beq = F_struc(1:1:K.f,1);       
25    A =-F_struc(K.f+1:end,2:end);
26    b = F_struc(K.f+1:end,1);   
27end
28solvertime = clock;
29
30switch options.verbose
31case 0
32    options.linprog.Display = 'off';
33case 1
34    options.linprog.Display = 'final';
35otherwise
36    options.linprog.Display = 'iter';
37end
38
39if isfield(options.linprog,'LargeScale')
40    if ~isequal(options.linprog.LargeScale,'on')
41        Q = full(Q);
42        c = full(c);
43        A = full(A);
44        b = full(b);
45        Aeq = full(Aeq);
46        beq = full(beq);
47    end
48end
49
50if options.savedebug
51    ops = options.linprog;
52    save linprogdebug c A b Aeq beq lb ub ops
53end
54
55[x,fmin,flag,output,lambda] = linprog(c, A, b, Aeq, beq, lb, ub, [],options.linprog);
56solvertime = etime(clock,solvertime);
57problem = 0;
58
59% Internal format for duals
60D_struc = [lambda.eqlin;lambda.ineqlin];
61
62% Check, currently not exhaustive...
63if flag==0
64    problem = 3;
65else
66    if flag>0
67        problem = 0;
68    else
69        if isempty(x)
70            x = repmat(nan,length(c),1);
71        end
72        if any((A*x-b)>sqrt(eps)) | any( abs(Aeq*x-beq)>sqrt(eps))
73            problem = 1; % Likely to be infeasible
74        else
75            if c'*x<-1e10 % Likely unbounded
76                problem = 2;
77            else          % Probably convergence issues
78                problem = 5;
79            end
80        end
81    end
82end
83infostr = yalmiperror(problem,'LINPROG');       
84
85% Save all data sent to solver?
86if options.savesolverinput
87    solverinput.A = A;
88    solverinput.b = b;
89    solverinput.Aeq = Aq;
90    solverinput.beq = beq;
91    solverinput.c = c;
92    solverinput.options = options.linprog;
93else
94    solverinput = [];
95end
96
97% Save all data from the solver?
98if options.savesolveroutput
99    solveroutput.x = x;
100    solveroutput.fmin = fmin;
101    solveroutput.flag = flag;
102    solveroutput.output=output;
103else
104    solveroutput = [];
105end
106
107% Standard interface
108output.Primal      = x(:);
109output.Dual        = D_struc;
110output.Slack       = [];
111output.problem     = problem;
112output.infostr     = infostr;
113output.solverinput = solverinput;
114output.solveroutput= solveroutput;
115output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.