Get sleep. Eat proper meals. Don't skip meals. Talk out loud when analyzing a problem, if necessary. Try to laugh to relieve stress when faced with a knotty problem that you're making no progress on.
Talking out loud is really helpful. I often put in headphones and walk around my neighborhood and talk to myself. Looks like I’m on the phone, but I work out a lot of problems this way