In this post a somewhat larger linearly constrained least squares problem is solved using R. The problem is simply:
minP||Ps−f||2∑ipi,j≤1pi,j≥0 |
To make things easier for the QP solver I implemented the model (in GAMS) as:
minP,e∑ie2i∑jpi,jsj=fi+ei∑ipi,j≤1pi,j≥0 |
The timings for a problem with 39×196 elements in P are:
R+constrOptim | 15 hours |
R+auglag | 2 hours |
GAMS+IPOPT | 1.2 seconds |
GAMS+Cplex | 0.15 seconds |
Cplex uses a specialized convex quadratic solver, while IPOPT is a general purpose NLP (nonlinear programming) solver.
Sometimes it helps to choose the right solver for the problem at hand.
References
- Follow-up on this blog detailing the effects on my reformulation is here: http://yetanothermathprogrammingconsultant.blogspot.com/2016/11/constrained-least-squares-solution.html
No comments:
Post a Comment