OptimLib is a lightweight C++ library of numerical optimization methods for nonlinear functions.


  • A C++11 library of local and global optimization algorithms, as well as root finding techniques.

  • Derivative-free optimization using advanced, parallelized metaheuristic methods.

  • Constrained optimization routines to handle simple box constraints, as well as systems of nonlinear constraints.

  • For fast and efficient matrix-based computation, OptimLib supports the following templated linear algebra libraries:

  • OpenMP-accelerated algorithms for parallel computation.

  • Straightforward linking with parallelized BLAS libraries, such as OpenBLAS.

  • Available as a header-only library, or as a compiled shared library.

  • Released under a permissive, non-GPL license.

Author: Keith O’Hara

License: Apache Version 2.0


The library can be installed on Unix-alike systems via the standard ./configure && make method.

See the installation page for detailed instructions.


A list of currently available algorithms includes:

  • Broyden’s Method (for root finding)

  • Newton’s method, BFGS, and L-BFGS

  • Gradient descent: basic, momentum, Adam, AdaMax, Nadam, NadaMax, and more

  • Nonlinear Conjugate Gradient

  • Nelder-Mead

  • Differential Evolution (DE)

  • Particle Swarm Optimization (PSO)