Search code examples
pythondynamic-programmingmathematical-optimizationgekkoipopt

GEKKO / IPOPT - NL Optimization becomes unfeasible because of a change in exponent


I am attempting to run a dynamic optimization model in discrete time with GEKKO and IPOPT (v3.10.2). My model is the following :

from gekko import GEKKO
import numpy as np

# Simulation time
T = 5                 

#exponent
a = 11.3

m = GEKKO(remote = False)

#Control variable
Tax = m.Array(m.Var, T, value = 100, lb = 0, ub = 100)

# State variables
H = m.Array( m.SV, T, lb = 1)
Z = m.Array(m.Var, T)

# Initialization of the state variables
m.Equation(H[0] == 10)
m.Equation(Z[0] == 5)

# Transition equations
for t in range(1,T):
    m.Equation(H[t] == H[t-1] + ( 5 + 5/( (1 +Tax[t])**0.06) )**a ) 
    m.Equation(Z[t] == H[t] - Tax[t])

m.Maximize(m.sum([ 0.97**t * Z[t] for t in range(0,T)]) )

m.options.MAX_ITER = 500

m.solve()

The solver fails to converge and IPOPT returns :

EXIT: Converged to a point of local infeasibility. Problem may be infeasible.

 An error occured.
 The error code is  2

I noticed that if the time horizon T is reduced to 3, or if the exponent a is reduced to 3.3, then the solver finds a solution. I do not understand why. I need to run a more complicated program, with a longer time horizon and higher exponents.

Is there a way to manage this extra complexity so that the solver finds a solution ?

Thank you in advance.

Edit = precisions added on IPOPT version number


Solution

  • The problem actually comes from the bounds definition of the control variable, as a 100 upper bound does not allow the problem to be resolved if exponent a becomes too high. Lifting the upper bound, or increasing it significantly allows the solver to find an optimal solution