Solving Linear Least Squares with Linear Inequality Constraints

2.5k Views Asked by At

Given:

$$ \begin{aligned} A \in \mathbb{R}^{m \times n} \\ y \in \mathbb{R}^{m \times 1} \\ c, d \in \mathbb{R}^{m \times 1} \\ d \geq c \geq 0 \\ y \geq 0 \end{aligned} $$

I seek $\hat{x}$:

$$ \hat{x} = \arg\min_{x} \|Ax - y\|_2 \\ s.t. \; \hat{x} \in \mathbb{R}^{m \times 1} , \; d \geq A \hat{x} \geq c$$

How do I compute $\hat{x}$?

1

There are 1 best solutions below

8
On BEST ANSWER

Royi's answer shows how to solve it with lsqlin.

You could also use alglib under the GPL license, using a form of an active-set algorithm.

Active set resources:

  • http//www.alglib.net/optimization/boundandlinearlyconstrained.php#header1
  • http//en.wikipedia.org/wiki/Active_set
  • http//research.harkegard.se/papers/cdc2002_ca.pdf