Just another Perl shrine | |
PerlMonks |
Re^5: Travelling problem (Anyone better 86850?)by LanX (Saint) |
on Dec 23, 2013 at 17:09 UTC ( [id://1068222]=note: print w/replies, xml ) | Need Help?? |
Well, which is far better than 95166. =) Anyway both results are already within 20% from the optimum. May I ask, if you cache intermediate results? If you go from 1 to 24 and reach node X again via the same nodes (just other order) then the options for the rest of the way are identical. In my experience such memoizing helps to bound very efficiently.
updateThis caching is maybe better applied in a "breadth first search" to reduce pathes.
Cheers Rolf ( addicted to the Perl Programming Language)
In Section
Seekers of Perl Wisdom
|
|