How does WHOOP determine my optimal bedtime and wake time?

What factors go into WHOOP suggesting when I should go to bed or wake up?