%% Return quadprog Lagrange Multipliers
% Solve a quadratic programming problem and return the Lagrange multipliers.

H = [1,-1,1
    -1,2,-2
    1,-2,4];
f = [-7;-12;-15];
A = [1,1,1];
b = 3;
lb = zeros(3,1);
[x,fval,exitflag,output,lambda] = quadprog(H,f,A,b,[],[],lb);

% Examine the Lagrange multiplier structure lambda.

disp(lambda)

% The linear inequality constraint has an associated Lagrange multiplier of 12.
% Display the multipliers associated with the lower bound.

disp(lambda.lower)

% Only the first component of lambda.lower has a nonzero multiplier. This generally means that only the first component of x is at the lower bound of zero. Confirm by displaying the components of x.

disp(x)

% Copyright 2018 The MathWorks, Inc.