The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

nloptr

R-CMD-check test-coverage Codecov test coverage pkgdown CRAN status

nloptr is an R interface to NLopt, 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_{x \in \mathbb{R}^n} \quad f(x), \]

s.t. \(g(x) \le 0\), \(h(x) = 0\) and \(\ell \le x \le u\).

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.

Installation

Windows

On Windows, either the latest version 2.7.1 of NLopt from rwinlib (windows-release) or the v2.7.1 build from the rtools42 toolchain (windows2022-devel) is used. So there is nothing else to be done.

Linux and macOS

On Unix-like platforms, we use pkg-config to find a suitable system build of NLopt (i.e. with version >= 2.7.0).

Installing CMake (macOS and Linux only)

Minimal version requirement for cmake is 3.2.0.

You can install CMake by following CMake installation instructions. The important thing is that you add the CMake binary to your PATH:

Alternatively, you can set an environment variable CMAKE_BIN pointing to a CMake binary of your liking on your computer for nloptr to use.

Installing nloptr

You can install nloptr from CRAN using:

install.packages("nloptr")

Alternatively, you can install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("astamm/nloptr")

Acknowledgments

I would like to express my sincere gratitude to Dirk Eddelbuettel, Jeroen Ooms, Tomas Kalibera, Uwe Ligges and Jelmer Ypma for their contributions and the very instructive discussions about the pros and cons of various build strategies in R packages.

Reference

Steven G. Johnson, The NLopt nonlinear-optimization package, https://nlopt.readthedocs.io/en/latest/

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.