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!

## The way to control total solve time Topic is solved

### Re: The way to control total solve time

Hi Lucas

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

Renger

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
);
```

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: The way to control total solve time

Hi Renger Thanks a lot!

can I set TimeElapsed<3600?

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

can I set TimeElapsed<3600?

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

### Re: The way to control total solve time

Just try it out

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: The way to control total solve time

Yes! Thanks so much!