TRY NOW!
AMPL > >Products > >AMPL API

AMPL API

Version 1.2 has been released. This version includes Java and MATLAB APIs and a public beta of the C++ API.

Our new Application Programming Interface, AMPL 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:

  • Programming complex algorithmic schemes
  • Embedding AMPL in enterprise applications
  • Deployment of AMPL models
  • AMPL API is developed in partnership with Optirisk Systems. In addition to the Java and MATLAB releases, a C++ version is in public beta, and future releases are planned for support of Python, R, and .NET (C# and VB).

To get started, follow the installation and startup instructions below that correspond to your operating system:

These instructions add AMPL API to an existing installation of command-line AMPL and solvers, after which it can be used in conjunction with any C++, Java, or MATLAB installation. Contact us at support@ampl.com if you need help completing the AMPL or API setup.

AMPL API 1.2 works with any purchased AMPL installation covered by current 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 expired licenses.

 

Microsoft Windows

Locate the folder on your computer that contains the program file ampl.exe (as well as other AMPL files). This is the “AMPL folder” that will be used for the AMPL API installation.

Determine whether you installed a 32-bit or a 64-bit version of AMPL. This information appeared in the name of the installation file that you downloaded, and is also found in the message displayed by the AMPL command “option version;”.

Now download the appropriate AMPL API package zipfile, by using the primary site or secondary site link below:

Double-click the zipfile icon, or apply an unzip utility, to extract the contents of the zipfile. When the extraction is complete you will see a folder named amplapi (possibly inside another folder named amplapi-win32 or amplapi-win64). Move the amplapi folder into your AMPL folder, by dragging or cutting and pasting the amplapi folder icon.

Complete the installation by following the instructions for the API language you will be using:

  • Getting Started with the C++ AMPL API (beta version)
  • Getting Started with the Java AMPL API
  • Getting Started with the MATLAB AMPL API

Also on the Getting Started page you will find links to complete documentation for the API class libraries.

Linux

Locate the folder on your computer that contains the program file ampl (as well as other AMPL files). This is the “AMPL folder” that will be used for the AMPL API installation.

Determine whether you installed a 32-bit or a 64-bit version of AMPL. This information appeared in the name of the installation file that you downloaded, and is also found in the message displayed by the AMPL command “option version;”.

Now download the appropriate AMPL API package zipfile, by using the primary site or secondary site link below:

Extract the contents of the package by typing the command

unzip amplapi-linux??.zip

where ?? is replaced by 32 or 64 as appropriate. When the extraction is complete you will see a directory named amplapi. Move this amplapi directory into your AMPL directory, so that it appears as a subdirectory of your AMPL directory.

Complete the installation by following the instructions for the API language you will be using:

  • Getting Started with the C++ AMPL API (beta version)
  • Getting Started with the Java AMPL API
  • Getting Started with the MATLAB AMPL API

Also on the Getting Started page you will find links to complete documentation for the API class libraries.

Mac OS X

Locate the folder on your computer that contains the icon for the ampl program (as well as other AMPL files). This is the “AMPL folder” that will be used for the AMPL API installation.

Determine whether you installed a 32-bit or a 64-bit version of AMPL. This information appeared in the name of the installation file that you downloaded, and is also found in the message displayed by the AMPL command “option version;”.

Now download the AMPL API package zipfile, by using the primary site or secondary site link below:

Double-click this file’s icon to extract its contents. When the extraction is complete you will see a folder named amplapi. Drag the amplapi folder icon into your AMPL folder.

Complete the installation by following the instructions for the API language you will be using:

  • Getting Started with the C++ AMPL API (beta version)
  • Getting Started with the Java AMPL API
  • Getting Started with the MATLAB AMPL API

Also on the Getting Started page you will find links to complete documentation for the API class libraries.