GEKKO' object has no attribute 'Maximize'

Viewed 122

I am unable to run the following code:

from gekko import GEKKO

# data to be spline to find maximum
x = [-1.0, -0.6, -0.2, 0.2, 0.6, 1.0]
y = [0.1, 5.0, 16.0, 17.0, 4.0, 0.2]

# gekko model
m = GEKKO()
x_gekko = m.Var()
y_gekko = m.Var()
m.cspline(x_gekko, y_gekko, x, y, True)
m.Maximize(y_gekko)
m.solve()

When this runs, I get the following error: 'GEKKO' object has no attribute 'Maximize'

1 Answers

m.Maximize() is from gekko version 0.2.4. The following command will upgrade gekko to the most recent version:
pip install gekko --upgrade

In my case, using pip show gekko revealed that the version I was using was 0.2.1 which did not include the Maximize method.

Related