I need to project an array y onto a hyperspace defined by (a.x) = c where a is an array in R^N However, x needs to belong in the hypercube {0 <= x_i <= 1, for all i from 1 to n}
Therefore from y belonging anywhere in R^N, I am looking for the closest position (euclidean distance) on the intersection of the hyperplan and that hypercube.
Thanks for your help
Let $y'$ be the nearest point of hyperplane $P$ to $y$; this is just the orthogonal projection of $y$ onto $P$. Also let $C$ be the hypercube. The Pythagorean theorem implies that the squared distance from $y$ to $C\cap P$ is the sum of (squared distance from $y$ to $P$) and (squared distance from $y'$ to $C\cap P$). Hence, the nearest point of $C\cap P$ to $y$ is the same as its nearest point to $y'$.
The point $y'$ is easy to find, but you still have to work with $C\cap P$ and $y'$. The only benefit of the above is that the dimension is decreased by $1$. You will need a quadratic programming routine to find the minimum of $\|x-y'\|^2$ subject to linear inequality constraints $0\le x_k \le 1$ and linear equality constraint $Ax=c$. In which case you might as well not bother finding $y'$ and work with $y$ directly.