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.
There are two ways to solve GAMS models with 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:
... --- 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. ...
... --- 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:
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:
... --- 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 ...
... --- 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 ...