how to stop or cancel the osqp solver while running?

77 views
Skip to first unread message

yuqin...@gmail.com

unread,
Nov 8, 2018, 2:06:54 AM11/8/18
to OSQP
Hello ,First I want to thank all the developers for this excellent solver.

I see in the OSQPSettings struct:
time_limit : maximum seconds allowed to solve
max_iter: maximum iterations
But how can I stop calculation before the maximum number of iterations or time is reached ?
Is there any functions like osqp_cacel() or osqp_stop() ?

Paul Goulart

unread,
Nov 8, 2018, 2:44:04 AM11/8/18
to yuqin...@gmail.com, OSQP
What interface are you using with OSQP? Most of the interfaces we support allow you to break execution with “ctrl-c”.
> --
> 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/c74cc79a-709c-4c1d-9207-45e7ca074be8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

yuqin...@gmail.com

unread,
Nov 12, 2018, 5:42:14 AM11/12/18
to OSQP
sorry, I didn't describe the problem clearly. I designed a multithreaded program which has two threads.Thread A run osqp_solve ( I set the time_limit equal to 5 seconds), howerver, I want use thread B to send a singal to stop Thread A immediately when the program only run for 3 seconds.

在 2018年11月8日星期四 UTC+8下午3:44:04,Paul Goulart写道:

Paul Goulart

unread,
Nov 14, 2018, 1:40:03 PM11/14/18
to yuqin...@gmail.com, OSQP
in that case I do not think that it is possible using only the code we provide, and you will have to implement some modification yourself. Assuming that you want the code the exit cleanly (i.e. provide whatever answer it has so far), I would suggest that one approach would be to just overwrite the maximum iteration count setting to 1, which would presumably cause the solver to halt immediately. I have not tried it though.
> To view this discussion on the web visit https://groups.google.com/d/msgid/osqp/e8324531-31f3-4b68-88ed-0377c7808652%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages