I am trying to solve a non-linear optimization problem using Gekko. Despite defining one of the variables as an integer, Gekko still returns a float. I tried writing a random, simpler optimization problem (shown below), and the same thing happened. Why is this and how can I get Gekko to solve for an integer value?
from gekko import Gekko
m = Gekko()
x1 = m.Var(value=2, ub=30, name="x1")
x2 = m.Var(value=1, lb=0, name="x2")
x3 = m.Var(value=4, name="x3", integer=True)
i1 = m.Intermediate(2*x1/x2)
i2 = m.Intermediate(x3**2)
m.Equation(x1 >= x2)
m.Equation(i1 >= 1)
m.Equation(i2 <= 28)
m.Maximize(x1**2 + x2**2 + x3**3)
m.solve()
print("Results:")
print(f"{x1[0]=}")
print(f"{x2[0]=}")
print(f"{x3[0]=}")
Gekko Results:
x1 = 30.0
x2 = 30.00000031
x3 = 5.2915026231