Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Graph Traversal

by nop (Hermit)
on Nov 08, 2000 at 23:53 UTC ( #40617=note: print w/ replies, xml ) Need Help??


in reply to Graph Traversal

All this effort for a game?!?

But since the problem is interesting...

As the problem is certainly NP, try hueristics. Simulated annealing, GAs, tabu search; whatever. The hard part is how you encode the problem. One clever way uses a sort sequence:

  1. Each depot gets an key, a float between 0 and 1
  2. To determine a tour, sort the depots by key
  3. Visit the depots in sorted-by-key order. Return to base (closing the loop) as late as possible (eg going to one more depot would leave you insufficient moves to get home).
Start by randomly assigning keys. Your original tour will be horrible. Improve the tour by any optimization hueristic (annealing, tabu, genetic algs) with reasonable mutuation operators such as
  • randomly swap the keys of two depots
  • randomly peturb the keys of some depots
  • randomly "cross-over" two tours, by taking key values from each
The nice thing about the encoding is that it creates/maintains good subtours, and is robust to mutations (every list of keys is a well-formed tour).

I've used this approach in a machine-scheduling problem with good results. Easily coded, unlike breaking out the heavy machinery of integer programming. Good luck.
nop


Comment on Re: Graph Traversal

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-08-21 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls