Could someone kindly suggest a method of solving the following constrained (equality and inequality) system of equations in the least squares fashion?

$\underset{x}{min}\frac{1}{2}\Vert Ax-b{\Vert}_{2}^{2}$

such that

$\begin{array}{c}{x}_{i}+{x}_{j}=1\phantom{\rule{1em}{0ex}}\text{for a certain}i,j\\ 0{x}_{k}{\tau}_{k}\phantom{\rule{1em}{0ex}}\text{where}k\ne i,j\end{array}$

${\tau}_{k}$ is the upper bound for ${x}_{k}$.

$\underset{x}{min}\frac{1}{2}\Vert Ax-b{\Vert}_{2}^{2}$

such that

$\begin{array}{c}{x}_{i}+{x}_{j}=1\phantom{\rule{1em}{0ex}}\text{for a certain}i,j\\ 0{x}_{k}{\tau}_{k}\phantom{\rule{1em}{0ex}}\text{where}k\ne i,j\end{array}$

${\tau}_{k}$ is the upper bound for ${x}_{k}$.