User Tools

Site Tools


solver:how_do_i_get_set_up_to_run_with_a_gams_gurobi-link_license

How do I get set up to run with a GAMS/Gurobi-Link license

A GAMS/Gurobi-Link connects the GAMS Base Module to the Gurobi solver, but does not include a license for the solver. The Gurobi license needs to be purchased/requested directly from Gurobi.

If you attempt to use the GAMS/Gurobi solver with a link license and you haven't set up the Gurobi portion of the licensing, you will get a licensing error with a message describing the problem. For example, with the 64-bit GAMS distribution 24.7.0 I get the following log output when attempting to solve the rotdk model from the GAMS Model Library:

GAMS/OsiGurobi (missing license)

...
--- Executing OSIGUROBI: elapsed 0:00:00.041

OSI GUROBI       24.7.0 r56449 BETA Released  7Mar16 WEI x86 64bit/MS Windows 

OsiGurobi (Osi library 0.107, GUROBI library 6.5.1)
Osi link written by S. Vigerske. Osi is part of COIN-OR.

Failed to create Gurobi environment. Missing license.
...

GAMS/Gurobi (missing license)

...
--- Executing GUROBI: elapsed 0:00:00.043

Gurobi           24.7.0 r56449 BETA Released  7Mar16 WEI x86 64bit/MS Windows 

Gurobi link license.
*** Cannot initialize Gurobi environment.
*** Could be a missing or invalid license. (status=10009|10009)
...

To make the GAMS/Gurobi-Link work you do not need to download or install the Gurobi software but only your Gurobi license. GAMS will use it's own Gurobi DLL/shared library, so the Gurobi license has to be valid for the Gurobi version GAMS uses. You can download your Gurobi license from www.gurobi.com. Log in to your Gurobi account and go to Download –> Licenses –> your GUROBI license.

Now click on the license you want to download, enter the required information and click on “Get License Details”. The license detail page opens, copy the grbgetkey command and paste it to the Start/Run menu (Windows only) or a command/terminal prompt (any system). Make sure that you add your GAMS System Directory which contains grbgetkey to the path variable in advance. Alternatively, you can also open a command prompt window from the GAMS IDE using the button in the upper right corner. After running grbgetkey you will be asked where to save your gurobi license. Choose a location e.g. C:\tmp\licenses.

Note that to install a license key automatically, the grbgetkey program needs to be able to communicate with the Gurobi website. It may fail if the computer:

  • has no Internet connection
  • has restricted access due to a firewall
  • uses a proxy server

In that case the grbprobe command may help. It retrieves the required hardware information. However, that information needs to submitted to the Gurobi website afterwards to be able to download the gurobi.lic file.

Once you have saved your gurobi.lic file the GRB_LICENSE_FILE environment variable needs to be set. This can be done in a number of ways (search the Internet for “how to set environment variables” plus your operating system). Here I use the command window on Windows to temporarily set the environment variable:

c:\tmp> set GRB_LICENSE_FILE=c:\tmp\licenses\gurobi.lic

After setting the environment variable you will see GAMS/OsiGurobi and GAMS/Gurobi with a link license solve the problem rotdk:

GAMS/OsiGurobi

...
--- Executing OSIGUROBI: elapsed 0:00:00.042

OSI GUROBI       24.7.0 r56449 BETA Released  7Mar16 WEI x86 64bit/MS Windows 

OsiGurobi (Osi library 0.107, GUROBI library 6.5.1)
Osi link written by S. Vigerske. Osi is part of COIN-OR.

Optimize a model with 12012 rows, 1132 columns and 24143 nonzeros
...

GAMS/Gurobi

...
--- Executing GUROBI: elapsed 0:00:00.042

Gurobi           24.7.0 r56449 BETA Released  7Mar16 WEI x86 64bit/MS Windows 

Gurobi link license.
Gurobi library version 6.5.1
Space for names approximately 0.28 Mb
Use option 'names no' to turn use of names off
Starting Gurobi...
Optimize a model with 12012 rows, 1132 columns and 24143 nonzeros
...
solver/how_do_i_get_set_up_to_run_with_a_gams_gurobi-link_license.txt · Last modified: 2017/01/31 11:11 by admin