As there goes a saying, when nothing goes right, go left.
"It is hardest thing in the world to be good thinker without being a good self examiner"
The best thing to at that time is, to get your mind diverted to some other work. Generally, when I am in that situation what I do is just have a cup of coffee and take a detective book or fiction novel and start reading. While doing this initially you can't concentrate on the book but after a few pages of reading, you will get immersed in the fiction story. My experience is when do this after some time in our mind we will get a flash and we will find a solution to the problem. That solution will be the best for solving your one of the problems. This is my personal experience.
I feel, sleeping at that may be a little difficult as our mind will be working on the problems only. So diversion is the best technic to be used