+ Reply to Thread
Results 1 to 3 of 3

Travelling Salesman problem

  1. #1
    Registered User
    Join Date
    06-04-2017
    Location
    India
    MS-Off Ver
    2013
    Posts
    54

    Travelling Salesman problem

    As I can't share the actual data, so I am mocking this up in dummy data (see attached data)

    A bus travels from one bus stop to other. Bus departed from the Portland Amrak Station and arrived at the Mount Pocono depot. Bus second trip departed from the Mount Pocono depot and arrived at the Indianapolis Downtown.

    How to determine the departure and arrival location for 257th trip
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Travelling Salesman problem

    It's not clear to me exactly what you are trying to do or what part of the program you are having trouble with.

    I recall this conversation from some time ago (https://www.excelforum.com/excel-for...el-solver.html ) talking about shortest path problems. As I understand it, the traveling salesman problem is, in many ways, a special case of the shortest path problem where you start and end and the same node and visit every node in the map. I would probably start something like this by understanding how to program a shortest path algorithm, then make it work for the specific case of the traveling salesman.

    A quick internet search found this page specific to the traveling salesman problem: http://blog.excelmasterseries.com/20...blem-with.html

    As near as I can tell, your specific list has only one path in and one path out of each node, so there is only one valid path through the list. Is that representative of your actual problem? If so, it might be mostly a lookup problem where you:
    1) Enter the desired initial departure location. (maybe in K2)
    2) Lookup function to return the arrival node based on the departure node. =VLOOKUP(K2,A:B,2,FALSE)
    3) Copy arrival node to departure node. =L2 in K3
    4) Copy lookup function into L3
    5) copy K3:L3 down to the bottom of the list.

    From there the nth leg of the journey is simply the (n+1)th row of this table.

    I think if you clarify your requirements, we should be able to use one of those as starting points to find a solution.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Valued Forum Contributor Hydraulics's Avatar
    Join Date
    07-15-2018
    Location
    Udine - Italy
    MS-Off Ver
    Office 365
    Posts
    373

    Re: Travelling Salesman problem

    Dayton Travel Station -> Baker Station

    C2 is the first trip, so we can write 1.

    Then, in the same column, use the formula

    =INDEX($A$2:$C$400,MATCH(A3,$B$2:$B$400,0),3)+1

    Finally, add some conditional formatting.

    HTH,

    Francesco
    Attached Files Attached Files
    Last edited by Hydraulics; 08-03-2020 at 04:54 PM.
    Aim high or don't even try.
    ---------------------------------
    If your question has been answered, don't forget to mark the thread as SOLVED.
    If you find an answer helpful, click on the star icon at the bottom of the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. That Travelling Salesman/Sat-Nav style problem....
    By mrvp in forum The Water Cooler
    Replies: 3
    Last Post: 10-06-2012, 07:25 PM
  2. Excel 2007 : Traveling salesman problem
    By Pink_123 in forum Excel General
    Replies: 0
    Last Post: 05-06-2011, 09:02 PM
  3. Traveling Salesman Problem
    By davegugg in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 07-20-2010, 03:54 PM
  4. Replies: 1
    Last Post: 01-17-2010, 02:49 PM
  5. [SOLVED] How can the Travelling Salesman Problem be solved using Solver Ad.
    By andrei665 in forum Excel General
    Replies: 3
    Last Post: 04-16-2005, 12:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1