Gekko unreachable server, local solving json file error

Viewed 240

I think I'm running into the same problem as this stack overflow.

Unreachable server working with GEKKO. What is going on?

Yesterday I was able to solve my Gekko model and today I'm not even able to solve the examples from the Apmonitor site. Solving takes forever and I get the following error:

ImportError: No solution or server unreachable.
  Show errors with m.solve(disp=True).
  Try local solve with m=GEKKO(remote=False).

I tried solving it locally as was suggested in the stack overflow post I mentioned above:

m = GEKKO(remote=False)

However, I then got the following error:

Error: 'results.json' not found. Check above for additional error details
Traceback (most recent call last):

and

FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/mr/kgzm2xln40dcc10zkq06drhc0000gn/T/tmpzqxlyw7_gk_model0/options.json'

Is the server down and can anyone help me solving it locally?

Edit, code add:

from gekko import GEKKO
m = GEKKO(remote=False)           # create GEKKO model
y = m.Var(value=2)    # define new variable, initial value=2
m.Equation(y**2==1)   # define new equation
m.options.SOLVER=1    # change solver (1=APOPT,3=IPOPT)
m.solve(disp=True)
print('y: ' + str(y.value)) # print variable value
1 Answers

Local Solve Error with remote=False The error that you referenced is because either the solver failed to find a solution or because you are on a MacOS and need some shared libraries with gcc. If you are on a MacOS, try installing gcc to get the required shared libraries as mentioned in the GitHub issue discussion for local solution on MacOS.

brew install gcc

If it is a solver issue, you can see the error message if you display the solver output with:

m.solve(disp=True)

The local solve is sometimes different than the remote server solve because of licensing restrictions on the linear solvers in IPOPT or because your local executable doesn't have one of the solvers (e.g. IPOPT isn't available for local solve on MacOS, ARM Linux, or x86-64 Linux yet). The apm executable that handles local requests automatically reverts over to the next available solver option if the requested one isn't available. You can try m.options.SOLVER=1 for APOPT or m.options.SOLVER=2 for BPOPT as different solvers.

Also, you should leave the debug level at 1 if you want to throw an exception when the solver is not successful at finding the solution. Otherwise, set debug=0 and use m.options.APPSTATUS to determine if the solver was successful.

m.solve(disp=True,debug=0)
if m.options.APPSTATUS==0:
    print('Solver failed to find a solution')
else:
    print('Successful solution')

We can offer more specific suggestions on getting your program working locally if you can post a minimal example that shows the issue.

Cloud Computing with remote=True

The public server was unavailable for a few hours today but is back up now. Because of the popularity of Gekko, the servers can sometimes get overloaded or are unavailable with occasional maintenance activities. A dedicated APMonitor server is available as a compute server for Linux or as a compute server for Windows if you'd like to host your own system in the cloud or as a dedicated server. If you do create your own server then use:

m = GEKKO(server='http://10.0.0.10',remote=True)

but substitute 10.0.0.10 for the IP address of the server.

Related