GAMS/CPLEX Model Creation Time

Hi Experts,

I have one question regarding the syntax that could output the GAMS/CPLEX model creation time. I have a huge but relatively simple model (0.7 million constrs/vars) in which the CPLEX solver time was only 4 seconds, while the actual elapsed time was above 10 minutes.

I’m not sure if there is a good way or coding standard that makes GAMS create the model faster, but I’m wondering at least if there is any syntax that could accurately capture the model creation time in GAMS/CPLEX API.

Thanks in advance!

Best,
Gabriel

Hi Gabriel,
If you are in a situation where the solve is quick, but everything else is slower… a good place to start is to turn on profile:

option profile = 1;

You might also want to turn off some of the printing to the LST:

option limrow = 0;
option limcol = 0;
option solprint = off;

You will see some output in the LST file that will be helpful to determine with statements are taking time.

There are other good ideas here: https://www.gams.com/45/docs/UG_ExecErrPerformance.html?search=profile#UG_ExecErrPerformance_ExecutionProfile

You can always post your code and the community might be able to suggest some fixes.

best,
adam

Thanks a lot Adam!! That is a great information. According to the profile, I noticed that GAMS spent around 20 seconds building the equations, which is OK. However, GAMS took around 300 seconds to read all the inputs and process them. Then, the CPLEX solver only took 4 seconds to solve it. I’m wondering if there is a general rule of thumb in writing efficient input processing code for GAMS. The most input processing we used was to read CSV files and fill in parameter values with several conditions.

Best,
Gabriel

Hi Gabriel,

Adam already shared a link to some hints on how to formulate a model efficiently. If this did not help, I suggest you share your code and data, such that other forum user can analyze and provide help.

If this cannot be shared publicly (e.g. due to confidentiality), feel free to reach out to supportt@gams.com

Best,
Fred