function [x, lambda]=lplarge(c, A, b, vlb, vub, x0, numeq, itermx, useSpecs)
%lplarge     Linear programming (using MINOS).                   
%       x=lplarge(c,A,b) solves the linear programming problem:
%        
%            min c'x    subject to:   Ax <= b 
%             x
%   
%       [x,lambda]=lplarge(c,A,b) returns the set of Lagrangian multipliers,
%       lambda, at the solution. 
%
%       x=lplarge(c,A,b,vlb,vub) defines a set of lower and upper
%       bounds on the design variables, x, so that the solution is always in
%       the range vlb <= x <= vub.
%
%       x=lplarge(c,A,b,vlb,vub,x0) sets the initial starting point to x0.
%
%       x=lplarge(c,A,b,vlb,vub,x0,numeq) indicates that the first 
%       numeq constraints defined by A and b are equality constraints.
%
%       x=lplarge(c,A,b,vlb,vub,x0,numeq,itermx) sets the maximum number of 
%       iterations to itermx
%
%       x=lplarge(c,A,b,vlb,vub,x0,numeq,itermx,useSpecs) reads a SPECS 
%       file from "fort.4" if useSpecs is nonzero

%Check for the # of input and output variables:

if (( nargin < 3) | (nargin > 9) )
  error('Wrong # of input parameters');
end;

big = 1.0e20;
n = length(c);

if nargin<9
  useSpecs = 0;
if nargin<8
  itermx = 10000;
if nargin<7
  numeq = 0;
  if nargin<6
    x0 = zeros(n,1);
    if nargin<5
      vub=big*ones(n,1);
      if nargin<4
	vlb = -big*ones(n,1);
      end
    end
  end
end
end
end

if ( length(vlb) ~= n )
  error('Wrong # of lower bounds.');
end;
if ( length(vub) ~= n )
  error('Wrong # of upper bounds.');
end;
if ( (nargout < 1) | (nargout >2) )
  error('Wrong # of output variables!');
end;

% concatenate the objective row at the bottom of matrix A for minoss
A=sparse([A; c']);

m=length(b)+1;
bl=[vlb; -b(1:numeq); -b(numeq+1:m-1); -big]; % No bound on the objective row
bu=[vub; -b(1:numeq); big*ones(m-numeq-1,1); big];

[x,lambda]=milplarge(x0, A, bl, bu, itermx, useSpecs);

x = x(1:n);
lambda = lambda(1:m-1);

return; 
