# [AMPL 24443] EXIT: Iterates diverging; problem might be unbounded.

Hi,
I am using AMPL to solve this optimal control problem but when i run the the code it dosent run it shows "EXIT: Iterates diverging; problem might be unbounded.

Ipopt 3.12.13: Iterates diverging; problem might be unbounded"

this is the code I am working
reset;

# terminal time tf , number n of grid and stepsize h

param tf := 100;
param n := 10000;
param h := tf/n;

## INITIAL VALUES

param T0 := 8.4110*(106) ;
param H0 := 1*(10
3) ;
param I0 := 1.7080*(10**6) ;
param V0 := 0.0 ;

## PARAMETERS

param a1 := 4.31*(10**-1) ;
param b1 := 1.02*(10**-9) ;
param m1 := 6.41*(10**-11) ;
param n1 := 10.00*(10**-1) ;
param alpha1 := 2*(105) ;
param r1 := 8.00*(10
-1) ;
param a2 := 11.00*(10**-1) ;
param b2 := 1.02*(10**-9) ;
param m2 := 15.00*(10**-1) ;
param r2 := 6.00*(10**-1) ;
param n2 := 1.245*(10**-1) ;
param alpha2 := 107 ;
param rho := 2.00*(10
-1) ;
param delta := 4.12*(10**-2) ;
param r3 := 6.00*(10**-1) ;
param d1 := 9.00*(10**-1) ;
param sigma := 60 ;
param ku := 100 ;
param kw := 500 ;

#### state variables

var T {i in 0…n}, >= 0 ;
s.t. lT0 : T[0] = T0 ;

var H{i in 0…n}, >= 0 ;
s.t. lH0 : H[0] = H0 ;
s.t. etaH {i in 0…n} : H[i]-(3/4)*b2 >= 0 ;

var I {i in 0…n}, >= 0 ;
s.t. lI0 : I[0] = I0 ;

var V {i in 0…n}, >= 0 ;
s.t. lV0 : V[0] = V0 ;

var int {i in 0…n} ;
s.t. lint0 : int[0] = 0 ;

##### control variable and constraints

var U{i in 0…n} :,>= 0, <= 1 ;

var W{i in 0…n} :,>= 0, <= 1 ;

# Right hand sides of ODEs

var fT {i in 0…n} = a1T[i](1-b1T[i]) - m1T[i]H[i] - n1T[i]*I[i]alpha1 + T[i] - W[i];#r1(1-exp(-V[i]))*T[i];

var fH {i in 0…n} = a2H[i](1 - b2H[i]) - m2T[i]H[i] -W[i];# r2(1 - exp(-V[i]))*H[i];

var fI {i in 0…n} = n2*T[i]*I[i]alpha2 + T[i] - rhoT[i]I[i] - deltaI[i] + U[i]sigma -W[i];# r3(1 - exp(-V[i])) * I[i];

var fV {i in 0…n} = W[i] - d1*V[i];

## cost function

var fint {i in 0…n} = T[i] - I[i] + (1/2)(ku(U[i]*2) + kw(W[i]**2));

# OBJECTIVE

minimize obj : int[n];

# Solver IPOPT

option abs_boundtol 1;

option solver ipopt;
option ipopt_options “max_iter=5000 tol=1e-8”;

# suffix ipopt_zL_out LOCAL;

solve;

The message from Ipopt is telling you that the objective is not converging to an optimal value, but is instead diverging to an infinite value. That usually indicates that your problem’s minimization is unbounded: it has no finite minimum. Since your model defines the objective like this,

`var int {i in 0..n};`
`s.t. lint0 : int[0] = 0;`

`minimize obj : int[n];`

maybe the trouble is that there is no lower bound on int[n] anywhere in the model.