Lightweight R interface to the Ipopt nonlinear optimizer through Ipopt’s C interface.
See the Solving nonlinear programs with ipopt vignette for a guided tour of the objective, gradient, constraint Jacobian, and Hessian-of-the-Lagrangian callbacks, with worked examples (HS071, Rosenbrock, limited-memory, and a maximum-entropy problem).
The package links against an Ipopt library located at build time. On Linux and macOS this is the system Ipopt found with pkg-config; on Windows it is one of Ipopt’s official prebuilt release binaries (see below). The package is always installed from source against that locally available Ipopt.
Installation
A system Ipopt (and pkg-config) must be available; the configure script requires
to succeed.
macOS (build from source)
Homebrew provides Ipopt, so macOS users build from source. The configure script locates the Homebrew Ipopt automatically:
install.packages("ipopt", repos = "https://bnaras.github.io/drat", type = "source")Equivalently, clone the repository and run R CMD INSTALL ..
Windows (prebuilt Ipopt binary)
Ipopt does not ship in the Windows R toolchain, but the Ipopt project publishes prebuilt Windows binaries that this package can link against. Although those binaries are built with MSVC, they export the Ipopt C interface as plain C symbols, so Rtools’ (MinGW) linker can use them directly.
Install Rtools (matching your R version).
Download the latest
win64-msvs2022-mdzip from Ipopt releases and extract it, for example toC:\Ipopt, giving youC:\Ipopt\include\coin-or,C:\Ipopt\lib, andC:\Ipopt\bin.-
Build from source, pointing the package at that folder (use forward slashes):
Equivalently, set
IPOPT_HOME=C:/Ipoptin the environment before installing and the script will find the headers, library, and DLL itself. -
At run time, the package loads
ipopt-3.dlland its dependencies (coinmumps-3.dlland the Intel runtime DLLs, all inC:\Ipopt\bin). Make sure that folder is on thePATHfor the R session, e.g.Sys.setenv(PATH = paste("C:/Ipopt/bin", Sys.getenv("PATH"), sep = ";")) library(ipopt)(Add
C:\Ipopt\binto the systemPATHto avoid doing this each session.)
