The way to control total solve time

Hi expertise,
In a GAMS file, I have a number of Solve command and the option reslim = 3600 is at the beginning of the program .
Need to be given to each solve statements 1 hour time, But the total solve time should not be more than 1 hour.(That is, the total of the time spent for all Solve’s commands shouldn’t get more than an hour)

Clarification:

For example, if we have three M1, M2, M3 models, and Option Reslim = 3600. And the time to solve the model M1 is 2500, and solve time for model M2 be equal to 1200 seconds, then M3 does not run because 1200 + 2500> 3600.

(That is the total time spent in solve command <=3600s)
Is the order or a way to be able to do this?

Thanks a lot!

Hi Lucas

You could introduce an if condition using the time used from your two models:

parameter totaltime 'Total time used';
model mymodel /all/;
solve...
totaltime = mymodel.resusd;

solve...
totaltime = totaltime + mymodel.resusd;

if(totaltime < 3600,
    solve mymodel
);

Cheers
Renger

Hi Renger Thanks a lot!

can I set TimeElapsed<3600?

https://support.gams.com/gams:how_do_i_get_the_total_model_solution_time_in_gams

Just try it out :wink:

Yes! Thanks so much!