Would you like to solve a problem using GAMS? Let us take you through the steps.
GAMS on Windows
Our section on solving your first problem has everything you need to get up and running. After going through this section, you’ll have:
- downloaded the Engine for Windows
- installed the Engine on Windows
- used the command line interface
Whether GAMS is your go-to modelling language or you’re keen to try it out, we’ve got a breakdown of how to use it with the Engine. Let’s take it one step at a time.
Step 1: Download and Install GAMS
To download the language, you’ll need to go to the GAMS downloads page. Select MS Windows from the Platform options. A licence agreement pop-up window will appear. Click download. An executable file will be downloaded to your PC. To install, double click the file and the installer will start running. Choose either GAMS Studio or GAMS IDE in the installer. In this tutorial, we’ll be using GAMS Studio.

Step 2: Get a Demo Licence
Before you go any further, scroll down the GAMS downloads page to where you see “Request a Free Demo License”. In order to use GAMS, you’ll need to complete this form. Once you’ve submitted your request, you’ll get an email from GAMS with the licence.

Step 3: Add the Engine as a Solver in GAMS
To do this, locate the file gmscmpNT.txt in the GAMS folder on your PC. Open it with text editor. Copy the snippet below and paste it in the file. Save the file.
OCTERACT 111 0 0001020304 1 0 2 LP MIP RMIP NLP MCP MPEC RMPEC CNS DNLP RMINLP MINLP QCP MIQCP RMIQCP EMP
gmsgennt.cmd
gmsgennx.exe
libocteract.dll oct 1 0
Step 4: Write a Model in GAMS
GAMS has two different interfaces: GAMS Studio and GAMS IDE. You either write your model directly in one of the interfaces or in text editor. In this tutorial, we’ll be using a text editor, Notepad. Copy and paste the snippet below to create a model in your session. Then save the model as my_example.gms
Step 5: Solve the Model
In GAMS Studio or GAMS IDE, open the saved file. Once the file is loaded in GAMS, run the problem. To do this in GAMS Studio, press the green arrow. In GAMS IDE, press the button with the file and red arrow. The problem will now be solved. You can see how the solution will be displayed in either interface below.


A more detailed version of the solution is written and stored on your PC. You’ll be able to access it by using the path in the line “Solution file written to:”. From there, you can view the solution file (.octsol) in text editor.
And that’s it – you’re all done!
You’ve just solved a problem using GAMS.
Would you like to try solving with AMPL on Windows? We can walk you through it.
GAMS on Linux
In our section on getting started, you’ll find all information you need to get up and running. Once you’ve gone through the guide, you’ll have:
- downloaded the Engine for Linux
- installed the Engine on Linux by untarring the tarball
- added the bin folder to PATH
Let’s solve a problem usings GAMS and the Engine.
Step 1: Download GAMS
To download this modelling language, you’ll need to go to the GAMS downloads page. From the list of platform options, choose Linux. A licence agreement pop-up will appear. Click download. A file will be downloaded to your PC. To check that this file has “execute permission”, open a Shell session and insert the command found in the snippet below. From here, choose a location for the GAMS directory. The GAMS installer will create a subdirectory.
Step 2: Get a Demo Licence
Before you go any further, scroll down the GAMS downloads page to where you see “Request a Free Demo License”. In order to use GAMS, you’ll need to complete this form. Once you’ve submitted your request, you’ll get an email from GAMS with the licence.

Step 3: Install GAMS
To create a directory that contains the GAMS system directory, type the command mkdir /gams in your Shell session. You’ll need to include the entire path where you want the folder to be created. For example: mkdir /Users/Octeract/gams. Change to this directory by using the cd command and ensure the name of directory is returned correctly by typing pwd. Now you can run the executable file by providing the whole path where it can be found. You’ll find an example in the snippet. To start the installation, go into the GAMS installation folder and run ./gamsinst Follow the instructions on the Shell session during the installation. Once the installation is completed, add the licence file you received in the newly created GAMS folder.
Step 4: Include the Engine as a Solver in GAMS
To do this, go to where the Engine was installed on your PC and locate the bin folder. In this folder, you’ll find a file called install-for-gams. Run it. You’ll then be prompted to provide the whole path where GAMS is installed. You’ll find an example in the snippet below. Once you’ve done this, the process of adding the Engine to GAMS will begin. You’ll see a message in your Shell session when the Octeract library is installed in the GAMS directory.
Step 5: Write a Model in GAMS
In this tutorial, we’ll write the model in text editor. Copy and paste the snippet below to create a model in your session. Then save the model as my_example.gms
Step 6: Solve the Model in GAMS
To solve the model, navigate to where GAMS was installed using the whole path. For example: c/Users/Octeract/gams/gams24.3_linux_x64_64_sfx. You can run the problem from there using the command in the snippet below. The whole path to where the example file was saved needs to be included in the command. You’ll be able to see the Engine running in the Shell session.
A more detailed version of the solution is written and stored on your PC. You’ll be able to access it by using the path in the line “Solution file written to:”. From there, you can view the solution file (.octsol) in text editor.
And that’s it – you’re done!
You’ve just solved a problem using GAMS.
Would you like to try solving with AMPL on Linux? We can walk you through it.