An Algorithmic Solution to Insomnia http://ilya.sukhar.com/blog/an-algorithmic-solution-to-insomnia.html