giaf / hpipm

High-performance interior-point-method QP and QCQP solvers
Other
549 stars 130 forks source link

Dense QP solve always reaches maximum number of iterations only on embedded hardware #106

Open githubNu opened 3 years ago

githubNu commented 3 years ago

Hello again! :)

I prototyped an algorithm using hpipm's d_dense_qp functionalities in MATLAB/ Simulink, where everything goes according to plan: hpipm requires 2 iterations and outputs 0 as the solver status. When applying the algorithm to an embedded hardware, however, hpipm always reaches the maximum number of iterations (I increased the number until 100) and outputs 1 accordingly as the solver status.

Since I am not yet familiar with the solver options, I could use some help narrowing down where to start debugging. Which options/ tolerances have to be manipulated/ relaxed to check whether hpipm would ever find a solution? Are there typical procedures for debugging? Are there some output metrics that I should evaluate?

giaf commented 3 years ago

Well, the debuging procedure depends a lot on what information you can get out of the embedded device. Assuming you can get whatever you want out of there or printed on some screen, then a good starting point to understand what is going on is to analyze the stat statistics (duality measure, step size, residuals, employed factorization, iterative refinement steps, ...) collected at each IPM iteration as in here https://github.com/giaf/hpipm/blob/master/test_problems/test_d_dense.c#L511

You can also try to relax the exit condition on the residuals tolerance (https://github.com/giaf/hpipm/blob/master/test_problems/test_d_dense.c#L395 and subsequent lines) and check if you can get convergence, and then compare the solution with the one you get from the converging solver in your desktop/laptop.