AMPL Forum

Large scale optimization with AMPL in Python

Experience the All-New Python Ecosystem for Large-Scale Optimization

Natural mathematical modeling syntax + natural python integration. 


Integrate with amplpy

Our amplpy interface allows developers to access the features of AMPL from within Python.

Collaborate with teams

AMPL Model Colaboratory is a collection of AMPL models in Jupyter Notebooks that run on platforms such as Google ColabKaggleGradient, and AWS SageMaker.

Bring optimization to your courses easily with models on Google Colab, or a free, easily distributed AMPL for Courses license.

Deploy to your larger applications

Deployment is easy with solvers now available as python packages. Deploy in the cloud using Docker containers, or with options such as cloud functions (e.g. AWS Lambda and Azure Functions)

Experience our Python API amplpy

Performance of heavily optimized C code without losing model readability

The amplpy interface allows developers to access the features of AMPL from within Python. With amplpy you can model and solve large-scale optimization problems in Python leveraging the performance of heavily optimized C code without losing model readability.

Natural integration

In the same way that AMPL’s syntax matches naturally the mathematical description of the model, the input and output data matches naturally Python lists, sets, dictionaries, pandas and numpy objects.

Access solvers directly through AMPL

All model generation and solver interaction is handled directly by AMPL, which leads to great stability and speed; the library just acts as an intermediary, and the added overhead (in terms of memory and CPU usage) depends mostly on how much data is sent and read back from AMPL, the size of the expanded model as such is irrelevant.

Modeling N-Queens

Solve and switch with ease

All AMPL commercial and open-source solvers are available as Python Packages

Now available as Python Packages for Windows, Linux, and macOS. Easy to install in just a few lines of code. 

					# Install Python API for AMPL
$ python -m pip install amplpy --upgrade

# Install HiGHS and Gurobi (AMPL is installed automatically with any solver)
$ python -m amplpy.modules install highs gurobi

# Activate your license (e.g., free license)
$ python -m amplpy.modules activate <license-uuid>

# Confirm that the license is active
$ python -m amplpy.modules run ampl -vvq

# Import in Python
$ python
>>> from amplpy import AMPL
>>> ampl = AMPL() # instantiate AMPL object

Collaborate with teams

Collaborate and model for free on Google Colab

AMPL is free on Colab!

AMPL on Google Colab is enabled with a default Community Edition license to allow freedom to model without limitations on variables or constraints for personal, academic, and commercial prototyping purposes. Model with open-source solvers or activate your own Community Edition license for commercial solver trials.

Connect data with ease

Load data directly from python data structures using amplpy

Access the best solvers with simple switchability

Solve with commercial and open-source solvers and retrieve your solution. Switch out solvers in one line of code and solve again for a new solution.

Modeling N-Queens

More ways to collaborate

Build and share data apps quickly with Streamlit – no front-end experience necessary. 

Not just for Google Colab, our collection of AMPL models in Jypyter Notebooks run in Kaggle, Gradient, and AWS Sagemaker.

Start free now

AMPL Community Edition

AMPL APIs are included in all licenses. Start free today with a Community Edition license to start using amplpy.

Google Colab

AMPL APIs are included in all licenses. Start free today with a Community Edition license to start using amplpy.

New to AMPL?

Getting started with AMPL is easy – with our documentation, free licenses, AMPL modeling book, and tutorial (coming soon!)