function options = setHiddenFminconOptions(options)
%

%   Copyright 2021 The MathWorks, Inc.
    hiddenNameValuePairs = struct(  ...
        'DeltaComplThresh',       2,... % Increase factor of complementarity to trigger
                                    ... %     step rejection (e.g. increase 2x rejects)
        'SigmaFloor',          0.01,... % Smallest factor of complementarity decrease
        'TangentToFeasThresh',  0.9,... % Coef factor for switching from main cg steps
                                    ... %     to feasibility cg steps
                                    ... %     See Nocedal, et. al (2014); p.844 eqn (17)
        'FeasToTangentThresh',  0.1,... % Coef factor for switching from feasibility cg steps
                                    ... %     to tangential cg steps
                                    ... %     See Nocedal, et. al (2014); p.844 eqn (18)
        'MinIterToFeasMode',      3,... % Minimum iterations before attempting feas mode
                                    ... %     See Nocedal, et. al (2014); p.849
        'InsufInfeasDecrease', 0.01,... % Insufficient infeasibility decrease factor to switch
                                    ... %     Infeas progress must be slower than tol (e.g. 1%)
                                    ... %     Note: factor is defined differently than Nocedal,
                                    ... %     et. al (2014); p.849, defined as 1-zeta
        'MinSwitchViolations',    2,... % Minimum iterations of unsuccessful normal steps
                                    ... %     required before switching modes
                                    ... %     See Nocedal, et. al (2014) p.849
        'SufInfeasDecrease',    0.9,... % Sufficient infeasibility decrease factor to switch
                                    ... %     from feasibility mode to main mode.
                                    ... %     Infeas progress must be greater than tol (e.g. 90%)
                                    ... %     See Nocedal, et. al (2014) p.849
        'ResetAllValid',      false,... % Alternative to the main mode slack reset strategy that
                                    ... %     shows marginal improvement.
        'FeasModeSlackReset',  true,... % Slack mode reset
        'FeasModeRelaxTol', 1e2*options.TolFun);   % Tolerance to detect insufficient progress in feas mode
                                        %     norm(drelax) / norm(relax) < options.FeasModeSlackReset
    
    % set hidden field names above
    fnames = fieldnames(hiddenNameValuePairs);
    
    for i = 1:numel(fnames)
        options.(fnames{i}) = hiddenNameValuePairs.(fnames{i});
    end
    
    % if user has specified any internal options override defaults set above
    if isfield(options,'InternalOptions')
        hiddenNames = fieldnames(options.InternalOptions);
        if ~isempty(hiddenNames)
            for i = 1:numel(hiddenNames)
                options.(hiddenNames{i}) = options.InternalOptions.(hiddenNames{i});
            end
        end
    end
        
end