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))
multiprocessingor a multi-threaded application withthreadingwould be best. It seems that multi-threading would be better if you are solving on a networked cluster of computers because your main script could spawn those sequentially and then wait for the first one to return. - John Hedengren