I have previously successfully solved a mechanical system using the gekko package. However, without having changed anything in my code, I now get the following error message:
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Cell In[3], line 15
13 m.Equation (F_r == (((1-a)/3)**2 + (2*(1+a)/3)**2 * v))
14 m.Equation (a == (1000 - F_l)/mass)
---> 15 m.solve(disp=False)
16 plt.plot(x)
17 print(x)
File ~/anaconda3/envs/conda_calculator/lib/python3.11/site-packages/gekko/gekko.py:2210, in GEKKO.solve(self, disp, debug, GUI, **kwargs)
2208 #print APM error message and die
2209 if (debug >= 1) and ('@error' in response):
-> 2210 raise Exception(response)
2212 #load results
2213 def byte2str(byte):
Exception: @error: Model File Not Found
Model file does not exist: 130.92.213.86_gk_model0.apm
STOPPING...
To understand how gekko is working, I have run examples that are presented here.
# Pendulum - Index 3 DAE
from gekko import GEKKO
import numpy as np
mass = 1
g = 9.81
s = 1
m = GEKKO()
x = m.Var(0)
y = m.Var(-s)
v = m.Var(1)
w = m.Var(0)
lam = m.Var(mass*(1+s*g)/2*s**2)
m.Equation(x**2+y**2==s**2)
m.Equation(x.dt()==v)
m.Equation(y.dt()==w)
m.Equation(mass*v.dt()==-2*x*lam)
m.Equation(mass*w.dt()==-mass*g-2*y*lam)
m.time = np.linspace(0,2*np.pi,100)
m.options.IMODE=4
m.options.NODES=3
m.solve(disp=False)
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
plt.subplot(3,1,1)
plt.plot(m.time,x.value,label='x')
plt.plot(m.time,y.value,label='y')
plt.ylabel('Position')
plt.legend(); plt.grid()
plt.subplot(3,1,2)
plt.plot(m.time,v.value,label='v')
plt.plot(m.time,w.value,label='w')
plt.ylabel('Velocity')
plt.legend(); plt.grid()
plt.subplot(3,1,3)
plt.plot(m.time,lam.value,label=r'$\lambda$')
plt.legend(); plt.grid()
plt.xlabel('Time')
plt.savefig('index3.png',dpi=600)
plt.show()
These were also working, and now show the same error message.
Any idea what is going on or what I missed? Thanks!
The public server is under significant load with ~315,000
downloads of the gekko package each month. I recommend switching to remote=False
for a faster and more reliable response by solving locally instead of through the public server.
m = GEKKO(remote=False)
This may change the behavior because there are more solver options on the public server, but should be the same in most cases.
While it isn't a problem in this case, it is also a good idea to keep the version of gekko
up-to-date with:
pip install gekko --upgrade
There are new features such as a gekko
support agent.
from gekko import support
a = support.agent()
a.ask("Can you optimize the Rosenbrock function?")