Page 1 of 1

Save CPU time when running a model for multiple times

Posted: Mon Jun 29, 2020 10:37 pm
by moosavi_69
Hello,

I have an MILP model (with both binary and non-negative variables) that I aim to solve a part of it with the CPLEX solver. In fact, I want to use a meta-heuristic algorithm to first determine the binary variables of this model. Then, I will let GAMS finds the optimal values of non-negative variables where the binary variables are fixed. If I have multiple sets of these binary variables, I need to call GAMS multiple times to find the optimal values of non-negative variables for each set of binary variables. During these multiple iterations, GAMS creates one identical model (however, the values of fixed/binary variables will change). Is there any way to prevent the generation of the model multiple times and save the CPU time? Do you have any suggestions for saving CPU time for this specific case?

Code: Select all

loop(nTimes,
#fix binary variables
#call the gams model
#store the non-negative variables
);
If you have any questions, please do not hesitate and let me know.

Re: Save CPU time when running a model for multiple times

Posted: Tue Jun 30, 2020 2:41 am
by brucemccarl
try the GUSS solver

see treatment in newsletter and i think mccarl guide

https://www.gams.com/newsletter/mccarl/ ... _no_34.pdf

Re: Save CPU time when running a model for multiple times

Posted: Tue Jun 30, 2020 7:58 am
by bussieck
If you know all the binary variable fixings ahead of time you can use GUSS: https://www.gams.com/latest/docs/S_GUSS.html. GUSS generates the model once and solves for many different "scenarios". If the outcome of solve n-1 impacts the bound setting of solve n you can't use GUSS. You can use GAMSModelInstance which is an object in our OO APIs. With recent GAMS versions (that have embedded Python code available) you can make use of GAMSModelInstances inside GAMS. A sophisticated use of GAMSModelInstance is shown in spbenders3, https://www.gams.com/latest/gamslib_ml/ ... ders3.html.

Hope this helps,
Michael

Re: Save CPU time when running a model for multiple times

Posted: Mon Jul 06, 2020 6:13 pm
by moosavi_69
It helped. Thanks!