Variable stopping criteria based on run time

Hello,

I was wondering if it is possible to specify variable optimality gaps, which increase with runtime. For example, my current options file sets optCR=0.01 and reslim to 3600. However, I notice from time to time that A model might be stuck at a certain gap for a long time and seem to ‘bottom out’ (see attached picture). It would be extremely helpful if we could instead formulate the stopping criteria to change with the amount of time the solution has run for, or based on the slope of the optimality gap. For example, here is some pseudocode to what I mean

Idea 1: Time based

if solution time < 10 seconds, optcr =0.01, 
is solution time < 100 seconds and > 10 seconds, optcr = 0.02
if solution time <1000 seconds and > 100 seconds, optcr = 0.05

Idea 2: Gradient based

If Best Integer Solution_t - best integer solution t-100 < .01%, then stop

Let me know if anything like this is even remotely possible,
Zack
image.png

Hi,

With CPLEX (the log tells me that you use CPLEX) you can update the solver option file. I attached an example based on model dice from the GAMS model library and the trigger file example from the support wiki.

Cplex starts with optcr=0.01, after ~10 seconds it uses a cplex.op2 with optcr=0.1 and after 30 seconds it uses cplex.op3 with optcr=0.2.

You could also combine this approach with the incumbent reporting callback userincbicall to check for the improvements that has been made over a certain time interval.

I hope this helps!

Fred
changeOptfileOverTime.gms (3.13 KB)

This is incredibly helpful! Thanks Fred!