Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Re^4: Travelling problem (Anyone better 86850?)
in thread Travelling problem

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.

update

This caching is maybe better applied in a "breadth first search" to reduce pathes.

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re^5: Travelling problem (Anyone better 86850?)

Replies are listed 'Best First'.
Re^6: Travelling problem (Anyone better 86850?)
by hdb (Monsignor) on Dec 23, 2013 at 18:22 UTC

    No caching, just brute force. I have now cleaned my code, you have to give the bound on the command line:

      Thanks.

      I'll try a breadth first version with caching after X-mas, the solution BUK showed seems to always chose one of the 3 shortest edges (visual check), but I hope it wont take 27h. =)

      Cheers Rolf

      ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1068222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-25 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found