TITLE: What is the difference between projected gradient descent and ordinary gradient descent?
QUESTION [60 upvotes]: I just read about projected gradient descent but I did not see the intuition to use Projected one instead of normal gradient descent. Would you tell me the reason and preferable situations of projected gradient descent? What does that projection contribute?

REPLY [9 votes]: I've found two approaches to the algorithm.
Approach 1:

$d_k = Pr(x_k-\nabla f(x_k)) - x_k$ : search direction projected onto feasible set
$x_{k+1} = x_k + t_k d_k$

Approach 2: (Same as answer from p.s.)

$y_k = x_k - t_k \nabla f(x_k)$
$x_{k+1} = Pr(y_k)$ : Project $y_k$ onto feasible set

where $Pr$ is the projection operator.
I've found Approach 1 to work more reliably. Approach 2 fails to converge if the minimizer is on the edge of the feasible set and that edge is perpendicular to the objective gradient. For example, the search directions bounce around the minimizer in algorithm 2.

See here for matlab implementation https://github.com/wwehner/projgrad