Hi,

You can also make use of the option **mipstopexpr** https://www.gams.com/34/docs/S_CPLEX.html#CPLEXmipstopexpr

This option is available with CPLEX, GUROBI, and XPRESS. With this option you can provide specific stopping conditions. For your example, the following should work.

```
mipstopexpr objval < 1e75 && resusd > 300
```

With this, you tell the solver that if the objective value is less than 1e75 (very large value) and time used by the solver is less greater than 300 seconds, it can stop. This way, the run will continue even after 300 seconds if a feasible solution is not found and it will continue till 300 even after a feasible solution is found. Note that objval is the current objective value found by the solver and resusd is the time used by the solver.

This option has to be provided using solver option file. I provide an example below which is a modified version of the example rotdk.gms from GAMS model library.

```
$title Robust Optimization (ROTDK,SEQ=185)
$onText
Robust Optimization.
Laguna, M, Applying Robust Optimization to Capacity Expansion of
One Location in Telecommunications with Demand Uncertainty.
Management Science 44, 11 (1998), 101-110.
Keywords: mixed integer linear programming, robust optimization, capacity expansion,
time-dependent knapsack problem
$offText
Set
s 'scenarios' / 1*1000 /
t 'time periods' / t1*t12 /
j 'components' / C001*C010 /;
Alias (t,tt);
Parameter
di(s,t) 'increment'
D(t,s) 'demand'
c(j) 'capacity size'
p(j) 'capacity cost'
mu 'mean capacity parameter'
sigma 'std capacity parameter';
mu = 100;
sigma = 10;
c(j) = round(uniform(1,mu));
p(j) = round(mu + c(j) + uniform(-sigma,sigma));
di(s,t)$(ord(s) <= 0.25*card(s)) = round(normal( 50,10));
di(s,t)$(ord(s) > 0.25*card(s) and ord(s) <= 0.75*card(s)) = round(normal(100,20));
di(s,t)$(ord(s) > 0.75*card(s)) = round(normal(150,40));
d(t,s) = sum(tt$(ord(tt) <= ord(t)), di(s,tt));
* display c, p, di, d;
Parameter
dis(t) 'discount factor'
w 'shortage penalty';
dis(t) = power(.86,ord(t) - 1);
w = 5;
Variable
x(j,t) 'expansion'
z(s) 'max capacity shortage'
cap(t) 'installed capacity'
obj;
Integer Variable x;
Positive Variable z;
Equation
capbal(t) 'capacity balance'
dembal(t,s) 'demand balance'
objdef;
objdef.. obj =e= sum((j,t), dis(t)*p(j)*x(j,t)) + w/card(s)*sum(s, z(s));
capbal(t).. cap(t) =e= cap(t-1) + sum(j, c(j)*x(j,t));
dembal(t,s).. cap(t) + z(s) =g= d(t,s);
Model rotdk / all /;
$onecho > cplex.opt
mipstopexpr objval < 1e75 && resusd > 300
$offecho
rotdk.optfile =1 ;
option limCol = 0, limRow = 0;
* do not reset optcr if already set to a nondefault value
if{(.1 = %gams.optCr%), option optCr = 0.05;};
solve rotdk min obj using mip;
```

You can then combine this with my previous answer to allocate time in a loop. Note that you can change/modify the cplex.opt file after each run based on the time available.