GAMS/CPLEX Model Creation Time

Problems with syntax of GAMS
Post Reply
GabrielYin
User
User
Posts: 72
Joined: 6 years ago
Location: Dallas, TX, USA
Contact:

GAMS/CPLEX Model Creation Time

Post by GabrielYin »

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
achristensen
User
User
Posts: 18
Joined: 4 years ago
Location: Fairfax, VA

Re: GAMS/CPLEX Model Creation Time

Post by achristensen »

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:

Code: Select all

option profile = 1;
You might also want to turn off some of the printing to the LST:

Code: Select all

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_ExecErr ... ionProfile

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

best,
adam
GabrielYin
User
User
Posts: 72
Joined: 6 years ago
Location: Dallas, TX, USA
Contact:

Re: GAMS/CPLEX Model Creation Time

Post by GabrielYin »

achristensen wrote: 2 months ago 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:

Code: Select all

option profile = 1;
You might also want to turn off some of the printing to the LST:

Code: Select all

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_ExecErr ... ionProfile

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
Fred
Posts: 373
Joined: 7 years ago

Re: GAMS/CPLEX Model Creation Time

Post by Fred »

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
Post Reply