Interfacing your NLP to IPOPT

IPOPT has been designed to be flexible for a wide variety of applications, and there are a number of ways to interface with IPOPT that allow specific data structures and linear solver techniques. Nevertheless, the authors have included a standard representation that should meet the needs of most users.

This tutorial will discuss six interfaces to IPOPT, namely the AMPL modeling language [3] interface, and the C++, C, Fortran, Java, and R code interfaces. AMPL is a 3rd party modeling language tool that allows users to write their optimization problem in a syntax that resembles the way the problem would be written mathematically. Once the problem has been formulated in AMPL, the problem can be easily solved using the (already compiled) IPOPT AMPL solver executable, ipopt. Interfacing your problem by directly linking code requires more effort to write, but can be far more efficient for large problems.

We will illustrate how to use each of the four interfaces using an example problem, number 71 from the Hock-Schittkowsky test suite [5],

$\displaystyle \min_{x \in \Re^4}$   $\displaystyle x_1 x_4 (x_1 + x_2 + x_3) + x_3$ (4)
s.t.   $\displaystyle x_1 x_2 x_3 x_4 \ge 25$ (5)
    $\displaystyle x_1^2 + x_2^2 + x_3^2 + x_4^2 = 40$ (6)
    $\displaystyle 1 \leq x_1, x_2, x_3, x_4 \leq 5,$ (7)

with the starting point

$\displaystyle x_0 = (1, 5, 5, 1)$ (8)

and the optimal solution

$\displaystyle x_* = (1.00000000, 4.74299963, 3.82114998, 1.37940829). \nonumber

You can find further, less documented examples for using IPOPT from your own source code in the Ipopt/examples subdirectory.