Sometimes my Python Gekko application is solved better with one solver over another. It is difficult to predict which solver will perform best. Because Python Gekko supports local or remote solves on different servers with m.GEKKO(server='http://{address}')
, is it possible to create a parallel Gekko application that will try all the solvers simultaneously on any number of computers (including local) and then kill the other processes when the first one returns successfully? I've been looking at multi-threading and parallel packages for Python. Are there any that work well with Gekko to do parallel solves? Here is a sequential prototype:
from gekko import GEKKO
m = GEKKO()
x = m.Var(); y = m.Var()
m.Equation(x**2+y**2==1)
m.Maximize(x+y)
# try all solvers
for i in range(1,4):
m.options.SOLVER = i
m.solve()
if m.options.APPSTATUS==1:
print('Success: ' + str(i))