Hi,
I'm using the MATLAB codegen interface to generate a custom solver in OSQP 3.1. At codegen time I initialize the upper and lower bounds to 1 and -1 (uniformly for all elements).
Before calling the resulting custom solver via emosqp('solve'), I typically need to update the upper and lower bounds to new values via emosqp('update_bounds',l_new,u_new).
This has been working well and I've had similar performance from the codegen and non-codegen implementation.
However, I am now finding that when some elements of l_new and u_new are zero, the codegen solver performs very poorly compared to non-codegen. For instance emosqp('solve') runs 1000000 iterations without much progress, while QP.solve() completes in 3000 iterations.
If I redo the codegen process with upper and lower bounds initialized to l_new and u_new at codegen time, performance is restored: emosqp('solve') performs about as well as QP.solve().
If I redo the codegen process with upper and lower bounds initialized to l_new-(1e-6) and u_new+(1e-6), performance is still restored.
If I redo the codegen process with upper and lower bounds initialized to l_new-(1e-3) and u_new+(1e-3), performance of the codegen version becomes very poor again.
I theorized that scaling might be to blame--but disabling scaling in the QP.setup call (prior to QP.codegen) does not help.
Are some other settings necessary to ensure performance of the codegen solver after changing upper/lower bound values?
Thanks,
Matt