Save CPU time when running a model for multiple times Topic is solved

Solver related questions
Post Reply
moosavi_69
User
User
Posts: 31
Joined: 6 years ago

Save CPU time when running a model for multiple times

Post 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.
brucemccarl
User
User
Posts: 13
Joined: 6 years ago

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

Post by brucemccarl »

try the GUSS solver

see treatment in newsletter and i think mccarl guide

https://www.gams.com/newsletter/mccarl/ ... _no_34.pdf
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

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

Post 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
moosavi_69
User
User
Posts: 31
Joined: 6 years ago

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

Post by moosavi_69 »

It helped. Thanks!
Post Reply