Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
A traveling salesman wishes to make a number of sales calls in different
cities. Naturally he wants to spend as little time actually traveling as possible (he is not paid for travel time). He sets up the various cities he wants to visit and looks up the travel time from each one to every other one. He writes a simple computer program to figure out all of the possible routes and compare the total travel time in each route, in order to find the fastest possible route. (The problem could also be worked for minimum distance). The program is written for any arbitrary number of cities. But the salesman discovers that the program appears not to work for more than a certain number of cities. Explain what the limit is and how it can be overcome. 73 de Jim, N2EY |
#2
![]() |
|||
|
|||
![]()
This looks like a problem from Discrete Mathematics. To me it appears to be
a specific problem in finding what is called the minimum "Spanning Tree" for a graph. For your problem the graph vertices would be the cities visited and the distance, or what ever you want to minimize, assigned to the edges connecting the vertices together. Two known algorithms are used to find a set of edges connecting all the vertices together that will minimize the item assigned to the edges as a weight factor. The two algorithms are "Prim's" and Kruskal's". Their work was done during the 1950's. At most (N-1) edges, where N is the total number of edges in the graph, are selected during the course of the algorithm. Nether algorithm has any limit on the size of the graph, vertices or number of edges, that I can find. (Robert Clay Prim born 1921 Swee****er Texas) (Joseph Bernard Kruskal born 1928 New York city) The book I have as a reference is: Discrete Mathematics And Its Applications (Third Edition 1995) Published by McGraw Hill By Kenneth H. Rosen ISBN 0-07-053965-0 Look at pages 593 (section 8.6) to 598. There are some older methods that use what is called "depth-first searches", or "back tracking", and the other is called "breadth-first search". These are covered under (section 8.5) pages 583 to 588. The problem with writing code for graph transversals is two fold. The first is keeping track of where you have been, and second is not getting stuck in what is called a "cycle" or a loop in the graph. The way I've seen this done is using recursive code while building a tree structure of the nodes "visited", where each tree entry is for a graph node. The code starts at a beginning node, or current node, then follows every path from the current node to the next node if the path is not already listed in the tree entry for the current node. The new path is entered in the path list for the current node. If the path is already listed then it has already been explored and should be skipped. If the next node is not in the tree then enter it and make it the current node, other wise keep looking for another path from the current node location to another node. If no more paths exists from the current node then return to the previous node, making it the current node, while marking the path as blocked. When no more paths exist to explore at the current node then return to the previous node and explore the next path not yet transversed. This procedure continues until either a path to the destination node is found, or all nodes and paths have been explored. Then doing a tree transversal "in order" looking for paths not marked as blocked will generate a list of nodes and paths between nodes spanning from the begining node to the destination node. Graph theory is interesting and has a lot of practical applications in the real world. -- Leland C. Scott KC8LDO Wireless Network Mobile computing on the go brought to you by Micro$oft "N2EY" wrote in message ... A traveling salesman wishes to make a number of sales calls in different cities. Naturally he wants to spend as little time actually traveling as possible (he is not paid for travel time). He sets up the various cities he wants to visit and looks up the travel time from each one to every other one. He writes a simple computer program to figure out all of the possible routes and compare the total travel time in each route, in order to find the fastest possible route. (The problem could also be worked for minimum distance). The program is written for any arbitrary number of cities. But the salesman discovers that the program appears not to work for more than a certain number of cities. Explain what the limit is and how it can be overcome. 73 de Jim, N2EY |
#3
![]() |
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP: 2 meter repeater intermod problem from pager transmitters | General | |||
OT EMI problem with stove and internet connection | Homebrew | |||
Heathkit SB-200 Amplifier Problem Help? | Boatanchors | |||
National NCX-5 transmit/receive offset problem | Equipment | |||
National NCX-5 transmit/receive offset problem | Equipment |