Sometimes, you need to do an activity that's vastly different from your current train of thought. It could be a hobby or a monotonous task. Mine is running. It gets me out of the house, see the sights, and exercises my physical muscles.
When I get back home, the problems might still be there, but I'm looking at it from a fresh perspective.