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.BUTIt 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.
Levenberg optimizer halts quickly when given more variables, or fewer constraints
optimization;iterative method;stability;nonlinear programming
The last vertex (data point) in the initial estimate was not getting initialized.I'm not sure why this choked the solver. Something to do with the error from one outlier point propagating to the other data points, and pulling everything out of the minimum. It still doesn't make sense that everything would be pulled out after so few iterations, though, and the effect isn't obvious on inspection of the premature solution.