OptimizationSNOPT.jl: SNOPT for Optimization.jl
OptimizationSNOPT.jl connects SNOPT, a commercial solver for large, sparse, constrained nonlinear optimization problems, to Optimization.jl. A problem defined as an OptimizationProblem is solved with SNOPT by passing SnoptOptimizer to solve, and the derivatives that SNOPT needs come from any automatic differentiation backend that Optimization.jl supports, so the objective and the constraints can stay ordinary Julia functions.
OptimizationSNOPT.jl solves problems of the form
\[\begin{aligned} \min_{x \in \mathbb{R}^n} \quad & f(x, p) \\ \text{subject to} \quad & l_x \le x \le u_x, \\ & l_c \le c(x, p) \le u_c, \end{aligned}\]
where $f$ is the objective, $c$ is a vector of constraint functions, $p$ holds the parameters, and the bounds can be infinite. SNOPT uses a sequential quadratic programming (SQP) method, so $f$ and $c$ must be smooth.
OptimizationSNOPT.jl does not include SNOPT. A SNOPT license and a compatible libsnopt7 shared library are available from the SNOPT distributors.
When to use OptimizationSNOPT.jl
With OptimizationSNOPT.jl, the same problem can be solved with SNOPT and with the other Optimization.jl solvers, and the derivatives come from automatic differentiation. The package is built on SNOPT.jl, which wraps the three SNOPT interfaces snOptA, snOptB and snOptC; use SNOPT.jl directly for linear constraints given separately, finite-difference derivatives estimated by SNOPT, or warm and hot starts.
Installation
Install the package with the Julia package manager:
using Pkg
Pkg.add("OptimizationSNOPT")Then, before starting Julia, set SNOPTDIR to the directory of the SNOPT library:
export SNOPTDIR=/path/to/snopt/libInstallation gives the commands for Windows and the setup check.
Contents
Tutorial and installation
The tutorial solves a first problem with bounds and nonlinear constraints. The installation page makes the SNOPT library available to Julia.
How-to guides
Each guide shows how to do one task with OptimizationSNOPT.jl.
Solver behaviour and reference
The solver behaviour page explains return codes, SNOPT results and limits. The API reference lists every exported type.
Contributing
- Report bugs and request features on the issue tracker.
- Before opening a pull request, run the test suite with
julia --project=. -e 'using Pkg; Pkg.test()'from the repository root. The solver tests run only when Julia finds a licensedlibsnopt7. - To build this manual, run
julia --project=docs -e 'using Pkg; Pkg.instantiate()'and thenjulia --project=docs docs/make.jlfrom the repository root. The build runs the examples when it finds the SNOPT library;SNOPT_DOCTESTS=falseskips them. The pages are written todocs/build/.