AMPL on Google Colab

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

In order to be use AMPL on these notebook platforms you just need to following two code blocks at the beginning of your notebook:

# Install dependencies
!pip install -q amplpy
# Google Colab & Kaggle integration
from amplpy import AMPL, tools
ampl = tools.ampl_notebook(
    modules=["coin", "highs", "gokestrel"], # modules to install
    license_uuid="default", # license to use
    g=globals()) # instantiate AMPL object and register magics

In the list MODULES you can specify the AMPL solvers you want to use in your notebook. Full list of AMPL modules available: amplgsl, baron, cbc, coin, conopt, copt, cplex, gokestrel, gurobi, highs, knitro, lgo, lindoglobal, loqo, minos, octeract, open, plugins, snopt, xpress.

[AMPL Model Colaboratory] [N-Queens notebook] []

You can use the Christmas notebook written by ChatGPT to get started:

Open In Colab Kaggle Gradient Open In SageMaker Studio Lab
BTW: you can even ask ChatGPT to write models for you! If it makes mistakes you can ask for help in our new Discourse Forum!
the only 3 lines you need to use AMPL on Colab