Set solver options

Solver settings come from two places. The common Optimization.jl keywords of solve, such as maxiters, apply to the call. The fields of SnoptOptimizer hold SNOPT settings, including any option from the SNOPT option reference. When both set the same SNOPT option, the solve keyword wins.

Common solve keywords

sol = solve(prob, SnoptOptimizer(); maxiters = 500, abstol = 1.0e-8)
KeywordSNOPT optionMeaning
maxitersMajor iterations limitMaximum number of major iterations.
maxtimeTime limitMaximum CPU time of the solve, in seconds.
abstolMajor optimality toleranceTolerance on the optimality conditions.
reltolMinor feasibility toleranceTolerance on the constraint violation in each QP subproblem. Not a relative tolerance.

The solve keywords are applied after the optimizer fields and additional_options, so reltol, for example, replaces minor_feasibility_tolerance. The keywords callback, verbose, trace_level and store_trace are described in Monitor and stop a solve.

Optimizer fields

opt = SnoptOptimizer(major_iterations_limit = 2_000,
                     major_optimality_tolerance = 1.0e-8,
                     hessian = "limited_memory")
sol = solve(prob, opt)
FieldDefaultSNOPT option
major_iterations_limit1000Major iterations limit
minor_iterations_limit500Minor iterations limit
major_optimality_tolerance1.0e-6Major optimality tolerance
major_feasibility_tolerance1.0e-6Major feasibility tolerance
minor_feasibility_tolerance1.0e-6Minor feasibility tolerance
hessian"full_memory"Hessian full memory or Hessian limited memory
derivative_option1Derivative option; keep the default
major_print_level, minor_print_level1, 0Major print level, Minor print level
additional_optionsemptyAny other option; see below

SNOPT approximates the Hessian of the Lagrangian from the change in the gradients between iterations. Use hessian = "limited_memory" for problems with many variables: SNOPT then keeps only a few recent updates instead of a full matrix.

OptimizationSNOPT.jl does not write SNOPT's print file or summary file, so the print levels have no visible effect. To see the progress of a solve, use verbose = true (see Monitor and stop a solve).

Other SNOPT options

Pass any other SNOPT option in additional_options, as a dictionary from option name to value:

opt = SnoptOptimizer(additional_options = Dict("Linesearch tolerance" => 0.9,
                                               :scale_option => 1))
PartAllowed values
NameA String or a Symbol. _ stands for a space, and case does not matter.
ValueAn integer, a finite floating-point number, a String or Symbol (_ stands for a space), or nothing for an option without a value.

The SNOPT option reference gives all names, default values and meanings. An option that already has a field in SnoptOptimizer cannot appear in additional_options.

Errors in options

SnoptOptimizer checks its fields when it is constructed and throws an ArgumentError for a value of the wrong type or range, for true or false as an option value, for an option in additional_options that has its own field, or for an option name that appears twice. If the SNOPT library is available, the constructor also passes every option to SNOPT in a temporary workspace, so an option that SNOPT does not accept fails at construction, not during the solve.

The SNOPT library allows one active session, the workspace, per Julia process. The constructor and each solve open a workspace, so they close any SNOPT.jl workspace that is open in the same process; see One solve at a time.