Our demo licensing scheme allows you to try GAMS and the solvers we package in the distribution for free, but there are certain limits with regards to model sizes. GAMS itself enforces the following limits:
- 2000 variables and 2000 constraints for linear (LP, RMIP, and MIP) models with a demo license
- 1000 variables and 1000 constraints for all other model types with a demo license
- 5000 variables and 5000 constraints for linear (LP, RMIP, and MIP) models with a community license
- 2500 variables and 2500 constraints for all other model types with a community license
In addition to the GAMS model size limits, the solvers might impose stricter limits when running with a demo or community license. Detailed information about those limitations can be found in our documentation .
For those who would like to solve larger models without paying any license fees, there is a way now: NEOS server. In a nutshell, NEOS is a free online service for solving numerical optimization problems, hosted by the Wisconsin Institute for Discovery at the University of Wisconsin in Madison. NEOS integrates a range of premium solvers, such as CPLEX, MOSEK, KNITRO, XPRESS, and GUROBI.
The following caveats apply:
- You are only allowed to use NEOS for “academic, non-commerical research purposes”, at least when using the commercial solvers.
- Your job will be queued, and you might have to wait a little while before getting optimization results; the wait is typically only on the order of minutes.
If you can live with these restrictions, you will find that running NEOS jobs with GAMS STUDIO is easy! The following works with Studio in GAMS 32.2.0 or later.
Let’s use the ALUM model from the GAMS model library as an example. GAMS produces the following model statistics for this MIP:
GAMS 32.2.0 rc62c018 Released Aug 26, 2020 WEX-WEI x86 64bit/MS Windows - 08/28/20 11:14:30 Page 22 World Aluminum Model (ALUM,SEQ=31) Model Statistics SOLVE gam Using MIP From line 1493 MODEL STATISTICS BLOCKS OF EQUATIONS 24 SINGLE EQUATIONS 928 BLOCKS OF VARIABLES 23 SINGLE VARIABLES 3,475 NON ZERO ELEMENTS 12,317 DISCRETE VARIABLES 172
If you try to solve this locally with a demo license, you will get an error message:
GAMS 32.2.0 Copyright (C) 1987-2020 GAMS Development. All rights reserved Licensee: GAMS Demo license for Stefan Mann G200605|0002CO-GEN GAMS Software GmbH, Germany DL011603 c:\gams\licenses\demo.lic email@example.com, Stefan Mann Demo license for demonstration and instructional purposes only --- Starting compilation --- alum.gms(1632) 3 Mb --- Starting execution: elapsed 0:00:00.012[LST:1704] --- alum.gms(1491) 5 Mb --- Generating MIP model gam[LST:10519] --- alum.gms(1495) 6 Mb --- 928 rows 3,475 columns 12,317 non-zeroes --- 172 discrete-columns *** The model exceeds the demo license limits for linear models of more than 2000 rows or columns *** Status: Terminated due to a licensing error *** License file: c:\gams\licenses\demo.lic *** Inspect listing file for more information --- Job alum.gms Stop 08/28/20 12:16:44 elapsed 0:00:00.149
Don’t fret, you can solve this model on NEOS. To do so, first choose a solver (NEOS defaults to BDMLP , if no solver option is given). The option has to be added to the model file; options supplied in the GAMS parameter editor in STUDIO are currently ignored when submitting NEOS jobs:
Then, in Studio, select
GAMS > Run NEOS - Short from the menu. This will automatically establish a connection with NEOS, add your model to the queue, and collect the results once they are ready. The whole process is totally seamless, and requires no configuration. If you expect your job to run for longer than 5 minutes, select
Run NEOS - long. This will put your job into a different queue, where jobs do not get killed automatically after 5 minutes, but you also will not get any intermediate log output during the NEOS run.
The solve summary shows that CPLEX was indeed used to solve our problem on NEOS:
S O L V E S U M M A R Y MODEL gam OBJECTIVE phi4 TYPE MIP DIRECTION MINIMIZE SOLVER CPLEX FROM LINE 1496 **** SOLVER STATUS 1 Normal Completion **** MODEL STATUS 8 Integer Solution **** OBJECTIVE VALUE 49563.9048 RESOURCE USAGE, LIMIT 0.220 10000000000.000 ITERATION COUNT, LIMIT 1686 2147483647 IBM ILOG CPLEX 32.2.0 rc62c018 Released Aug 26, 2020 LEG x86 64bit/Linux --- GAMS/Cplex licensed for continuous and discrete problems. Cplex 22.214.171.124 Space for names approximately 0.13 Mb Use option 'names no' to turn use of names off MIP status(102): integer optimal, tolerance Cplex Time: 0.20sec (det. 158.45 ticks) Fixing integer variables, and solving final LP... Fixed MIP status(1): optimal Cplex Time: 0.01sec (det. 13.31 ticks) Solution satisfies tolerances. MIP Solution: 49563.904825 (1116 iterations, 42 nodes) Final Solve: 49563.904825 (570 iterations) Best possible: 49559.722453 Absolute gap: 4.182372 Relative gap: 0.000084
That is all you need to solve a model on NEOS, using any of the available commercial solvers.
Brief Technical Background
A GAMS job is always split into different phases:
- During the compilation phase GAMS analyses the model code and generates a restart file (the equivalent of an “object file” in a language such as C++), which contains lower level instructions. Importantly, any dollar control options are executed during this phase.
- During the execution phase, the restart file generated before is read in and executed.
When you run a GAMS job on NEOS with Studio, the compilation phase happens locally on your own computer. The resulting restart file is then copied onto NEOS Server, and executed there in a temporary directory. All files produced in that directory during the GAMS run (.lst, .log, put files…) are collected and transferred back to your local machine.
Note how this process is different from using Kestrel, which also allows you to solve GAMS jobs on NEOS server. With Kestrel, both the GAMS compilation and execution phases happen on your local machine, and only the (potentially large) solver work file is copied to NEOS and fed to the solver. Since the GAMS execution phase happens locally, the size restrictions of demo installations apply here.
- For security reasons, NEOS jobs are executed under
execmode=3(more info in our documentation ), which means you cannot use any executes, embedded code, or
putstatements above the working directory
- You cannot upload supplementary files. As a consequence, you cannot use something like
execute_load xxx.gdx. Also, if you need a solver option file, it has to be created on the fly with
put. Consider this example for generating a CPLEX option file:
file fopt /cplex.opt/; putclose fopt 'startalg 4' / 'mipemphasis 2';