The way to control total solve time Topic is solved

Archive of Gamsworld Google Group
Post Reply
Lucas
User
User
Posts: 20
Joined: 5 months ago

The way to control total solve time

Post by Lucas » 3 months ago

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!

User avatar
Renger
Posts: 395
Joined: 3 years ago

Re: The way to control total solve time

Post by Renger » 3 months ago

Hi Lucas

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

Code: Select all

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

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

if(totaltime < 3600,
    solve mymodel
);
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

Lucas
User
User
Posts: 20
Joined: 5 months ago

Re: The way to control total solve time

Post by Lucas » 3 months ago

Hi Renger Thanks a lot!

can I set TimeElapsed<3600?

https://support.gams.com/gams:how_do_i_ ... me_in_gams

User avatar
Renger
Posts: 395
Joined: 3 years ago

Re: The way to control total solve time

Post by Renger » 3 months ago

Just try it out ;)
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

Lucas
User
User
Posts: 20
Joined: 5 months ago

Re: The way to control total solve time

Post by Lucas » 3 months ago

Yes! Thanks so much!

Post Reply