Ipopt, lg(mu) increasing with further iterations

Viewed 117

I am working on a motorbike lap time simulator that uses IPOPT for the optimal control problem of minimizing lap time. I'm encountering a strange issue that has a couple of symptoms. I'm not sure if it's to do with the problem formulation or my optimizer settings or something else.

The optimiser doesn't converge so I cut it off after 30 iters. I'm able to get some results for the timeseries of the bike, although they are a little bumpy.

First, it appears that as the bike approaches the end of the lap, a very large deceleration is applied to the bike. Although it doesn't appear as though the bike's speed is affected, the final value in the time series is roughly the same as the previous value for the speed.

The dual and primal infeasibility values remains high throughout the whole optimisation.

The lg(mu) value remains pretty high throughout the whole problem and in fact increases throughout.

I think it's possible that I've defined the problem incorrectly and that the bike is trying to finish exactly on the finish line, and the acceleration is used to correct the velocity to achieve this. This may be why lg(mu) is steadily increasing. Although I don't know if this is correct.

Here are some iters:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  5.0000000e+01 7.61e+00 1.06e+00   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.2354734e+01 1.25e+02 2.61e+04   1.0 3.72e+02    -  4.49e-01 1.05e-01f  2
   2  5.8209179e+01 1.13e+02 4.89e+04   1.3 5.74e+02    -  3.30e-01 2.38e-01f  1
   3  5.8427608e+01 1.09e+02 7.80e+04   1.3 2.26e+03    -  5.29e-02 3.40e-02h  1
   4  5.7286457e+01 1.05e+02 1.58e+05   1.3 3.27e+03    -  5.93e-02 4.73e-02h  1
   5  5.4742469e+01 1.00e+02 1.68e+05   1.3 1.08e+03    -  9.76e-02 9.39e-02h  1
   6  5.3103432e+01 9.65e+01 3.23e+05   1.3 8.30e+02    -  3.88e-02 4.60e-02h  1
   7  5.1403543e+01 9.27e+01 2.96e+05   1.3 3.32e+02    -  9.96e-02 4.42e-02h  1
   8  4.8435240e+01 8.68e+01 3.25e+05   1.3 9.18e+02    -  1.33e-01 7.93e-02h  1
   9  4.6636072e+01 8.34e+01 2.54e+05   1.8 1.96e+03    -  7.10e-02 4.57e-02h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  4.5624201e+01 8.31e+01 5.34e+05   2.6 6.59e+03    -  3.66e-02 2.25e-02f  1
  11  4.5396562e+01 8.15e+01 8.21e+06  -4.4 2.19e+03    -  5.52e-02 2.13e-02h  1
  12  4.4770540e+01 8.64e+01 1.35e+06   3.1 2.09e+04    -  1.89e-02 1.28e-02f  1
  13  4.3376367e+01 9.29e+01 1.63e+06   3.4 9.37e+03    -  3.07e-02 2.18e-02f  1
  14  4.3629802e+01 1.05e+02 9.69e+06   3.3 3.05e+03    -  3.69e-02 2.34e-02f  1
  15  4.3981118e+01 1.03e+02 3.18e+06   3.3 5.75e+03    -  8.46e-02 4.62e-02f  1
  16  4.4061311e+01 1.01e+02 3.15e+06   3.6 5.42e+03    -  4.83e-02 2.46e-02f  1
  17  4.4041548e+01 1.00e+02 3.58e+06   3.6 2.39e+03    -  6.00e-02 3.60e-03h  1
  18  4.3262006e+01 8.41e+01 3.57e+07   3.2 3.70e+03    -  2.31e-02 3.58e-02h  1
  19  4.4835984e+01 9.57e+01 4.87e+07   4.4 3.48e+04    -  3.97e-02 1.57e-02f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  4.4439370e+01 9.39e+01 5.39e+07   3.2 5.56e+03    -  4.40e-03 8.81e-03h  2
  21  4.3925581e+01 9.28e+01 5.73e+07   3.2 8.07e+03    -  3.75e-02 1.32e-02h  1
  22  4.2768412e+01 1.03e+02 1.72e+08   3.2 5.42e+03    -  2.22e-02 3.43e-02h  1
  23  4.2551257e+01 1.02e+02 2.15e+08   3.6 5.82e+03    -  8.74e-02 7.16e-03h  1
  24  4.2023292e+01 9.45e+01 3.90e+08   3.7 3.55e+03    -  2.65e-02 4.02e-02h  1
  25  4.1719605e+01 9.26e+01 1.44e+08   4.2 4.45e+03    -  7.99e-02 5.57e-02f  1
  26  4.1331097e+01 8.89e+01 2.64e+07   2.9 2.85e+03    -  5.92e-02 3.60e-02h  1
  27  4.1143710e+01 8.75e+01 4.59e+07   3.7 2.73e+03    -  6.33e-02 1.50e-02h  1
  28  4.2020100e+01 2.19e+02 4.59e+08   4.6 1.56e+04    -  2.37e-03 7.91e-02f  1
  29  4.1767670e+01 2.16e+02 4.52e+08   3.4 3.64e+03    -  3.53e-02 1.56e-02h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  4.0837002e+01 2.13e+02 3.87e+08   3.4 9.14e+03    -  3.52e-02 4.11e-02h  1
  31  4.0047846e+01 2.15e+02 9.25e+08   4.4 2.67e+04    -  1.35e-01 2.10e-02h  1
  32  3.9770188e+01 2.14e+02 2.55e+08  -2.2 1.80e+04    -  1.50e-02 7.12e-03h  1
  33  3.9584783e+01 2.13e+02 3.63e+08   4.6 3.79e+04    -  5.50e-02 8.17e-03h  1
  34  3.9240198e+01 2.12e+02 4.33e+08   4.6 5.02e+04    -  4.00e-03 1.47e-02h  1
  35  3.8725727e+01 2.10e+02 2.96e+08   4.6 3.30e+04    -  5.70e-02 2.37e-02f  2
  36  3.8716577e+01 2.12e+02 2.19e+08   4.6 6.89e+03    -  6.33e-03 1.19e-02H  1
  37r 3.8716577e+01 2.12e+02 1.00e+03   4.6 0.00e+00    -  0.00e+00 2.92e-07R 16
  38r 3.8713861e+01 2.40e+02 3.60e+03  -1.5 2.46e+04    -  1.12e-01 4.00e-02f  1
  39  3.8709293e+01 2.40e+02 1.02e+05   1.9 2.12e+03    -  4.93e-01 8.65e-04f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40  4.0422833e+01 3.28e+02 8.00e+05   3.0 4.39e+04    -  4.88e-02 5.47e-02f  1

Here's a repository if you want to have a look, the IPOPT options are in problemSolver.py. https://github.com/RoryMcDonald/LTS-Help

1 Answers

Yes you are definitely not converging. I looked at your TrackingODE, and many of the outputs have a singularity in the form a division by (1-n*k). I noticed that IPOPT does really does not deal well with singularities.

In my case the singularity was caused by a division by v, velocity, and I worked around it by an initial phase with a simplified ODE that did not contain a singularity, which ended when v was big enough to not cause problems.

I don't think a similar thing will work for your system, but that's just from looking in cursory way. Maybe you could do something like expand 1/(1-x) as a Taylor series 1 + x + x^2 + x^3 + ... and neglect terms higher than some power.

Related