Somewhat related, about 10 years ago I was in a tragic situation where someone I loved would be murdered but I couldn't speak out because of possible retaliation against my family.
I found myself compulsively walking randomly in the city every night for several nights. I would walk half way to a random destination only to change directions in 30 minutes convinced I was headed the wrong way forgetting the previous destination and repeatedly heading part way to successive random destinations. I did this night after night convinced there was a place I needed to go but in retrospect they were completely arbitrary and there was no purpose. I recently read the book Crime and Punishment and there is a scene a bit like this which suggests this may be in our DNA. To share further, I eventually spoke out (at some point you have to pick your poison) and the person did die suddenly and unexpectedly. The NYPD coroner eventually ruled out foul play, but the suspects the suspects left the country immediately after his death so it wouldn't have mattered.
Had you plotted my path you would say that it was the walk of a person who is "lost", yet I knew the city perfectly. However it was accurate to say I was hopelessly lost.
Changing subjects to lighten things up, I would assume there would be a metaphor for walking in way that parallels what your brain is doing when it is searching for a solution but I can't think of a word. Contemplative walks are certainly not erratic and discontinuous as described above. They are smooth and differentiable like a gradient descent.