I’m solving large-scale non-convex NLPs that typically consist of 6-10 million equalities. On average, the model generation time is 10 min and the solve time is 15 min, so the model generation itself becomes a performance bottleneck. Some sets of equalities are complex and take a long time to generate. I have thoroughly gone through GAMS modelling guideline and confident that the model equalities are written efficiently. Now the question is does GAMS have the capability to parallelize the generation of model equalities in order to save on the model generation time?
The number of rows is just one indicator. Other ones are the number of non-zeros and the NL code length, you find all this in the Model statistics section:
MODEL STATISTICS
BLOCKS OF EQUATIONS 14 SINGLE EQUATIONS 39
BLOCKS OF VARIABLES 15 SINGLE VARIABLES 44
NON ZERO ELEMENTS 133 NON LINEAR N-Z 56
CODE LENGTH 194 CONSTANT POOL 43
For linear models written in a way that GAMS does well we roughly estimate 1 sec per 1,000,000 non-zeros. NL models can be very different since in a single (non-linear) NZ we can have a lot of NL code (e.g. for a quadratic model with a dense Q (n*n) we only have n non-linear non-zeros) , that’s why generation time of non-linear models is harder to predict. Nevertheless, 10 minutes is a long model generation time and there might be room for significant improvement. If you followed all the “usual” tricks (and your system is under M&S) you might want to contact support@gams.com for some “unusual” tricks which require to take a look at the actual model code (with data) to run experiments.
To answer the original question: GAMS cannot do parallel model generation. While it sounds like a very good way to speed up generation time, there is a step in model generation (the “merge”) that often takes as long as the actual row generation and is significantly harder to do in parallel. Nevertheless, parallel model generation is on our development agenda and will help with some models.
-Michael
Hi Michael,
Thank you for this useful insight. My model is indeed huge, containing almost 23 million non-zero elements and 12 million nonlinear non-zero elements. Here is the model statistics:
MODEL STATISTICS
BLOCKS OF EQUATIONS 88 SINGLE EQUATIONS 6,674,951
BLOCKS OF VARIABLES 34 SINGLE VARIABLES 6,956,258
NON ZERO ELEMENTS 22,937,244 NON LINEAR N-Z 12,267,072
DERIVATIVE POOL 20 CONSTANT POOL 37,857
CODE LENGTH 38,645,136
I will definitely reach out to support@gams.com for some tricks to speed-up model generation. Exciting news about parallel model generation, looking forward to it!
- Zamry