Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Travelling problem (Anyone better 86850?)

by tangent (Deacon)
on Dec 23, 2013 at 15:30 UTC ( #1068202=note: print w/ replies, xml ) Need Help??


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

Best I could get is also 86850. Used a simple genetic algorithm - mutate using crossover points, exchange, reverse, and a bit of shuffling. Then cull all the losers and repeat. Quite ruthless really. First time I have tried this approach, seems very powerful.

Update: Sorry BrowserUK, I updated it within about 20 seconds of posting, you are indeed quick off the mark.


Comment on Re^2: Travelling problem (Anyone better 86850?)
Re^3: Travelling problem (Ignore this. Too quick off the mark!)
by BrowserUk (Pope) on Dec 23, 2013 at 15:32 UTC
    Best I could get is also 8650.

    I think you dropped a digit? (The absolute minimum is 74,283 and that's impossible :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: Travelling problem (Anyone better 86850?)
by BrowserUk (Pope) on Dec 23, 2013 at 15:40 UTC
    Quite ruthless really. First time I have tried this approach, seems very powerful.

    You mustn't be too ruthless though. You have to allow some of the less good candidates to evolve otherwise the algorithm will lock into a local minima and never explore further.

    For example, there are at least 8 better solutions than the 86850:

    84860 85075 85294 85469 85509 85684 85982 86197

    But these will never be discovered by minor evolution from the 86850 solution.

    You have to allow some radical variations (with significantly less good scores) to evolve for a while to discover these better ones.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      That makes sense. I found I had to keep adding variations to avoid dead ends, the shuffles in particular helped. How would you choose those 'radical variations'? At random from the laggards, or according to some other criteria, some way of spotting potential?
        How would you choose those 'radical variations'?

        I haven't found a good method yet. So far I've tried:

        • Swapping pairs of nodes for the top N so far.
        • Shuffling the nodes between two random points for the top N so far.
        • Reversing the nodes between two random picks for the top N so far.
        • Adding N new totally random shuffles to the set being evolved.

        None of these seems to prevent the local minima phenomena.

        The best approach I've found is once the top N stop changing; throw them all away (remembering the best 1) and start over with a completely new set of random picks.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
      By widening the net, and a bit more shuffling I get:
      84860 85075 85294 85469 85489 85509 85684 85923
Re^3: Travelling problem (Anyone better 86850?)
by LanX (Canon) on Dec 23, 2013 at 15:50 UTC
    > First time I have tried this approach, seems very powerful.

    Well not sure if this problem isn't too easy for a good test, considering that the naive approach already gives a solution of 95166, which is probably good enough in most cases.

    I have the impression that a little branch and bound with just the 3 or 4 shortest edges per node (instead of just one) would quickly produce much better results.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    ) at least for the OP.

      I have the impression that a little branch and bound with just the 3 or 4 shortest edges per node (instead of just one) would quickly produce much better results.

      Prove it! (You've done a great job of quoting wikipedia; how about putting some of your reading into practice?)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        And what have you "proven" so far except dropping numbers and (most probably) miscalculating the lower bound?

        Cheers Rolf

        ( addicted to the Perl Programming Language)

        Branch & Bound with the two shortest edges finds the following in less than 30 seconds:

        95166 90498 90298 89653 88925 88838 86867 85294 84860

      My branch and bound is running on the three shortest nodes for 27hrs now. Best so far 88491.

        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)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-11-24 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls