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
s.t. , and .
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.
On Unix-like platforms, we use
pkg-config to find a suitable system build of NLopt (i.e. with version
- If it is found it is used.
- Otherwise, NLopt 2.7.1 is built from included sources using CMake. In this case, a binary of CMake stored in environment variable
CMAKE_BINis searched on the
PATHand, alternatively, on a macOS-specific location. If that variable cannot be set, install will abort suggesting ways of installing CMake. The minimal version requirement on
Installing CMake (macOS and Linux only)
Minimal version requirement for
- On macOS, you can install CMake and then run it. In the menu bar, there is an item How to Install For Command Line Use which you can click on to have proper instructions on how to update your
PATH. Note that the location of the CMake binary is always
/Applications/CMake.app/Contents/bin/cmake. Hence, nloptr knows where to find it even if you do not update your
- On Linux, it will be automatically added unless you specifically change the default installation directory before building CMake.
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.
Steven G. Johnson, The NLopt nonlinear-optimization package, https://nlopt.readthedocs.io/en/latest/