Ampl

AMPL (A Mathematical Programming Language) is a powerful, high-level language for modeling and solving optimization problems, including linear, nonlinear, and integer programs. It is widely used in academia and industry for research, teaching, and practical applications. AMPL supports a wide range of solvers such as HiGHS, Gurobi, CPLEX, and XPRESS, and can be used through its command-line interface or APIs.

How to Access AMPL on the Cluster

AMPL is centrally installed by the ARC software team and is available to all cluster users. You do not need to install AMPL yourself.

Loading the AMPL Module

  1. To use AMPL, first load the AMPL module via Lmod:

    module load ampl
  2. To check available versions or see detailed usage/help for the AMPL module:

    module help ampl

    This command displays information about the AMPL installation, available modules, documentation links, environment variables set, and any important usage notes or requirements.

  3. To see all available AMPL module versions:

    module avail ampl

    This will list all available AMPL versions you can load, if multiple versions are installed.

  4. After loading the module, you can start AMPL with:

    ampl

    This will launch the AMPL command-line interface.

Licensing Requirements

Starting with AMPL versions 2025 or newer, AMPL will be using a bring-your-own-license model. The ARC team maintains the binary installation, but does not provide a site-wide license
Each user is responsible for obtaining and managing their own AMPL license.

AMPL Academic License

If you are a student or faculty, you are eligible for a free academic license for AMPL. 
The academic license allows you to use AMPL and its solvers for teaching, coursework, and research purposes.

  • To obtain your academic license: 
    https://ampl.com/academia/
  • Fill out the academic license request form with your institutional email address.
  • After approval, you will receive license activation instructions via email.
  • It is your responsibility to store your license file or key and activate AMPL as per the instructions provided.

Setting Up AMPL License on Linux (Summary)

To use AMPL on Linux, you need to set up your AMPL license file in your home directory. After obtaining your license (such as the free academic license), follow these steps: 

1. Save the License File - You will receive a license file named ampl.lic (or you can download it from your AMPL account). - Place the ampl.lic file in your home directory (e.g., ~/ampl.lic). 

2. Verify the License Setup - Run ampl from the terminal. - If your license is valid and the file is in the correct location, AMPL will start without errors and list the licensed solvers. 

3. Environment Variables (Optional) - If you need the license in a custom location, set the environment variable to point to your license file: 

sh export AMPL_LICENSE_FILE=/home/${USER}/ampl.lic 

Academic License Notes - The free AMPL academic license must be renewed annually. - It provides access to the CPLEX, GUROBI, and XPRESS solvers, in addition to AMPL itself. - For more details and renewal, visit: [AMPL Academic License](https://ampl.com/academia/

Tip: For advanced usage and troubleshooting, refer to the official AMPL Linux installation guide.

Using AMPL with Solvers

AMPL supports many solvers. Some solvers (like HiGHS or open-source ones) may work out-of-the-box, while others (commercial solvers like Gurobi, CPLEX, or XPRESS) might require you to bring and activate your own solver license as well. Check with your research group or department if they provide institutional solver licenses.

To use a specific solver in AMPL:

ampl: option solver gurobi;
ampl: solve;

Running AMPL in Batch Jobs

For long or intensive computations, use AMPL in your batch job scripts. A typical SLURM script snippet:

module load ampl
ampl mymodel.run

If your AMPL license is 'single-machine' 

You will need to activate your ampl license for each compute-node your job runs on, before running any ampl commands. At the start of each job, execute the amplkey activate command.

module load ampl
amplkey activate --uuid <your-uuid>
ampl mymodel.run

Troubleshooting & Support

  • If you have problems loading the module or running AMPL, first check module help ampl for usage notes.
  • For licensing issues, refer to your registration confirmation from AMPL Academic.
  • For further support, contact the ARC software team ([email protected]) or your unit support staff.