Nonconvex
Nonconvex.jl
is an umbrella package over implementations and wrappers of a number of nonconvex constrained optimization algorithms and packages making use of automatic differentiation. Zero, first and second order methods are available. Nonlinear equality and inequality constraints as well as integer constraints are supported. A detailed description of all the algorithms and features available in Nonconvex
can be found in the documentation.
The JuliaNonconvex
organization
The JuliaNonconvex
organization hosts a number of packages which are available for use in Nonconvex.jl
. The correct package is loaded using the Nonconvex.@load
macro with the algorithm or package name. See the documentation for more details. The following is a summary of all the packages in the JuliaNonconvex
organization.
Package | Description | Tests | Coverage |
---|---|---|---|
Nonconvex.jl | Umbrella package for nonconvex optimization | ||
NonconvexCore.jl | All the interface functions and structs | ||
NonconvexMMA.jl | Method of moving asymptotes implementation | ||
NonconvexIpopt.jl | Ipopt.jl wrapper | ||
NonconvexNLopt.jl | NLopt.jl wrapper | ||
NonconvexPercival.jl | Percival.jl wrapper (an augmented Lagrangian algorithm implementation) | ||
NonconvexJuniper.jl | Juniper.jl wrapper | ||
NonconvexPavito.jl | Pavito.jl wrapper | ||
NonconvexSemidefinite.jl | Nonlinear semi-definite programming algorithm | ||
NonconvexMultistart.jl | Multi-start optimization algorithms | ||
NonconvexBayesian.jl | Constrained Bayesian optimization implementation | ||
NonconvexSearch.jl | Multi-trajectory and local search methods | ||
NonconvexAugLagLab.jl | Experimental augmented Lagrangian package | ||
NonconvexUtils.jl | Some utility functions for automatic differentiation, history tracing, implicit functions and more. | ||
NonconvexTOBS.jl | Binary optimization algorithm called "topology optimization of binary structures" (TOBS) which was originally developed in the context of optimal distribution of material in mechanical components. |
Design philosophy
Nonconvex.jl is a Julia package that implements and wraps a number of constrained nonlinear and mixed integer nonlinear programming solvers. There are 3 features of Nonconvex.jl compared to similar packages such as JuMP.jl and NLPModels.jl:
- Emphasis on a function-based API. Objectives and constraints are normal Julia functions.
- The ability to nest algorithms to create more complicated algorithms.
- The ability to automatically handle structs and different container types in the decision variables by automatically vectorizing and un-vectorizing them in an AD compatible way.
Installing Nonconvex
To install Nonconvex.jl, open a Julia REPL and type ]
to enter the package mode. Then run:
add Nonconvex
Alternatively, copy and paste the following code to a Julia REPL:
using Pkg; Pkg.add("Nonconvex")
Loading Nonconvex
To load and start using Nonconvex.jl, run:
using Nonconvex
Quick example
using Nonconvex
Nonconvex.@load NLopt
f(x) = sqrt(x[2])
g(x, a, b) = (a*x[1] + b)^3 - x[2]
model = Model(f)
addvar!(model, [0.0, 0.0], [10.0, 10.0])
add_ineq_constraint!(model, x -> g(x, 2, 0))
add_ineq_constraint!(model, x -> g(x, -1, 1))
alg = NLoptAlg(:LD_MMA)
options = NLoptOptions()
r = optimize(model, alg, [1.0, 1.0], options = options)
r.minimum # objective value
r.minimzer # decision variables
How to contribute?
A beginner? The easiest way to contribute is to read the documentation, test the package and report issues.
An impulsive tester? Improving the test coverage of any package is another great way to contribute to the JuliaNonconvex
org. Check the coverage report of any of the packages above by clicking the coverage badge. Find the red lines in the report and figure out tests that would cover these lines of code.
An algorithm head? There are plenty of optimization algorithms that can be implemented and interfaced in Nonconvex.jl
. You could be developing the next big nonconvex semidefinite programming algorithm right now! Or the next constraint handling method for evolutionary algorithms!
A hacker? Let's figure out how to wrap some optimization package in Julia in the unique, simple and nimble Nonconvex.jl
style.
A software designer? Let's talk about design decisions and how to improve the modularity of the ecosystem.
You can always reach out by opening an issue.