Our comprehensive Application Programming Interface (API) provides an object-oriented callable library that lets you access AMPL models and run AMPL commands from external programs. Data and results can be exchanged directly and efficiently between AMPL’s model entities and the external language’s data structures. Uses include:
Our instructions add AMPL API to an existing installation of command-line AMPL and solvers, after which you will be able to access AMPL from any popular version of your chosen language. Contact us at support@ampl.com if you need help completing the AMPL or API setup.
AMPL API works with any purchased AMPL installation covered by current a maintenance & support service, and also with all trial and temporary versions. Contact us at licensing@ampl.com if you need help with reinstatement of maintenance or renewal of licenses.
Once you have installed your API you will find our extensive API documentation hosted on our documentation site. Use the links below to navigate to the pages you need.
AMPL API library consists of a collection of classes to interact with the underlying AMPL interpreter and to access its inputs and outputs. It uses generic collections to represent the various entities which comprise a mathematical model. The structure of these entities is explained in this section.
These links will show a simple example to illustrate various functionalities. The full example prints the version of the AMPL interpreter used, loads a model from file and the corresponding data file, solves it, gets some of the AMPL entities in your programming language and uses them to get the results and to assign data programmatically. The documentation in this section assumes that you are already familiar with the programming language you select.
Need more support? Contact us.
Check out all technical documentation here.
Join the conversation on the AMPL forum.