Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack too small, adjusting variable bound #427

Closed
ArmanZarrin97 opened this issue Jul 29, 2024 · 4 comments
Closed

Slack too small, adjusting variable bound #427

ArmanZarrin97 opened this issue Jul 29, 2024 · 4 comments

Comments

@ArmanZarrin97
Copy link

ArmanZarrin97 commented Jul 29, 2024

Hi,

I have a problem with using the linear solver in IPOPT. I am trying to solve my optimization problem, and after 36 iterations, I got a very accurate solution. However, the IPOPT algorithm doesn't stop here and shows that "In iteration 36, 1 Slack too small, adjusting variable bound" and continues to iterate. Finally, it gives a worse solution which is not desired and some times it is local infeasible. Is there any way to prevent "adjusting variable bound"?
I would be thankful if you could offer any help to solve this problem.

Here is the output report:

This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:    14478
Number of nonzeros in inequality constraint Jacobian.:    14314
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:      210
                     variables with only lower bounds:        0
                variables with lower and upper bounds:       87
                     variables with only upper bounds:        0
Total number of equality constraints.................:      133
Total number of inequality constraints...............:      386
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:       60
        inequality constraints with only upper bounds:      326

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  5.6420208e+03 2.22e+01 1.00e+02  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.6818213e+03 2.22e+01 1.00e+02  -1.0 1.89e+01    -  5.27e-04 2.06e-03h  1
   2  5.7141132e+03 2.21e+01 1.00e+02  -1.0 2.18e+01    -  2.93e-03 5.30e-03h  1
   3  5.5483785e+03 2.10e+01 9.63e+01  -1.0 2.23e+01    -  8.78e-03 4.83e-02f  1
   4  5.4112859e+03 2.09e+01 9.56e+01  -1.0 2.14e+01    -  2.80e-02 5.39e-03f  1
   5  5.1703439e+03 2.05e+01 9.36e+01  -1.0 2.10e+01    -  6.84e-02 1.71e-02f  1
   6  5.1155435e+03 1.99e+01 9.02e+01  -1.0 2.06e+01    -  1.20e-01 3.05e-02f  1
   7  5.2324877e+03 1.86e+01 8.41e+01  -1.0 1.99e+01    -  8.88e-02 6.77e-02h  1
   8  5.4826161e+03 1.67e+01 4.07e+02  -1.0 1.86e+01    -  4.98e-01 1.02e-01h  1
   9  7.0773788e+03 8.92e+00 9.72e+01  -1.0 1.67e+01    -  2.48e-01 4.65e-01h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  7.4963816e+03 7.18e+00 3.72e+02  -1.0 8.91e+00    -  7.59e-01 1.95e-01h  1
  11  8.7069546e+03 2.17e+00 1.22e+02  -1.0 7.17e+00    -  1.00e+00 6.97e-01h  1
  12  8.9109152e+03 1.30e+00 5.09e+02  -1.0 2.17e+00    -  9.31e-01 4.02e-01h  1
  13  9.1153550e+03 4.85e-01 2.22e+02  -1.0 1.30e+00    -  1.00e+00 6.26e-01h  1
  14  9.1921003e+03 1.85e-01 4.37e+02  -1.0 4.85e-01    -  1.00e+00 6.18e-01h  1
  15  9.2407585e+03 2.69e-02 1.90e+02  -1.0 1.97e-01    -  1.00e+00 8.55e-01h  1
  16  9.2453308e+03 5.35e-03 1.06e+03  -1.0 3.82e-02    -  4.73e-01 8.01e-01h  1
  17  9.2457695e+03 4.32e-03 1.63e+03  -1.0 4.08e-02    -  1.00e+00 1.93e-01h  1
  18  9.2477041e+03 1.27e-03 6.95e+02  -1.0 2.00e-02    -  1.00e+00 7.06e-01h  1
  19  9.2445420e+03 1.12e-03 3.65e+03  -1.0 2.49e-02    -  1.00e+00 1.19e-01f  3
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  9.2356644e+03 9.62e-05 4.29e+02  -1.0 1.67e-01    -  1.00e+00 9.14e-01h  1
  21  9.2347396e+03 6.82e-05 3.54e+03  -1.0 6.82e-02    -  1.00e+00 2.91e-01f  2
  22  9.2337487e+03 2.76e-05 1.00e-06  -1.0 5.30e-02    -  1.00e+00 1.00e+00h  1
  23  9.1808847e+03 2.01e-06 5.30e+01  -2.5 6.34e-01    -  8.11e-01 9.31e-01f  1
  24  9.1777179e+03 2.81e-06 1.73e+02  -2.5 4.37e-02    -  1.00e+00 8.66e-01f  1
  25  9.1775947e+03 2.99e-06 2.83e-08  -2.5 8.23e-03    -  1.00e+00 1.00e+00f  1
  26  9.1766330e+03 1.80e-06 2.01e+02  -3.8 7.77e-03    -  6.88e-01 8.12e-01f  1
  27  9.1765952e+03 1.85e-06 1.05e+03  -3.8 2.08e-03    -  9.62e-01 3.94e-01f  2
  28  9.1764889e+03 2.07e-06 1.51e-09  -3.8 1.02e-03    -  1.00e+00 1.00e+00h  1
  29  9.1763485e+03 2.06e-06 1.02e+03  -5.7 1.86e-03    -  4.53e-01 6.38e-01f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  9.1762640e+03 2.04e-06 1.90e+03  -5.7 8.33e-04    -  5.45e-01 8.06e-01f  1
  31  9.1762646e+03 2.04e-06 1.38e+03  -5.7 9.46e-04    -  9.07e-02 5.54e-03h  8
  32  9.1763309e+03 1.58e-06 3.25e+03  -5.7 8.86e-04    -  1.01e-01 6.58e-01h  1
  33  9.1762935e+03 1.47e-06 2.51e+02  -5.7 1.16e-03    -  9.63e-01 1.00e+00f  1
  34  9.1763057e+03 1.39e-06 1.19e+03  -5.7 5.53e-04    -  1.00e+00 6.89e-01h  1
  35  9.1763059e+03 1.39e-06 3.60e+03  -5.7 1.55e-04    -  1.00e+00 6.25e-02f  5
  36  9.1763096e+03 1.42e-06 6.59e-11  -5.7 1.45e-04    -  1.00e+00 1.00e+00h  1
In iteration 36, 1 Slack too small, adjusting variable bound
  37  9.1763094e+03 1.42e-06 9.18e+03  -8.6 3.01e-05    -  8.85e-01 4.25e-01h  1
  38  9.1763196e+03 1.42e-06 4.52e+03  -8.6 9.49e-05  -4.0 2.09e-01 7.98e-01h  1
  39  9.1763196e+03 1.42e-06 4.21e+03  -8.6 1.33e-02    -  1.36e-02 1.67e-07h 23
In iteration 39, 1 Slack too small, adjusting variable bound
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40  9.1763779e+03 1.41e-06 4.47e+03  -8.6 5.95e-02  -4.5 1.91e-04 2.05e-02h  1
In iteration 40, 1 Slack too small, adjusting variable bound
  41  9.1764317e+03 1.40e-06 3.00e+03  -8.6 5.81e-02  -5.0 1.31e-01 1.94e-02h  1
In iteration 41, 1 Slack too small, adjusting variable bound
  42  9.1782243e+03 9.52e-07 4.40e+03  -8.6 3.67e-02  -5.4 5.63e-02 3.37e-01h  1
In iteration 42, 1 Slack too small, adjusting variable bound
  43  9.1795167e+03 7.63e-07 3.30e+03  -8.6 2.17e-02  -5.9 3.47e-01 3.92e-01h  1
  44  9.1800459e+03 7.60e-07 3.05e+03  -8.6 9.35e-03  -6.4 7.23e-01 2.98e-01h  2
  45  9.1808954e+03 7.24e-07 2.35e+03  -8.6 6.88e-03  -6.9 9.21e-01 7.08e-01h  1
  46  9.1809025e+03 7.24e-07 9.65e+03  -8.6 1.01e-03  -7.3 1.00e+00 3.12e-02h  6
  47  9.1809537e+03 7.26e-07 7.41e+03  -8.6 1.08e-03  -6.9 1.00e+00 2.50e-01h  3
  48  9.1809563e+03 7.26e-07 9.35e+03  -8.6 7.32e-03  -6.5 4.74e-01 6.87e-04h  8
  49  9.1810691e+03 7.25e-07 2.11e+03  -8.6 1.18e-02  -7.0 1.00e+00 7.93e-01h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  50  9.1810691e+03 7.25e-07 1.02e+04  -8.6 3.66e-04  -6.5 1.00e+00 3.81e-06h 19
  51  9.1810550e+03 7.49e-07 4.97e+03  -8.6 1.05e-03  -6.1 1.00e+00 5.00e-01h  2
  52  9.1810626e+03 7.49e-07 9.24e+03  -8.6 7.82e-04  -6.6 1.00e+00 5.80e-02h  5
  53  9.1811413e+03 8.30e-07 1.45e-09  -8.6 2.66e-04  -6.2 1.00e+00 1.00e+00s 22
  54  9.1810604e+03 7.28e-07 1.03e+04  -8.6 2.85e-04  -6.6 1.00e+00 0.00e+00S 22
  55  9.1810577e+03 7.27e-07 4.27e-09  -8.6 1.60e-03  -7.1 1.00e+00 1.00e+00h  1
  56  9.1810604e+03 7.28e-07 1.81e-10  -8.6 8.57e-04  -7.6 1.00e+00 1.00e+00h  1
  57  9.1810604e+03 7.28e-07 4.77e+03  -8.6 4.32e-05  -6.3 4.64e-01 1.91e-06h 20
  58  9.1810601e+03 7.33e-07 7.45e+03  -8.6 2.29e-03  -5.8 6.38e-01 3.12e-02h  6
  59  9.1810603e+03 7.33e-07 4.90e+03  -8.6 9.71e-02  -6.3 2.73e-01 2.57e-05h  7
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  60  9.1810656e+03 7.42e-07 2.75e+03  -8.6 1.44e-04  -6.8 4.39e-01 4.39e-01s 22
  61  9.1810694e+03 7.41e-07 2.61e+03  -8.6 2.99e-03  -6.4 4.93e-02 4.93e-02s 22
  62  9.1810837e+03 7.39e-07 2.59e+03  -8.6 1.97e-02  -6.8 7.89e-03 7.89e-03s 22
  63  9.1810956e+03 7.20e-07 2.27e-08  -8.6 5.43e-03  -7.3 1.00e+00 1.00e+00s 22
  64  9.1810962e+03 7.20e-07 1.11e-08  -8.6 2.54e-03  -6.9 4.32e-01 4.32e-01s 22
  65  9.1810969e+03 7.21e-07 1.02e+04  -8.6 6.12e-04  -7.4 1.00e+00 0.00e+00S 22
  66  9.1810945e+03 7.20e-07 5.08e+03  -8.6 1.51e-03  -6.9 1.00e+00 5.00e-01h  2
  67  9.1810951e+03 7.20e-07 9.51e+03  -8.6 1.75e-03  -7.4 1.00e+00 6.25e-02h  5
  68  9.1810963e+03 7.21e-07 5.08e+03  -8.6 5.79e-03  -7.0 1.00e+00 5.00e-01h  2
  69  9.1810962e+03 7.21e-07 9.76e+03  -8.6 5.24e-03  -7.5 1.00e+00 1.56e-02h  7
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  70  9.1810955e+03 7.20e-07 9.77e+03  -8.6 2.89e-02  -8.0 1.00e+00 3.12e-02h  6
  71  9.1810952e+03 7.20e-07 8.89e+03  -8.6 6.54e-03  -7.5 1.00e+00 1.25e-01h  4
  72  9.1810951e+03 7.20e-07 9.84e+03  -8.6 6.93e-04  -7.1 1.00e+00 3.12e-02h  6
  73  9.1806407e+03 3.93e-06 9.48e+03  -8.6 4.28e-04  -6.7 3.10e-01 1.00e+00H  1
  74  9.1810892e+03 7.17e-07 4.04e+03  -8.6 4.85e-03  -7.2 7.94e-01 1.00e+00h  1
  75  9.1810630e+03 7.01e-07 4.94e-09  -8.6 3.63e-03  -7.6 1.00e+00 1.00e+00h  1
  76  9.1810969e+03 7.21e-07 2.54e-10  -8.6 7.48e-04  -7.2 1.00e+00 1.00e+00h  1
  77  9.1810233e+03 2.85e-06 7.60e-08  -8.6 1.82e-03  -7.7 1.00e+00 1.00e+00H  1
  78  9.1810969e+03 7.21e-07 2.09e-08  -8.6 2.79e-02  -8.2 1.00e+00 1.00e+00h  1
  79  9.1810969e+03 7.21e-07 6.46e-11  -8.6 4.94e-05  -5.9 1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  80  9.1810969e+03 7.21e-07 5.08e+03  -8.6 1.53e-04  -6.4 1.00e+00 5.00e-01h  2
  81  9.1811098e+03 7.20e-07 8.26e-11  -8.6 7.84e-05  -6.0 1.00e+00 1.00e+00s 22
  82  9.1810969e+03 7.21e-07 5.98e-11  -8.6 1.70e-04  -6.5 1.00e+00 1.00e+00s 22

Number of Iterations....: 82

                                   (scaled)                 (unscaled)
Objective...............:   4.5905484579201038e+02    9.1810969158402077e+03
Dual infeasibility......:   5.9789588901742055e-11    1.1957917780348411e-09
Constraint violation....:   7.2082722199115360e-07    7.2082722199115360e-07
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   2.5242139733706584e-09    5.0484279467413166e-08
Overall NLP error.......:   7.2082722199115360e-07    7.2082722199115360e-07


Number of objective function evaluations             = 301
Number of objective gradient evaluations             = 84
Number of equality constraint evaluations            = 301
Number of inequality constraint evaluations          = 301
Number of equality constraint Jacobian evaluations   = 1
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations             = 1
Total seconds in IPOPT                               = 1.315

EXIT: Solved To Acceptable Level.
Objective value:  9181.096915840208
Solver Time:   1.317026138305664
@ArmanZarrin97
Copy link
Author

ArmanZarrin97 commented Jul 29, 2024

when I put max_iter=36 the output result is here:

This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:    14478
Number of nonzeros in inequality constraint Jacobian.:    14314
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:      210
                     variables with only lower bounds:        0
                variables with lower and upper bounds:       87
                     variables with only upper bounds:        0
Total number of equality constraints.................:      133
Total number of inequality constraints...............:      386
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:       60
        inequality constraints with only upper bounds:      326

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  5.6420208e+03 2.22e+01 1.00e+02  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.6818213e+03 2.22e+01 1.00e+02  -1.0 1.89e+01    -  5.27e-04 2.06e-03h  1
   2  5.7141132e+03 2.21e+01 1.00e+02  -1.0 2.18e+01    -  2.93e-03 5.30e-03h  1
   3  5.5483785e+03 2.10e+01 9.63e+01  -1.0 2.23e+01    -  8.78e-03 4.83e-02f  1
   4  5.4112859e+03 2.09e+01 9.56e+01  -1.0 2.14e+01    -  2.80e-02 5.39e-03f  1
   5  5.1703439e+03 2.05e+01 9.36e+01  -1.0 2.10e+01    -  6.84e-02 1.71e-02f  1
   6  5.1155435e+03 1.99e+01 9.02e+01  -1.0 2.06e+01    -  1.20e-01 3.05e-02f  1
   7  5.2324877e+03 1.86e+01 8.41e+01  -1.0 1.99e+01    -  8.88e-02 6.77e-02h  1
   8  5.4826161e+03 1.67e+01 4.07e+02  -1.0 1.86e+01    -  4.98e-01 1.02e-01h  1
   9  7.0773788e+03 8.92e+00 9.72e+01  -1.0 1.67e+01    -  2.48e-01 4.65e-01h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  7.4963816e+03 7.18e+00 3.72e+02  -1.0 8.91e+00    -  7.59e-01 1.95e-01h  1
  11  8.7069546e+03 2.17e+00 1.22e+02  -1.0 7.17e+00    -  1.00e+00 6.97e-01h  1
  12  8.9109152e+03 1.30e+00 5.09e+02  -1.0 2.17e+00    -  9.31e-01 4.02e-01h  1
  13  9.1153550e+03 4.85e-01 2.22e+02  -1.0 1.30e+00    -  1.00e+00 6.26e-01h  1
  14  9.1921003e+03 1.85e-01 4.37e+02  -1.0 4.85e-01    -  1.00e+00 6.18e-01h  1
  15  9.2407585e+03 2.69e-02 1.90e+02  -1.0 1.97e-01    -  1.00e+00 8.55e-01h  1
  16  9.2453308e+03 5.35e-03 1.06e+03  -1.0 3.82e-02    -  4.73e-01 8.01e-01h  1
  17  9.2457695e+03 4.32e-03 1.63e+03  -1.0 4.08e-02    -  1.00e+00 1.93e-01h  1
  18  9.2477041e+03 1.27e-03 6.95e+02  -1.0 2.00e-02    -  1.00e+00 7.06e-01h  1
  19  9.2445420e+03 1.12e-03 3.65e+03  -1.0 2.49e-02    -  1.00e+00 1.19e-01f  3
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  9.2356644e+03 9.62e-05 4.29e+02  -1.0 1.67e-01    -  1.00e+00 9.14e-01h  1
  21  9.2347396e+03 6.82e-05 3.54e+03  -1.0 6.82e-02    -  1.00e+00 2.91e-01f  2
  22  9.2337487e+03 2.76e-05 1.00e-06  -1.0 5.30e-02    -  1.00e+00 1.00e+00h  1
  23  9.1808847e+03 2.01e-06 5.30e+01  -2.5 6.34e-01    -  8.11e-01 9.31e-01f  1
  24  9.1777179e+03 2.81e-06 1.73e+02  -2.5 4.37e-02    -  1.00e+00 8.66e-01f  1
  25  9.1775947e+03 2.99e-06 2.83e-08  -2.5 8.23e-03    -  1.00e+00 1.00e+00f  1
  26  9.1766330e+03 1.80e-06 2.01e+02  -3.8 7.77e-03    -  6.88e-01 8.12e-01f  1
  27  9.1765952e+03 1.85e-06 1.05e+03  -3.8 2.08e-03    -  9.62e-01 3.94e-01f  2
  28  9.1764889e+03 2.07e-06 1.51e-09  -3.8 1.02e-03    -  1.00e+00 1.00e+00h  1
  29  9.1763485e+03 2.06e-06 1.02e+03  -5.7 1.86e-03    -  4.53e-01 6.38e-01f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  9.1762640e+03 2.04e-06 1.90e+03  -5.7 8.33e-04    -  5.45e-01 8.06e-01f  1
  31  9.1762646e+03 2.04e-06 1.38e+03  -5.7 9.46e-04    -  9.07e-02 5.54e-03h  8
  32  9.1763309e+03 1.58e-06 3.25e+03  -5.7 8.86e-04    -  1.01e-01 6.58e-01h  1
  33  9.1762935e+03 1.47e-06 2.51e+02  -5.7 1.16e-03    -  9.63e-01 1.00e+00f  1
  34  9.1763057e+03 1.39e-06 1.19e+03  -5.7 5.53e-04    -  1.00e+00 6.89e-01h  1
  35  9.1763059e+03 1.39e-06 3.60e+03  -5.7 1.55e-04    -  1.00e+00 6.25e-02f  5
  36  9.1763096e+03 1.42e-06 6.59e-11  -5.7 1.45e-04    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 36

                                   (scaled)                 (unscaled)
Objective...............:   4.5881547853508903e+02    9.1763095707017801e+03
Dual infeasibility......:   6.5876320013384123e-11    1.3175264002676825e-09
Constraint violation....:   1.4239617678567678e-06    1.4239617678567678e-06
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   1.8495093414710534e-06    3.6990186829421064e-05
Overall NLP error.......:   1.4239617678567678e-06    3.6990186829421064e-05


Number of objective function evaluations             = 52
Number of objective gradient evaluations             = 37
Number of equality constraint evaluations            = 52
Number of inequality constraint evaluations          = 52
Number of equality constraint Jacobian evaluations   = 1
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations             = 1
Total seconds in IPOPT                               = 0.312

EXIT: Maximum Number of Iterations Exceeded.
Objective value:  9176.30957070178
Solver Time:   0.31469106674194336

@odow
Copy link
Member

odow commented Jul 29, 2024

You can normally ignore prints like this from the log. But they generally mean that your model has numerical issues and that you could improve the formulation. If you have a reproducible example, please post on the JuMP community forum: https://discourse.julialang.org/c/domain/opt/13

Note that your second example where you limit the number of iterations is fairly inaccurate:

Overall NLP error.......:   1.4239617678567678e-06    3.6990186829421064e-05

If you're happy with this solution, try changing the various options like the tolerance: https://coin-or.github.io/Ipopt/OPTIONS.html#OPT_tol

My guess is that your problem is somewhat ill-posed, and that it has a very small feasible region that depends on variables with small primal values.

@odow
Copy link
Member

odow commented Jul 30, 2024

I'm going to close this issue because it is not a bug in Ipopt.jl, but if you have questions or comments, please post on the forum https://discourse.julialang.org/c/domain/opt/13 and we can discuss there 😄

@odow odow closed this as completed Jul 30, 2024
@ArmanZarrin97
Copy link
Author

Thank you, Oscar. I'll discuss it on discourse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants