Amplpy solve time Job shop scheduling

Hello,

I am modeling a job shop scheduling problem and want to evaluate the performance of different models in AMPL / AMPLPY.

The AMPL solver finds the solution pretty quickly, but unless i set a time limit, it will try and find another optimal solution for hours.

In amplpy, is there any way i can get the time of when ampl found the last optimal solution?

heres a small example :
10 machines, 5 jobs.

cmax 926 was found after 1 sec, but it will continue to find other 926 solutions for 30+min. It makes comparison between solve time metrics pretty useless.

Or, is there a way to make ampl stop if no better solution are found after x amount of time ?
Any ideas will help.

Thanks in advance.

1 Like

Hi @icey,

Which solver are you using? In order to implement a custom stopping criteria like that you would need to use a callback via our solver interface with callbacks (ampls:: Python solver libraries — ampl::ampls-api 0.1 documentation) available for Gurobi, CPLEX, XPRESS, and COPT. There is an example with Gurobi at ampls-api/python/examples/callbacks_stopping.py at master · ampl/ampls-api · GitHub

Hello,

thank you so much, ive just tested it with gurobi and it works perfectly.
Having the cplex option will allow me to even compare performance between solvers.

Have a good day,

1 Like