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

**URL:** <https://discuss.ampl.com/t/ampl-24443-exit-iterates-diverging-problem-might-be-unbounded/300>\
**Category:** Google Group Mirror\
**Created:** [January 5, 2023, 10:50am UTC](https://discuss.ampl.com/t/ampl-24443-exit-iterates-diverging-problem-might-be-unbounded/300 "2023-01-05T10:50:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emad\_Abdullah](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/emad_abdullah/32/151_2.png) [@Emad\_Abdullah](https://discuss.ampl.com/u/Emad_Abdullah)\
**Post date:** [January 5, 2023, 10:50am UTC](https://discuss.ampl.com/t/ampl-24443-exit-iterates-diverging-problem-might-be-unbounded/300/1 "2023-01-05T10:50:59Z")

</div>

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\*(10**6) ;  
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\*(10**5) ;  
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 := 10**7 ;  
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} = a1_T[i]_(1-b1_T[i]) - m1_T[i]_H[i] - n1_T[i]\*I[i]_alpha1 + T[i] - W[i];#r1_(1-exp(-V[i]))\*T[i];

var fH {i in 0..n} = a2_H[i]_(1 - b2_H[i]) - m2_T[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] - rho_T[i]_I[i] - delta_I[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];

## SOLVE with IPOPT

# Solver IPOPT

option abs\_boundtol 1;

option solver ipopt;  
option ipopt\_options “max\_iter=5000 tol=1e-8”;

# suffix ipopt\_zU\_out LOCAL;

# suffix ipopt\_zL\_out LOCAL;

solve;

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [January 5, 2023, 9:22pm UTC](https://discuss.ampl.com/t/ampl-24443-exit-iterates-diverging-problem-might-be-unbounded/300/2 "2023-01-05T21:22:32Z")

</div>

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.
