Australian world tennis number one Ashleigh Barty has announced her retirement from the sport at age 25.