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, ampl_notebook
ampl = ampl_notebook(
    modules=["gurobi", "coin", "highs", "gokestrel"], # modules to install
    license_uuid="default") # license to use

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, gcg, gecode, gokestrel, gurobi, highs, ilogcp, knitro, lgo, lindoglobal, loqo, minos, mosek, octeract, open, plugins, scip, snopt, xpress.

[AMPL Model Colaboratory] [N-Queens notebook] [https://try.ampl.com]

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 Support Forum!
the only 3 lines you need to use AMPL on Colab