nloptr v1.2.2.2


Monthly downloads



R Interface to NLopt

Solve optimization problems using an R interface to NLopt. NLopt is a free/open-source library for nonlinear optimization, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. See <> for more information on the available algorithms. During installation of nloptr on Unix-based systems, the installer checks whether the NLopt library is installed on the system. If the NLopt library cannot be found, the code is compiled using the NLopt source included in the nloptr package.



Build Status

nloptr is an R interface to NLopt. NLopt is a free/open-source library for nonlinear optimization started by Steven G. Johnson, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. It can be used to solve general nonlinear programming problems with nonlinear constraints and lower and upper bounds for the controls, such as

                             min      f(x)
                           x in R^n

                           s.t.       g(x) <= 0
                                      h(x)  = 0
                                lb <=   x  <= ub

The NLopt library is available under the GNU Lesser General Public License (LGPL), and the copyrights are owned by a variety of authors. See the website for information on how to cite NLopt and the algorithms you use. The R interface to NLopt, also under LGPL, can be downloaded from CRAN or GitHub (development version).


For most versions of R nloptr can be installed from R with


Development version

The most recent (experimental) version can be installed from source from GitHub


For this to work on Windows, you need to have Rtools and NLopt installed, and set an environment variable NLOPT_HOME with the location of the NLopt library.


This package is distributed in the hope that it may be useful to some. The usual disclaimers apply (downloading and installing this software is at your own risk, and no support or guarantee is provided, I don't take liability and so on), but please let me know if you have any problems, suggestions, comments, etc.


  • - static libraries of NLopt 2.4 compiled for Windows 32-bit and 64-bit.
  • nloptr.pdf - an R vignette describing how to use the R interface to NLopt.
  • - description of how to install nloptr from source for Windows.


A full version of the changelog can be found on CRAN

Date Description
27/01/2014 Version 1.0.0 merged wrappers from the 'nloptwrap' package.
19/11/2013 Version 0.9.6 Added a line in Makevars to replace some code in NLopt to fix compilation on Solaris as requested by Brian Ripley.
12/11/2013 Version 0.9.5 Updated references from NLopt version 2.3 to NLopt version 2.4 in installation instructions. in Added a line in Makevars that replaces some code related to type-casting in NLopt-2.4/isres/isres.c. Changed encoding of src/nloptr.c from CP1252 to UTF-8.
09/11/2013 Version 0.9.4 updated NLopt to version 2.4.
31/07/2013 Version 0.9.3 was a maintainance release.
11/07/2013 Version 0.9.2 was a maintainance release.
31/04/2013 Version 0.9.0 has a new print_level = 3, and is compiled with NLopt version 2.3 with --with-cxx option. This makes the StoGo algorithm available.
18/11/2011 Version 0.8.9 removed some warnings from R CMD check and included some changes to the build process.
28/09/2011 Version 0.8.8 updated to compile on Solaris.
03/09/2011 Version 0.8.5 includes a working binary for MacOS.
12/08/2011 Version 0.8.4 includes a new function nloptr.print.options, and has new options (print_options_doc, and population and ranseed for stochastic global solvers).
24/07/2011 Version 0.8.3 has a finite difference derivative checker and includes checks to prevent adding constraints to a problem when the chosen algortihm does not allow for constraints.
09/07/2011 Version 0.8.2 is on CRAN with an updated build process and a newer version of NLopt.
13/01/2011 Version 0.8.1 contains an option print_level to control intermediate output.


Steven G. Johnson, The NLopt nonlinear-optimization package,

Functions in nloptr

Name Description
auglag Augmented Lagrangian Algorithm
direct DIviding RECTangles Algorithm for Global Optimization
isres Improved Stochastic Ranking Evolution Strategy
cobyla Constrained Optimization by Linear Approximations
ccsaq Conservative Convex Separable Approximation with Affine Approximation plus Quadratic Penalty
check.derivatives Check analytic gradients of a function using finite difference approximations
lbfgs Low-storage BFGS
bobyqa Bound Optimization by Quadratic Approximation
crs2lm Controlled Random Search
mlsl Multi-level Single-linkage
mma Method of Moving Asymptotes
nloptr.get.default.options Return a data.frame with all the options that can be supplied to nloptr.
is.nloptr R interface to NLopt
nl.grad Numerical Gradients and Jacobians
nloptr-package R interface to NLopt
nl.opts Setting NL Options
sbplx Subplex Algorithm
nloptr.print.options Print description of nloptr options
tnewton Preconditioned Truncated Newton
varmetric Shifted Limited-memory Variable-metric
slsqp Sequential Quadratic Programming (SQP)
neldermead Nelder-Mead Simplex
nloptr R interface to NLopt
print.nloptr Print results after running nloptr
newuoa New Unconstrained Optimization with quadratic Approximation
stogo Stochastic Global Optimization
No Results!

Vignettes of nloptr

No Results!

Last month downloads


Type Package
Date 2020-07-02
SystemRequirements A system installation of NLopt >= 2.4.0 (with headers) will be used if available.
License LGPL-3
LazyLoad yes
NeedsCompilation yes
VignetteBuilder knitr
RoxygenNote 6.1.0
Packaged 2020-07-02 17:30:38 UTC; ripley
Repository CRAN
Date/Publication 2020-07-02 17:32:14 UTC

Include our badge in your README