osqp_options

osqp_options(overrides, mpopt)

osqp_options() - Sets options for OSQP.

OPT = OSQP_OPTIONS
OPT = OSQP_OPTIONS(OVERRIDES)
OPT = OSQP_OPTIONS(OVERRIDES, FNAME)
OPT = OSQP_OPTIONS(OVERRIDES, MPOPT)

Sets the values for the settings struct normally passed to OSQP.

Inputs are all optional, second argument must be either a string
(FNAME) or a struct (MPOPT):

    OVERRIDES - struct containing values to override the defaults
    FNAME - name of user-supplied function called after default
        options are set to modify them. Calling syntax is:
                MODIFIED_OPT = FNAME(DEFAULT_OPT);
    MPOPT - MATPOWER options struct, uses the following fields:
        opf.violation  - used to set opt.eps_prim_inf
        verbose        - used to set opt.verbose
        osqp.opts      - struct containing values to use as OVERRIDES
        osqp.opt_fname - name of user-supplied function used as FNAME,
            except with calling syntax:
                MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);

Output is a settings struct to pass to OSQP.

There are multiple ways of providing values to override the default
options. Their precedence and order of application are as follows:

With inputs OVERRIDES and FNAME
    1. FNAME is called
    2. OVERRIDES are applied
With inputs OVERRIDES and MPOPT
    1. FNAME (from osqp.opt_fname) is called
    2. osqp.opts (if not empty) are applied
    3. OVERRIDES are applied

Example:

If osqp.opt_fname = 'osqp_user_options_3', then after setting the
default OSQP options, OSQP_OPTIONS will execute the following
user-defined function to allow option overrides:

    opt = osqp_user_options_3(opt, mpopt);

The contents of osqp_user_options_3.m, could be something like:

    function opt = osqp_user_options_3(opt, mpopt)
    opt.polish = 1;
    opt.alpha  = 1;
    opt.max_iter = 5000;

See the OSQP Solver settings page.

    https://osqp.org/docs/interfaces/solver_settings.html

See also osqp, mpoption().