Non-determinism of the solutions

339 views
Skip to first unread message

zwan...@gmail.com

unread,
Feb 7, 2019, 2:30:42 PM2/7/19
to OSQP
Hi,

I recently observed a non-determinist behavior of the solutions from OSQP solver in C++ given the same inputs when setting the check_termination to 1 and esp_abs and esp_rel to big numbers, i.e., 1e-3. There is slight difference in the solutions of a simple MPC problems between each run in the test with the same inputs. Is this expected behavior? What can cause this non-determinism? Thanks.

Paul Goulart

unread,
Feb 7, 2019, 3:34:47 PM2/7/19
to OSQP
This is not the expected behaviour.   Are you running the simulations with warm-start enabled and providing slightly different initial conditions?

Another possibility is that there is some non-determinism in the linear solver step.   Are you perhaps using the MKL Pardiso solver?   If so, you could try switching to QDLDL and see if that rectifies things.

Bartolomeo Stellato

unread,
Feb 7, 2019, 3:42:50 PM2/7/19
to OSQP
This problem can be linked to the adaptive rho interval. 

When it is set to 0 (automatic) the solver measures the ratio between the setup and iterations time to decide when to adapt rho and refactor. If the time measurements vary significantly in your machine and you put check_termination=1 this could change significantly the behavior of the solver between runs. You could try disabling the automatic interval by setting the option `adaptive_rho_interval=0`. See https://osqp.org/docs/interfaces/solver_settings.html

In general, I suggest not to use check_termination=1 because it can slow down the solver a lot. It is cheaper to perform 25 more iterations instead of checking the termination conditions at each step.

Let us know if it helps.

Best,
Bartolomeo


--
You received this message because you are subscribed to the Google Groups "OSQP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osqp+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osqp/d82335e8-a0d7-45cf-89b9-2d392788eec1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

zwan...@gmail.com

unread,
Feb 8, 2019, 3:58:00 PM2/8/19
to OSQP
Hi Paul,

Thank you! I believe I am using the QDLDL solver since this is by default. Also, I tried the warm start off and it gave similar behavior. I tried what Bartolomeo said and it resolved the issue. Thanks for the quick reply. Really good solver.

zwan...@gmail.com

unread,
Feb 8, 2019, 4:00:54 PM2/8/19
to OSQP
Hi Bartolomeo,

Thanks for the quick response. I tried what you suggested to set the `adaptive_rho_interval` to nonzero value (I think this is what you real meant) and it produced consistent results through multiple runs of the test. BTW, I set `check_termination=1` is only because for debugging purpose since in this way it is easier to see this behavior. In my real algorithm, I set it to 25 for fast convergence. Thanks again for your answer. This is really an awesome QP solver. Kudos to you guys!
Reply all
Reply to author
Forward
0 new messages