function options = mpcActiveSetOptions(type0)
% mpcActiveSetOptions  Creates a default set of options for mpcActiveSetSolver.
%
% options = mpcActiveSetOptions() creates a structure, containing
% default values for options used in mpcActiveSetSolver, which solves a
% quadratic programming (QP) problem using a primal-dual method with
% Mehrotra predictor-corrector step. 
%
% Output argument "options" is a structure with the following fields:
%
%                  DataType: string, either 'double' or 'single'.  All the
%                            real input arguments must match this data type
%                            and it is used in both simulation and code
%                            generation. 
%                            Default value is 'double'. 
%
%             MaxIterations: scalar, maximum number of iterations allowed
%                            when computing QP solution.  
%                            Default value is 200. 
%
%       ConstraintTolerance: scalar, tolerance on constraint violation for 
%                            inequality constraints.
%                            Default value is 1e-6.
%
%         UseHessianAsInput: logical scalar (true/false).  If true, the
%                            first input of "mpcActiveSetSolver" should be
%                            the Hessian matrix.  If false, it should be
%                            inverse of L, where L is the lower-triangular
%                            Cholesky decomposition of "H".
%                            Default value is true.
%
%           IntegrityChecks: logical scalar (true/false).  If true, solver
%                            performs integrity checks on your input data
%                            and provides diagnostic messages.  If false,
%                            no such checks are performed.   Recommend
%                            using false for code generation only.  
%                            Default value is true.
%
% options = mpcActiveSetOptions(type) allows you to explicitly specify the
% data type.  "type" must be a string: 'double' or 'single'.
%
% see also:  mpcActiveSetSolver, mpcInteriorPointSolver

% Author:  N. L. Ricker
% Copyright 1994-2015 The MathWorks, Inc.

%#codegen
narginchk(0,1);
if nargin==0
    type0 = 'double';
end
validateattributes(type0,{'string','char'},{'scalartext'},'mpcActiveSetOptions','"type"');
type = lower(char(validatestring(type0,{'double', 'single'},'mpcActiveSetOptions')));
% initialize with correct data type
ONE = ones(type);
options = struct('DataType',type,...
                 'MaxIterations',ONE*200,...
                 'ConstraintTolerance',ONE*1e-6,...
                 'UseHessianAsInput',true,...
                 'IntegrityChecks',true);
