% J. Ramakrishnan, 2014/07/14
% example driver script for gamsqp M-function

clear,clc;

H = eye(3);
f = [0;1;0];
Aineq = [1,1,1;-1,0,1];
bineq = [1;-0.5];
Aeq = [1,1,1];
beq = 0;
lb = [-10;-10;-10];
ub = [0.5;0.5;0.5];

[x,fval,modelstatus,output,lambda] = gamsqp(H,f)
[x,fval,modelstatus,output,lambda] = gamsqp(H,f,Aineq,bineq)
[x,fval,modelstatus,output,lambda] = gamsqp(H,f,Aineq,bineq,Aeq,beq)
[x,fval,modelstatus,output,lambda] = gamsqp(H,f,Aineq,bineq,Aeq,beq,lb,ub)

% show example where structure input useful: minimize objective with H, f, with bounds lb and ub
lb = [-0.5;-0.5;-0.5];
ub = [10;10;10];
[x,fval,modelstatus,output,lambda] = gamsqp(H,f,[],[],[],[],lb,ub)
s.H = H;
s.f = f;
s.lb = lb;
s.ub = ub;
[x,fval,modelstatus,output,lambda] = gamsqp(s)
