projected gradient descent algorithm python