# Checking solution quality of SQP_RTI

Dear all,

First of all thanks for creating this great tool. I’m wondering if there is any guarantee of the solution quality when using SQP_RTI. I think it could happen that sometimes a single SQP iteration doesn’t lead to a good solution, and I did observe similar situations where some of the open loop predictions do not seem to be optimal, especially when the activeness of some constraints change at a time point as the closed loop simulation evolves. In my case, I’ve checked the res_stat term and it reaches a magnitude of 1e1. If my understanding is correct, a large stationary residual implies that the solution quality is bad, since it means \frac{\partial L}{\partial x} is large in some directions ,where L is the Lagrangian and x is the primal variables. I’m just wondering if anyone have any suggestions about this. I understand that the motivation of RTI is that we prefer inexact but fast solution, but I’m not sure in general if the solution is bad (e.g. in my case the residual comes to 1e1), will you guys just accept that?

And interestingly, I found that the magnitude of res_stat changes greatly if I choose different L1 penalty coefficient of slack variables (i.e. the zu and zl terms. In my case Zu and Zl are all zeros). Larger zu and zl result in larger res_stat. I don’t understand the reason behind this. I would be very happy if anyone can explain this!

Thanks a lot!