Variable stopping criteria based on run time

Solver related questions
Post Reply
pecenak21
User
User
Posts: 24
Joined: 5 years ago

Variable stopping criteria based on run time

Post by pecenak21 »

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

Code: Select all

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

Code: Select all

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
Fred
Posts: 373
Joined: 7 years ago

Re: Variable stopping criteria based on run time

Post by Fred »

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
example how to change opt file over time
(3.13 KiB) Downloaded 300 times
pecenak21
User
User
Posts: 24
Joined: 5 years ago

Re: Variable stopping criteria based on run time

Post by pecenak21 »

This is incredibly helpful! Thanks Fred!
Post Reply