AMPL has a publicly documented interface that you can use to make your own link to any solver you are developing. The interface works through files; AMPL writes a “.nl” problem file to be read by your solver, and your solver writes a “.sol” solution file to be read back by AMPL. The file format has equivalent binary and ASCII versions. It offers the flexibility needed to support a wide variety of solvers, yet is designed to afford very efficient reading and writing.
The AMPL interface is described and illustrated in Hooking Your Solver to AMPL, a guide that you can view in PDF.
You can also download standard interface routines (in the C programming language) for reading and writing the AMPL file formats, along with a variety of examples:
See our solvers page for a detailed list of solvers that have already been hooked to AMPL.
The AMPL interface to nonlinear solvers is distinguished by its powerful features for providing derivative values to solvers. Common modeling language features for computing gradients and Jacobians are extended in two significant respects:
All of these features are documented in the latest versions of Hooking Your Solver to AMPL, described above. An overview and discussion of the implementation are also provided in two related technical reports by David Gay:
In the usual mode of operation, 1st and 2nd derivative values are provided to solvers automatically as part of the optimization process, while only the optimal solutions are returned to AMPL. For rare situations in which it is desired to view the derivative values or manipulate them in AMPL, a pseudo-solver gjh is available. Available components of gjh include instructions for use, source code, and binaries for Windows, Linux, and Mac OS X.