gurobi_options

gurobi_options(overrides, mpopt)

gurobi_options() - Sets options for GUROBI (version 5.x and greater).

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

Sets the values for the options struct normally passed to GUROBI.

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.FeasibilityTol
        verbose          - used to set opt.DisplayInterval,
                              opt.OutputFlag, opt.LogToConsole
        gurobi.method    - used to set opt.Method
        gurobi.timelimit - used to set opt.TimeLimit (seconds)
        gurobi.threads   - used to set opt.Threads
        gurobi.opts      - struct containing values to use as OVERRIDES
        gurobi.opt_fname - name of user-supplied function used as FNAME,
            except with calling syntax:
                MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);
        gurobi.opt       - numbered user option function, if and only if
            gurobi.opt_fname is empty and gurobi.opt is non-zero, the value
            of gurobi.opt_fname is generated by appending gurobi.opt to
            'gurobi_user_options_' (for backward compatibility with old
            MATPOWER option GRB_OPT).

Output is a parameter struct to pass to GUROBI.

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 gurobi.opt_fname or gurobi.opt) is called
    2. gurobi.opts (if not empty) are applied
    3. OVERRIDES are applied

Example:

If gurobi.opt = 3, then after setting the default GUROBI options,
GUROBI_OPTIONS will execute the following user-defined function
to allow option overrides:

    opt = gurobi_user_options_3(opt, mpopt);

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

    function opt = gurobi_user_options_3(opt, mpopt)
    opt.OptimalityTol   = 1e-9;
    opt.BarConvTol      = 1e-9;
    opt.IterationLimit  = 3000;
    opt.BarIterLimit    = 200;
    opt.Crossover       = 0;
    opt.Presolve        = 0;

For details on the available options, see the "Parameters" section
of the "Gurobi Optimizer Reference Manual" at:

    https://www.gurobi.com/documentation/

See also gurobi, mpoption().