API reference

OptimizationSNOPT.jl re-exports OptimizationBase, so OptimizationProblem, OptimizationFunction, solve, init, solve!, reinit! and the automatic differentiation selectors are available after using OptimizationSNOPT. The Optimization.jl documentation describes them.

Optimizer

OptimizationSNOPT.SnoptOptimizer — Type
SnoptOptimizer(; major_iterations_limit = 1000, minor_iterations_limit = 500,
               major_optimality_tolerance = 1.0e-6,
               major_feasibility_tolerance = 1.0e-6,
               minor_feasibility_tolerance = 1.0e-6,
               hessian = "full_memory", derivative_option = 1,
               major_print_level = 1, minor_print_level = 0,
               additional_options = Dict{String, Any}())

Optimization.jl algorithm that solves an OptimizationProblem with SNOPT.

Pass it to solve or init. The problem needs the objective gradient and, if it has constraints, the constraint Jacobian, from an automatic differentiation backend or from the grad and cons_j keywords of OptimizationFunction. See Getting started for a tutorial and Set solver options for the options.

Keywords

  • major_iterations_limit, minor_iterations_limit: iteration limits, positive integers.
  • major_optimality_tolerance: tolerance on the optimality conditions.
  • major_feasibility_tolerance: tolerance on the nonlinear constraint violation.
  • minor_feasibility_tolerance: tolerance on the constraint violation in each subproblem.
  • hessian: "full_memory" or "limited_memory"; use "limited_memory" for many variables.
  • derivative_option: SNOPT Derivative option, 1, 2 or 3; keep the default.
  • major_print_level, minor_print_level: SNOPT print levels, nonnegative integers. SNOPT's print file is not written, so they have no visible effect.
  • additional_options: other SNOPT options, as a dictionary from option name (String or Symbol) to value (integer, finite float, String, Symbol, or nothing for an option without a value). In names and in String and Symbol values, _ stands for a space.

All tolerances must be positive and finite. The solve keywords maxiters, maxtime, abstol and reltol set the SNOPT options Major iterations limit, Time limit (CPU seconds), Major optimality tolerance and Minor feasibility tolerance, and take precedence over the fields.

Throws an ArgumentError for a value of the wrong type or range, for a Bool option value, for an option in additional_options that has its own keyword, or for a duplicate option name. If the SNOPT library is available, the constructor also checks every option with SNOPT in a temporary workspace; this closes any open SNOPT.jl workspace in the same process.

Examples

opt = SnoptOptimizer(major_optimality_tolerance = 1.0e-8,
                     hessian = "limited_memory",
                     additional_options = Dict("Linesearch tolerance" => 0.9))
sol = solve(prob, opt; maxiters = 500)
source

Traces

OptimizationSNOPT.SnoptTraceMinimal — Function
SnoptTraceMinimal(; print_frequency = 1, store_frequency = 1)
SnoptTraceMinimal(frequency::Integer)

Trace level that prints and stores the scalar progress values of each major iteration.

Pass it as the trace_level keyword of solve. A row is printed every print_frequency major iterations and stored every store_frequency major iterations; the second form sets both to frequency. Both must be positive integers. Stored rows have x and c set to nothing. See Monitor and stop a solve.

source
OptimizationSNOPT.SnoptTraceAll — Function
SnoptTraceAll(; print_frequency = 1, store_frequency = 1)
SnoptTraceAll(frequency::Integer)

Trace level that also stores the point and the constraint values of each major iteration.

The keywords are the same as for SnoptTraceMinimal. Each stored row holds copies of x and c, and the printed table has an extra column with the largest bound violation.

source
OptimizationSNOPT.SnoptTrace — Type
SnoptTrace

Rows stored during a solve, available as sol.trace after solve(prob, SnoptOptimizer(); store_trace = Val(true)).

Fields

  • history: vector of SnoptTraceEntry, one per stored row.
  • trace_level: the trace level of the solve.
source
OptimizationSNOPT.SnoptTraceEntry — Type
SnoptTraceEntry

One row of a SnoptTrace.

A value that is not available is NaN, or nothing for the vectors and the status.

Fields

  • iteration: count of major-iteration records since the start of the solve, including those not stored; -1 for the final row.
  • major_iter, minor_iter: number of the major iteration, and number of minor iterations in it.
  • objective: objective value of the original problem.
  • step_norm: length of the last step.
  • constraint_violation: constraint violation, as SNOPT measures it.
  • optimality: error in the optimality conditions, as SNOPT measures it.
  • bound_violation: largest violation of a variable bound.
  • x: copy of the point, with SnoptTraceAll only.
  • c: copy of the constraint values, with SnoptTraceAll only.
  • status: outcome of the solve, a SNOPT.SnoptStatus value, in the final row only.
source