# Levenberg optimizer halts quickly when given more variables, or fewer constraints

I'm using the g2o C++ optimization library to refine a GPS trajectory using accelerometer data.

The program uses a Levenberg-Marquardt optimizer over data points representing the position and orientation (vector part of quaternion) of the accelerometer. The only constraints are the accelerations in the local reference frame.

Error is measured as the difference between the accelerometer reading, and the local second derivative of the path traced by the data points — the change in velocity from (a to b) to (b to c), disregarding change in orientation, plus the upward acceleration counteracting gravity.

The initial path is a polygon drawn between GPS readings.

The optimizer runs for five iterations of gradient descent, and seems to make good adjustments. The polygon corners get rounded off a bit. But then it seems to get stuck, and Levenberg's lambda goes up for five iterations before the program terminates.

# BUT

It does a lot more refinement if I further constrain it using data from the gyroscope. However, not at as much as I'd expect, and the gyro data needs have artificially high Fisher information.

Working on segments of the whole problem doesn't terminate so quickly. It does more refinement using acceleration alone.

What could be going wrong? The inability to refine the initial estimate by acceleration alone seems to indicate a serious problem.

To test for this, look at the condition number of $J^{T}J$ at the optimal trajectory. If this matrix is ill-conditioned, then you do indeed have a badly conditioned problem.
This would explain the increase in the LM's $\lambda$. If $J^{T}J$ is approaching singularity, LM will increase $\lambda$ to overcome that singularity. This results in shorter and shorter steps, and eventually the LM code just gives up.