+ Reply to Thread
Results 1 to 3 of 3

Shortest Path Problem using VBA

  1. #1
    Registered User
    Join Date
    11-20-2019
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    2

    Shortest Path Problem using VBA

    Hello!

    Can someone help me to develop this problem?

    Dynamic Program Implementation using a MS Excel VBA program language. Implementation should be capable of solve distinct instances showing the solution found and its value.

    The problem is:

    "Determine the shortest path between two points. To connect the two points must pass through intermediate points."

    Here is the image of the problem:

    Diagrama Gráfico.jpg

    Thank you!
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi !

    As per forum rules, we do not achieve any homework without seeing any logic / algorithm well explained …

  3. #3
    Registered User
    Join Date
    11-20-2019
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    2

    Re: Shortest Path Problem using VBA

    We useDijkstra's algorithm

    For the first iteration, the current intersection will be the starting point, and the distance to it (the intersection's label) will be zero. For subsequent iterations (after the first), the current intersection will be a closest unvisited intersection to the starting point (this will be easy to find).

    From the current intersection, update the distance to every unvisited intersection that is directly connected to it. This is done by determining the sum of the distance between an unvisited intersection and the value of the current intersection and then relabeling the unvisited intersection with this value (the sum) if it is less than the unvisited intersection's current value. In effect, the intersection is relabeled if the path to it through the current intersection is shorter than the previously known paths. To facilitate shortest path identification, in pencil, mark the road with an arrow pointing to the relabeled intersection if you label/relabel it, and erase all others pointing to it. After you have updated the distances to each neighboring intersection, mark the current intersection as visited and select an unvisited intersection with minimal distance (from the starting point) – or the lowest label—as the current intersection. Intersections marked as visited are labeled with the shortest path from the starting point to it and will not be revisited or returned to.

    Continue this process of updating the neighboring intersections with the shortest distances, marking the current intersection as visited, and moving onto a closest unvisited intersection until you have marked the destination as visited. Once you have marked the destination as visited (as is the case with any visited intersection), you have determined the shortest path to it from the starting point

+ 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. Finding shortest path between two points
    By PetrHoracek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-05-2019, 04:18 AM
  2. Shortest Path Between Cells (VBA)
    By basschmidt in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-18-2018, 06:07 PM
  3. Shortest Path Optimization
    By excelcombinations in forum Excel General
    Replies: 2
    Last Post: 09-15-2017, 08:58 AM
  4. Shortest Path between Locations (without repeating)
    By ciaran3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2017, 10:43 AM
  5. VBA that calculates the shortest path
    By den_1985 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-05-2016, 05:58 AM
  6. Shortest path problem with excel solver
    By halatehini in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-11-2016, 12:51 PM

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