# [Coin-ipopt] Inequality constraints problem.

Andreas Waechter andreasw at watson.ibm.com
Mon Jul 19 13:30:17 EDT 2004

```Hi Henk,

Thanks for your message.

I had a look at the file that you attached. I was able to reproduce a
similar behavior to what you describe in your message.

I made one change which was to add the line

G(6) = 0.d0

in the subroutine EV_G that computes the gradient of the objective
function, since this component of the new variables that you introduced is
zero.  With that, my version solved the problem in 8 iterations.

Before calling EV_G to obtain the gradient for the objective fuction, I
don't set the incoming double precision array G to 0, so it is up to EV_G
to make sure that ALL entries are set, even the zero ones.

I hope the above change also fixes this for you as well.  If not, please
let me know!

Regards

Andreas

On Mon, 19 Jul 2004, H Jansen wrote:

> I'm trying to extend the standard Fortran example (included with the
> Ipopt) with a single inequality constraint, namely:
>
>                  x1 + x2 <= 5
>
> where the optimal values for original problem gives x1 + x2 = 5.743. I
> have applied the following modifications to the example code so as to
> incorporate the above modifications (modified example code is attached):
>
> ...
>
> C Extra slack variable and constraint equation needed
> C      parameter  (N = 5, M = 2)
>       parameter  (N = 6, M = 3)
>
> ...
>
> C Lower bound on slack variable
> C      parameter  (NLB = 5, NUB = 4)
>       parameter  (NLB = 6, NUB = 4)
>
> ...
>
> C Slightly modified starting values
> C   - to have a feasible start (x1+x2=5)
> C   - for slack variable         (x6>0)
> C      data X      / 1d0, 5d0, 5d0, 1d0, -24d0 /
>       data X      / 1d0, 4d0, 5d0, 1d0, -24d0, 0.1d0 /
> C
> C      data ILB    /   1,   2,   3,   4,     5     /
> C      data BNDS_L / 1d0, 1d0, 1d0, 1d0,   0d0 /
> C Lower bound for slack variable
>       data ILB    /   1,   2,   3,   4,     5,     6 /
>       data BNDS_L / 1d0, 1d0, 1d0, 1d0,   0d0,   0d0 /
>
> ...
>       subroutine EV_C(N, X, M, C, DAT, IDAT)
>       implicit none
>       integer N, M
>       double precision C(M), X(N)
>       double precision DAT(*)
>       integer IDAT(*)
>       C(1) = X(1)*X(2)*X(3)*X(4) - X(5) - DAT(1)
>       C(2) = X(1)**2 + X(2)**2 + X(3)**2 + X(4)**2 - DAT(2)
> C
> C Extra constraint equation:
> C With X(6)>=0, this enforces that X(1)+X(2)-5 <= 0, so that
> C X(1)+X(2) <= 5  as required.
> C
>       C(3) = X(1)+X(2)-5.d0+X(6)
>       return
>       end
>
> C end of example.f
>
> I obtain the following IPOPT output:
>
> ....
> ....
> ITER     ERR       MU      ||C||    ||D||   ALFA(X) #LS        F
> Regu
>   550 .141E+02d .184E-05 .359E-02 .675E-01 .100E+01h  1 0.17944288E+02
> .000E+00
>   551 .141E+02d .184E-05 .224E-03 .171E-01 .100E+01h  1 0.17924547E+02
> .000E+00
>   552 .141E+02d .251E-08 .263E-05 .183E-02 .100E+01h  1 0.17922717E+02
> .000E+00
>   553 .141E+02d .251E-08 .263E-04 .489E-02 .100E+01h  1 0.17915952E+02
> .000E+00
>   554 .142E+02d .251E-08 .245E-02 .372E-01 .100E+01h  1 0.17863396E+02
> .000E+00
>   555 .142E+02d .251E-08 .308E-03 .160E-01 .100E+01h  1 0.17845212E+02
> .000E+00
>   556 .142E+02d .251E-08 .205E-04 .502E-02 .100E+01h  1 0.17840290E+02
> .000E+00
>   557 .142E+02d .251E-08 .733E-06 .967E-03 .100E+01h  1 0.17839397E+02
> .000E+00
>  Restoration phase problem converged.
>  Maximum constraint violation   1.11479479E-09 below tolerance.
>  filter: Error: resto_filter returns IERR =  18
>  solve_barrier: filter returns IERR =  18
>  mainloop: Error: solve_barrier ends with IERR =  18
>
> Number of iterations taken .............                    557
> Final value of objective function is.... 0.1783935780275719E+02
>
> Errors at final point                      (scaled)       (unscaled)
> Final maximal constraint violation is... 0.111479E-08    0.111479E-08
> Final value for dual infeasibility is... 0.142122E+02    0.142122E+02
> Final value of complementarity error is. 0.250594E-08    0.250594E-08
>
> The objective function was evaluated   3196 times.
> The constraints were evaluated         3196 times.
>
> EXIT: Restoration phase cannot further improve feasibility
>
> CPU seconds spent in IPOPT and function evaluations =          0.2700
>
>
>  An error occoured after  557 Iterations.
>  The error code is  18
>
> ======================
>
> Apparently there is a feasiblity problem but I can't figure this from
> the model (the complete Fortran code of which is attached).
>
> Has anyone some idea what's wrong?
> Help is much appreciated.
>
> --Henk
>
> --
> Henk Jansen <h.jansen at fel.tno.nl>
> TNO Physics and Electronics Laboratory
>
> --
> ------------------------------------------------------------------------------
> The disclaimer that applies to e-mail from
> TNO Physics and Electronics Laboratory
> can be found on: http://www.tno.nl/disclaimer/email.html
> ------------------------------------------------------------------------------
>

```

More information about the Coin-ipopt mailing list