0% found this document useful (0 votes)
45 views21 pages

06 - 3 - SPM - Lecture & Assignment

The document describes the shortest path model and algorithm for finding the shortest route between an origin and destination in a network. The model includes nodes and links with associated costs. The labeling algorithm works by iteratively labeling nodes as "solved" once their shortest path from the origin is determined, until the destination node is solved and the shortest path can be traced. An example applies the algorithm to find the shortest path from node A to F in a sample network.

Uploaded by

Brenda Carrasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views21 pages

06 - 3 - SPM - Lecture & Assignment

The document describes the shortest path model and algorithm for finding the shortest route between an origin and destination in a network. The model includes nodes and links with associated costs. The labeling algorithm works by iteratively labeling nodes as "solved" once their shortest path from the origin is determined, until the destination node is solved and the shortest path can be traced. An example applies the algorithm to find the shortest path from node A to F in a sample network.

Uploaded by

Brenda Carrasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Shortest Path Model

• Network includes:
– Nodes: cities, customers, demand points
– Arcs or Links: Transportation links
– Number for each link to represent travel cost, time or distance.

6 C
6
4 B 9
A 2 5 F
E
3 4
7
D

Dr. Mostafa Hajiaghaei-Keshteli


1
Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey
[email protected]
Shortest Path Problem
• Given:
– A network with a specified origin and destination.
– The distance (or travel time or cost) for each link.

• Determine the shortest path from the origin to the destination.

• Solution: Labeling algorithm (one of many)


– Nodes are labeled as "solved" or "unsolved".
– Solved = shortest path from the origin to that node is known.

Dr. Mostafa Hajiaghaei-Keshteli


2
Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey
[email protected]
Shortest Path Labeling Algorithm

1. The origin is a solved node. All others are unsolved.

2. For each solved node, find the one unsolved node that is nearest and
calculate the minimum total distance (origin to solved node + solved node
to nearest unsolved node).

3. Make the unsolved node with the smallest total distance a solved node.

4. Repeat steps 2 and 3 until the destination is a solved node.

5. Trace the shortest path.


Dr. Mostafa Hajiaghaei-Keshteli
3
Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey
[email protected]
Shortest Path Example 1

• Find the shortest path from A to F.


B
20 C 12 16 F
A E

Dr. Mostafa Hajiaghaei-Keshteli


4
Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey
[email protected]
Shortest Path Example 1
B
* 20 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20

Dr. Mostafa Hajiaghaei-Keshteli


5
Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey
[email protected]
Shortest Path Example 1
B
* 20 * 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 1
B
* 20 * 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C
A
C

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 1
B
* 20 * 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C
A B 22
C

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 1
B
* 20 * 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22
C D 26

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 1
B
*
* 20 * 12 16 F
A C E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26

10

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 1
B*
*
A 20 *
C 12 16 F
E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C
A B 22. B 22 A-B
C D 26
A
B
C 11
Shortest Path Example 1
B*
*
A 20 *
C 12 16 F
E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C
A B 22. B 22 A-B
C D 26
A D 30
B
C 12
Shortest Path Example 1
B*
*
A 20 *
C 12 16 F
E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26
A D 30
B E 32
C 13
Shortest Path Example 1
B*
*
A 20 *
C 12 16 F
E

D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20. C 20 A-C
A B 22. B 22 A-B
C D 26
A D 30
B E 32
C D 26 14
Shortest Path Example 1
B*
*
A 20 *
C 12 16 F
E

*
D
Nearest Total Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26
A D 30
B E 32
C D 26 D 26 C-D 15
B*

A
* 20 C
* 12
E* 16 F

*
Nearest Total D Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26
A D 30
B E 32 D 26 C-D
C D 26
A
B E 32
C E 32
D E 31 E 31. D-E

16
B*

A
* 20 C
* 12
E* 16 F *
*
Nearest Total D Minimum
Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26
A D 30
B E 32 D 26 C-D
C D 26
B E 32
C E 32
D E 31 E 31. D-E
B F 49
D F 44 F 44 D-F
E F 47 17
Trace Shortest Path Backwards

Nearest Total Minimum


Solved Unsolved Distance Nearest Distance Path
A C 20 C 20 A-C
A B 22 B 22 A-B
C D 26
A D 30
B E 32 D 26 C-D
C D 26
B E 32
C E 32
D E 31 E 31 D-E
B F 49
D F 44 F 44 D-F
E F 47 A-C-D-F 18
Check Answer
B
20 C 12 16 F
A E

A-C-D-F Length = 20+6+18 = 44

19

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 2

• Find the shortest path from A to K.


3
D G
B
H
A E K
11 I
C
J
F
20

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]
Shortest Path Example 3

• Find the shortest path from A to K.


16
D G
B
H
A E K
10 I
C
J
F
21

Dr. Mostafa Hajiaghaei-Keshteli Escuela de Ingeniería y Ciencias, Tecnologico de Monterrey


[email protected]

You might also like