Download presentation
Published byLouisa Sabrina Gilbert Modified over 10 years ago
1
Outline Introduction Shortest Route Problems Formulation
Labeling Algorithm 1
2
Chapter 8 Network Optimization Model & PERT/CPM
2
3
Structure of Chapter 8 8.1 Network Models 網路模型
8.1.1 The Shortest Route Problem 最短路徑問題 8.1.2 The Minimum Spanning Tree Problem 最小 延展樹問題 8.1.3 The Maximal Flow Problem 最大流量問題 8.2 PERT / CPM 計劃評核術/要徑法 3
4
8.1 Network Models definitions circles: nodes (節點), vertices (角)
2 1 3 4 2 1 3 4 2 1 3 4 2 1 3 4 definitions circles: nodes (節點), vertices (角) lines: arcs, branches directed (具方向的) or not 4
5
Formulation of the Shortest Route Problem
5
6
8.1.1 The Shortest Route Problem 最短路徑問題
motivation: to find the shortest route from the origin (起點, i.e., one location, source node) to the destination (終點, i.e., another location, sink node) in a network driving, production and inventory problems, etc. what to do? formulation solution methods ij aijxij, s.t. i xij - i xji = sj for all j formulation, with known parameter values aij, sj an optimizer, a solver optimal solution 6
7
Formulation How to formulate? 只要細想,每個人都懂。 要是不知如何下手,就從簡單的問題開始。
the formulation for the shortest distance between node 1 and node 6: Min z = 5(x12+x21)+8(x13+x31)+7(x14+x41)+6(x23+x32)+1(x34+x43)+13(x25+x52) +7(x35+x53)+16(x46+x64)+6(x56+x65) s.t. (i.e., subject to): x12+x13+x14 = 1 (source node) x12+x32+x52 = x21+x23+x25 (node 2) x13+x23+x43+x53 = x31+x32+x34+x35 (node 3) x14+x34+x64 = x41+x43+x46 (node 4) x25+x35+x65 = x52+x53+x56 (node 5) x56+x46 = 1 (node 6) xij = 0 or 1 for all i, j combinations How to formulate? 只要細想,每個人都懂。 要是不知如何下手,就從簡單的問題開始。 7
8
Formulation (建模) a one-arc, two-node problem how to formulate?
source node 1 sink node 2 how to formulate? either the upper or the lower route (上路還是下路? ); how to model mathematically? min 9U + 7L s.t. U + L = 1 U, L {0, 1} 7 9 1 2 數學模式(formulation)只是用精練(複雜?)的語言表達日常的事物,所以建模的重點在補捉事物的要素、精髓。如上述問題,什麼是最重要的決定? 8
9
Formulation a three-arc, three-node problem
source node 1 sink node 3 either the upper or the lower route; how to model mathematically? min (3+2)U + 4L s.t. U + L = 1 U, L {0, 1} 2 9 3 1 9
10
Formulation Of course we know the shortest distance between node 1 and node 4. What is the direction of flow in the middle arc, upward or downward? Or any flow at all? However, in a formulation we better do not assume any knowledge about the optimal solution. 1 2 5 6 3 4 我們當然曉得在最短的路徑中我們會從node 2跑去node 3,但在formulation中我們不能直接引用最短路徑的結果。 How to formulate? 10
11
建模是邏輯問題,不是數學問題。每一條限制式都代表系統中一種實在的現象。要建模就得先掌握這些實在的現象,才能用變量表達。
Formulation In our context, formulation is the process to express the dynamics a physical phenomenon mathematically in terms of variables that we define. physical phenomenon ij aijxij, s.t. i xij - i xji = sj for all j formulation, with known parameter values aij, sj 建模是邏輯問題,不是數學問題。每一條限制式都代表系統中一種實在的現象。要建模就得先掌握這些實在的現象,才能用變量表達。 11
12
Formulation properties of a route from the source to the sink:
each route represented by a collection of xij = 1, with the other off-route variables = 0 source: one arc out sink: one arc in intermediate node: one arc in and one arc out 1 2 5 6 3 4 12
13
Formulation min 3x12 + 6x13 + 2(x23+x32) + 5x24 + x34, s.t.
x12 + x13 = 1 (node 1, source) x12 + x32 = x23 + x24 (node 2) x13 + x23 = x32 + x34 (node 3) x24 + x34 = 1 (node 4, sink) x12, x13, x32, x24, x34 {0, 1} 選最node 1到node 4最短徑,就像將一單位(1 unit)的水從node 1送到node 4,水流過的arcs就是在路徑上的arcs. 13
14
Formulation - Question
min 3x12 + 6x13 + 2(x23+x32) + 5x24 + x34, s.t. x12 + x13 = 1 (node 1, source) x12 + x32 = x23 + x24 (node 2) x13 + x23 = x32 + x34 (node 3) x24 + x34 = 1 (node 4, sink) x12, x13, x32, x24, x34 {0, 1} Would both x23 and x32 be positive at minimum? 1 2 5 6 3 4 14
15
Formulation 1 2 5 6 3 4 tricks in our formulation only outflow from source node only inflow to destination node variables x21, x31, x42, and x43 set to zero in the textbook min 3(x12+x21) + 6(x13+x31) + 2(x23+x32) + 5(x24+x42) + (x34+x43), s.t. x12 + x13 = 1 (node 1, sosurce) x12 + x32 + x42 = x21 + x23+x24 (node 2) x13 + x23 + x43 = x31 + x32 + x34 (node 3) x24 + x34 = 1 (node 4, destination) x12, x13, x32, x24, x34 {0, 1}; x21 = x31 = x42 = x43 = 0 15
16
Formulation - Question
Would the following formulation be all right? min 3(x12+x21) + 6(x13+x31) + 2(x23+x32) + 5(x24+x42) + (x34+x43), s.t. x12 + x13 = 1 (node 1, sosurce) x12 + x32 + x42 = x21 + x23+x24 (node 2) x13 + x23 + x43 = x31 + x32 + x34 (node 3) x24 + x34 = 1 (node 4, destination) x12, x13, x32, x24, x34 , x21, x31, x42, x43 {0, 1} Example 8.2 of the textbook uses the above formulation. 1 2 5 6 3 4 16
17
Example 8.2. (a) Formulate this shortest route problem of node 1 to node 7 as a math model. (b) Use the labeling procedure to solve this problem. 17
18
Actually it is possible to drop the red variables.
Formulation the formulation for the shortest distance between node 1 and node 6: Min z = 5(x12+x21)+8(x13+x31)+7(x14+x41)+6(x23+x32)+1(x34+x43)+13(x25+x52) +7(x35+x53)+16(x46+x64)+6(x56+x65) s.t. (i.e., subject to): x12+x13+x14 = 1 (source node) x12+x32+x52 = x21+x23+x25 (node 2) x13+x23+x43+x53 = x31+x32+x34+x35 (node 3) x14+x34+x64 = x41+x43+x46 (node 4) x25+x35+x65 = x52+x53+x56 (node 5) x56+x46 = 1 (node 6) xij = 0 or 1 for all i, j combinations Actually it is possible to drop the red variables. 18
19
Algorithms for the Shortest Route Problem
19
20
Algorithms Background
how to determine the shortest route? background: development of computers made possible computation for large networks led to step by step instructions to teach a computer to calculate 20
21
Algorithms Background
Is it possible to compute the length of every route and then find the minimal? how many routes are there from node 1 to node 9? six, 2 R (i.e., right) and 2 D (i.e., down) in each route 2 1 3 4 5 6 7 9 8 21
22
Algorithms Background
the total number of routes increases quickly with number of nodes. what is a quicker method? # of nodes # of routes 9 6 25 70 121 441 961 在一個N2節點的網路中,路徑的總數目是(2N!)/(N!N!) 252 5.411011 4671017 22
23
The Labeling Algorithm for the Shortest Route Problem
23
24
The Labeling Procedure
N : set of nodes with estimated shortest distance from the source; with temporary labels to be modified later. L : set of nodes with shortest distance from the source known; with permanent labels. Boundary for L and N (35, 2)* 1 4 3 5 6 7 2 13 18 20 22 27 30 49 26 24 32 33 (13, 1)* (61, 4) (0, S)* (53, 4) (67, 3) In each step (i.e., iteration), one node is moved from N to L. (18, 1)* 24
25
The Labeling Procedure
a simple procedure in which the effort grows slowly with the number of nodes (運算所需的功 夫隨節點的數目慢慢增加) notions defined for the execution of the labeling procedure two sets of nodes, L (nodes with well-defined distance from source node S) and N (nodes with temporary, estimated distance from source S) permanent label (永久標籤) (d, y)* of a node x L: the shortest route from S to x is of d units, and it passes through y before going into x 25
26
The Labeling Procedure
two sets of nodes, L and N, during execution of the procedure L, set of labeled nodes nodes with definite distance from source S before executing the algorithm: L = {S} after executing the algorithm: L = the set of all nodes N, set of non-labeled nodes nodes with temporary, estimated distance from source S before executing the algorithm: N = all nodes except S after executing the algorithm: N = 26
27
Idea of the Labeling Procedure
three-node network, node 1 as source and node 3 as destination what is the shortest distance from node 1 to node 3? we need an executable procedure for a computer 2 9 3 1 27
28
Idea of the Labeling Procedure
source: node 1; destination: node 3 2 9 3 1 (0, S)* for sure the shortest distance from node 1 to itself is zero L = {1}, & permanent label of node 1, PL1 = (0, S)* N = {2, 3}, and there is no label on any of the two nodes before labeling which is the node closest to node 1? 28
29
Idea of the Labeling Procedure
before the iteration: L = {1}, N = {2, 3}, PL1 = (0, S)* Iteration two nodes are connected to node 1 their distance from node 1 are put as the labels for sure node 2 is the closer to node 1 turn the label (3, 1)* of node 2 permanent after the iteration: L = {1, 2}, N = {3}, PL1 = (0, S)* , PL2 = (3, 1)* which is the closest node to L? (9, 1) (3, 1) 2 9 3 1 (0, S)* (9, 1) (3, 1)* 2 9 3 1 (0, S)* 29
30
Idea of the Labeling Procedure
before the iteration: L = {1, 2}, N = {3}, PL1 = (0, S)* , PL2 = (3, 1)* the label of node 3 is now permanent after the iteration: L = {1, 2, 3}, N = , PL1 = (0, S)* , PL2 = (3, 1)*, and PL3 = (5, 2)* (9, 1) (3, 1)* 2 9 3 1 (0, S)* (9, 1) (3, 1)* 2 9 3 1 (0, S)* (5, 2)* 30
31
Example 8.1. the successive graphs by applying the labeling procedure
31
32
Example 8.1. The temporary label of node 2 should be turned permanent, because it is the shortest among all temporary labels. (0, S )* 32
33
Example 8.1. With the temporary label of node 2 turned permanent, the temporary labels of nodes connected to node 2 may be revised or created. * 4 6 (0, S )* * 33
34
Example 8.1. * 6 (23, 4) (0, S )* * * 34
35
Example 8.1. With the temporary label of node 3 turned permanent, the temporary label of node 5 is revised. * * (0, S )* * * 35
36
Example 8.1. * * * (0, S )* * * 36
37
Example 8.1. * * * (0, S )* * * * 37
38
Example 8.1. to find the shortest route and its length
* * * * * * Node Distance Shortest Route Alternative Shortest Route 38
39
Example 8.2. (a) Formulate this shortest route problem of node 1 to node 7 as a math model. (b) Use the labeling procedure to solve this problem. 39
40
A Remark on SPP 我們只討論了一些基本的模型、方法。想想如何 用Excel解SPP; 將演算法寫成電腦程式;
如何比較演算法的優劣; … 40
41
Assignment #3 Chapter 8 (for shortest route problems)
Problem 1 (a), (b), plus (c) Formulate this problem as a mathematical programming model. Possibly more problems for the next topic 41
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.