projected gradient descent python code