Quantcast
Channel: Yet Another Math Programming Consultant
Viewing all articles
Browse latest Browse all 809

Constrained Least Squares solution times

$
0
0

In this post a somewhat larger linearly constrained least squares problem is solved using R. The problem is simply:

\[\begin{align}\min_P&||P s - f||^2\\ & p_{i,j} \ge 0\\ &\sum_i p_{i,j}\le 1\end{align}\]

To make things easier for the QP solver I implemented the model as:

\[\begin{align}\min_{P,e}&\sum_i e_i^2\\ & \sum_j p_{i,j} s_j = f_i + e_i\\&p_{i,j} \ge 0\\ &\sum_i p_{i,j}\le1\end{align}\]

The timings for a problem with \(39 \times 196\) elements in \(P\) are:

R+constrOptim15 hours
R+auglag2 hours
GAMS+IPOPT1.2 seconds
GAMS+Cplex0.15 seconds

Sometimes it helps to choose the right solver for the problem at hand.


Viewing all articles
Browse latest Browse all 809

Trending Articles