I am solving an optimization problem that uses sub-gradient method. I changed the problem and now it requires me to find Euclidean projection of a point $y$ onto following convex set:
$$S=\{(x_1,x_2,x_3,x_4):x_1+x_2+x_3-x_4=a\}$$
$a$ being a constant belonging to $\mathbb R$. All variables are in real number space. $y$ belongs to $\mathbb R^4$.
I already know that if the last term was an addition instead of subtraction, it would be a projection onto a simplex that has a straightforward algorithm to solve.
Hint: Try setting $x=y+t(1,1,1,-1)$ (the vector being in the direction of the normal) and find $t$ so that $x\in S$.