Implemented the Accelerated Gradient Algorithm