Considering the following constrained linear least-squares problem: constrained linear least-squares problems with bounds x ≤ 0
min (1/2) *||(C.x-d)||^2 , x<=0
where d is scalar( 1*1); C and x are vectors (e.g. C can be 1*m and x can be m*1). Is there any analytical solution for that? Can we find the optimum point (x) without using any optimization toolbox?
You want to find $x \in \mathbb{R}^n$ to minimize $|c^Tx-d|$ subject to $x \leq 0$, where $c$ is a given vector in $\mathbb{R}^n$ and $d$ a given real number. This is not difficult. An optimal solution $x^*=(x_1^*, ..., x_n^*)$ can be found that has at most one nonzero component.
Case 1: Suppose $d\geq 0$:
-If there is an $i \in\{1, ... ,n\}$ such that $c_i<0$, then define $x_i^*=\frac{d}{c_i}$ and $x_j^*=0$ for all $j \neq i$. Then $|c^Tx^*-d|=0$ and $x^*\leq 0$.
-Else, $c_i \geq 0$ for all $i \in \{1, ..., n\}$. Thus, $c^Tx \leq 0$ for any vector $x$ that satisfies $x \leq 0$. It follows that $x^*=0$ is optimal.
Case 2: Suppose $d<0$:
-If there is an $i \in \{1, ..., n\}$ such that $c_i>0$, then define $x_i^*=\frac{d}{c_i}$ and $x_j^*=0$ for all $j \neq i$. Then $|c^Tx^*-d|=0$ and $x^*\leq 0$.
-Else, $c_i \leq 0$ for all $i \in \{1, ..., n\}$. Thus, $c^Tx \geq 0$ for any vector $x$ that satisfies $x \leq 0$. It follows that $x^*=0$ is optimal.