Code compatibility and performance questions
petlist opened this issue · comments
Hello Alexander,
I found your code on Github and was trying to use it inside my trajectory optimisation code (also based on Eigen). I would have perhaps a feature request and a couple of remarks/observations on the performance.
Feature request:
- At the moment, the solver accepts (const) references to MatrixXd and VectorXd dense matrices. This is quite limiting for users trying to pass statically allocated matrices or matrices with single precision scalars. Moreover, possibly unnecessary evaluation and copying will be called if one attempts to pass matrix expressions. My suggestion is to use the recommended Eigen::Ref construction whenever possible.
Performance questions:
-
For a particular instance of convex QP (not strictly convex) QPMAD returns the 'solved' status, where as the primal solution vector consist of 'nans' exclusively. The QP is obtained by linearising a nonlinear optimal control problem. If a small regularisation is added (making it strictly), QPMAD returns numeric results. Could it be possibly an issue?
-
Is it possible to warm start the problem somehow?
-
What it would take to support sparse matrices?
Thanks,
Peter
Hi,
- API is sloppy indeed, I'll try to find time to fix it, but I would strongly advise against using single precision floats.
- This algorithm is designed for problems with positive definite hessians, you have to add regularization by yourself. Lack of error reporting is an issue though.
- Nope. You can get a small performance gain by not initializing upper triangular part of the Hessian, solver uses only the lower part.
- It would require implementing another solver.
Hi Alexander,
Thanks for the quick reply! I really like your implementation and would be interested to use the solver or at least benchmark against it.
Should I open a separate issue for the API improvement? It would be also fine if the solver could provide some info on its performance: final tolerance, number of iterations etc?
Another issue is that sometimes one needs the dual solution as well as the primal. Is there any chance you could make dual variable public, or provide getters for it?
Finally, in your interface the Hessian matrix is not passed as constant. Is there a reason for that?
Best,
Peter
The latest version in master
branch addresses the discussed issues (see CHANGELOG for the details)
- Input matrices can now be statically allocated, in fact the solver can be instantiated statically as well to avoid memory allocations.
- Added
getNumberOfInequalityIterations()
andgetInequalityDual()
methods that can be called after successfulsolve()
. - Solver now throws an error if CHolesky factorization fails, e.g., if the Hessian is not positive definite.
- I've added a repo with solver benchmark -> https://github.com/asherikov/qpmad_benchmark, you are welcome to contribute QP problems to this repo -> https://github.com/asherikov/qp_collection for testing.
I am closing this issue, open a new one if you need more features or find a bug.