Solver suggestion for many small quadratic problems in C++
An answer to this question on the Scientific Computing Stack Exchange.
Question
I have a C++ program/model that in some parts already use IPOPT (with ADOL-C and ColPack) to solve some pretty large nonlinear problems.
Now in another part of the program, I need to solve a large amount (tens of thousands) of small quadratic problems.
I'd like to have your suggestion if you think it should be more efficient to use again IPOPT, that it is very good for large generic non-linear problems but it seems it takes too much to initialise or if you think it should be better to use a specialized quadratic programming solver that is particularly fast for small problems (and in that case, a name would be appreciated).
For completeness my quadratic problem is:
min: sum_i sum_j a_i,j x_i x_j
sub
sum_i x_i = 1
x_i >= 0
sum_i x_i b_i = c
with i=j ~ 10
Problems are independent.
Answer
OSQP seems like a good choice for this.
It's:
- Free
- Has no external dependencies
- Allows you to play around and develop models in Python or several other languages
- Allows you to export your model in C code with no external dependencies
The resulting C code can then be compiled with your C++ project to get really good performance.