I'm in no state or inclination to study your code too closely but it seems to crap out on the routes that involve going back on itself... It gets so far and then won't move away from the target only towards and gets itself stuck.
I've only had a go at a routefinder once, it was recursive. It took a stab at the best route using logic and then used results to brute force other routes using the best result so far as the depth.