Download presentation
Presentation is loading. Please wait.
Published byKyleigh Howarth Modified over 10 years ago
1
1 Lecture 2 Shortest-Path Problems Assignment Problems Transportation Problems
2
2 Agenda shortest-path problems assignment problems transportation problems transshipment problems
3
3 Yet Another Simple Concrete Numerical Example obvious shortest path between node 1 and node 4 But how to formulate? What is the direction of flow in the middle arc, upward or downward? Or any flow at all? 1 2 5 6 3 1 2 4 3 min length of path s.t. a set of constraints representing a path
4
4 Yet Another Simple Concrete Numerical Example a route from the source to the sink = a collection of arcs from the source to the sink some restriction on the choice of arcs in to form a path question: How to define the values of a group of x ij such that x ij s form a route from the source to the sink? 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3
5
5 Yet Another Simple Concrete Numerical Example properties of a route from the source to the sink: each route represented by a collection of x ij = 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 1 2 4 3 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3 1 2 5 6 3 1 2 4 3
6
6 Formulation min 3x 12 + 6x 13 + 2(x 23 +x 32 ) + 5x 24 + x 34, s.t.s.t. x 12 + x 13 = 1(node 1, source) x 12 + x 32 = x 23 + x 24 (node 2) x 13 + x 23 = x 32 + x 34 (node 3) x 24 + x 34 = 1(node 4, sink) x 12, x 13, x 32, x 24, x 34 {0, 1} 1 2 5 6 3 1 2 4 3 選最 node 1 到 node 4 最短徑,就像將一單位 ( 1 unit )的水從 node 1 送到 node 4 ,水流 過的 arcs 就是在路徑上的 arcs.
7
7 Formulation - Question min 3x 12 + 6x 13 + 2(x 23 +x 32 ) + 5x 24 + x 34, s.t.s.t. x 12 + x 13 = 1(node 1, source) x 12 + x 32 = x 23 + x 24 (node 2) x 13 + x 23 = x 32 + x 34 (node 3) x 24 + x 34 = 1(node 4, sink) x 12, x 13, x 32, x 24, x 34 {0, 1} Would both x 23 and x 32 be positive at minimum? 1 2 5 6 3 1 2 4 3
8
8 Formulation tricks in our formulation only outflow from source node only inflow to destination node variables x 21, x 31, x 42, and x 43 set to zero in the textbook min 3(x 12 +x 21 ) + 6(x 13 +x 31 ) + 2(x 23 +x 32 ) + 5(x 24 +x 42 ) + (x 34 +x 43 ), s.t.s.t. x 12 + x 13 = 1 (node 1, source) x 12 + x 32 + x 42 = x 21 + x 23 +x 24 (node 2) x 13 + x 23 + x 43 = x 31 + x 32 + x 34 (node 3) x 24 + x 34 = 1 (node 4, destination) x 12, x 13, x 32, x 24, x 34 {0, 1}; x 21 = x 31 = x 42 = x 43 = 0 1 2 5 6 3 1 2 4 3
9
9 Formulation - Question Would the following formulation be all right? min 3(x 12 +x 21 ) + 6(x 13 +x 31 ) + 2(x 23 +x 32 ) + 5(x 24 +x 42 ) + (x 34 +x 43 ), s.t.s.t. x 12 + x 13 = 1 (node 1, source) x 12 + x 32 + x 42 = x 21 + x 23 +x 24 (node 2) x 13 + x 23 + x 43 = x 31 + x 32 + x 34 (node 3) x 24 + x 34 = 1 (node 4, destination) x 12, x 13, x 32, x 24, x 34, x 21, x 31, x 42, x 43 {0, 1} 1 2 5 6 3 1 2 4 3
10
10 Formulation the formulation for the shortest distance between node 1 and node 6: Min z = 5(x 12 +x 21 )+8(x 13 +x 31 )+7(x 14 +x 41 )+6(x 23 +x 32 )+1(x 34 +x 43 )+13(x 25 +x 52 ) +7(x 35 +x 53 )+16(x 46 +x 64 )+6(x 56 +x 65 ) s.t. (i.e., subject to): x 12 +x 13 +x 14 = 1 (source node) x 12 +x 32 +x 52 = x 21 +x 23 +x 25 (node 2) x 13 +x 23 +x 43 +x 53 = x 31 +x 32 +x 34 +x 35 (node 3) x 14 +x 34 +x 64 = x 41 +x 43 +x 46 (node 4) x 25 +x 35 +x 65 = x 52 +x 53 +x 56 (node 5) x 56 +x 46 = 1 (node 6) x ij = 0 or 1 for all i, j combinations Actually it is possible to drop the red variables.
11
11 Assignment Problems
12
12 An Assignment Problem 4 jobs, J1 to J4, are assigned to 4 machines, M1 to M4, such that each machine can handle exactly 1 job implicitly each job is assigned only to one machine the costs of assigning machine i to job j are shown in the RHS matrix, where M denotes a feasible but expensive assignment find the assignment that minimizes the total assignment cost J1J2J3J4 M19M138 M214127M M3M5M6 M4107611
13
13 An Assignment Problem let x ij = 1 if machine i takes up job j, and = 0, otherwise, i = 1, 2, 3, 4, j = 1, 2, 3, 4 J1J2J3J4 M19M138 M214127M M3M5M6 M4107611 (each machine has one job) (each job is assigned to one machine)
14
14 Comments an assignment problem is easy to solve if there are any additional constraints other than those shown in a standard assignment model, the resulted model is no longer an assignment problem, which may be difficult to solve
15
15 Exercise 1 Can we omit variables x ij if the corresponding c ij = M, where M is a large positive number practically representing infinity? physical meaning: setting such x ij to zero J1J2J3J4 M19M138 M214127M M3M5M6 M4107611
16
16 Exercise 2 Formulate a model for the 4-machine, 4- job problem such that each machine can take exact one job and jobs J1 and J2 must not be assigned to M4. J1J2J3J4 M19M138 M214127M M3M5M6 M4107611
17
17 Exercise 2 Formulate a model for the 4-machine, 4- job problem such that each machine can take exact one job and jobs J1 and J2 must not be assigned to M4. J1J2J3J4 M19M138 M214127M M3M5M6 M4107611
18
18 Exercise 3 Suppose that there are 5 jobs and 4 machines. Formulate an assignment model that finds the cheapest way to assign 4 out of the 5 jobs to the 4 machines, with each machine taking exactly one job. J1J2J3J4J5J5 M19413821 M21412793 M3755614 M410761117
19
19 Exercise 4 Suppose that there are 5 jobs and 4 machines. Formulate a model that finds the cheapest way to assign all 5 jobs to the 4 machines such that only one of the 4 machines takes 2 jobs. J1J2J3J4J5J5 M19413821 M21412793 M3755614 M410761117
20
20 Exercise 5 Suppose that there are 5 jobs and 4 machines. Formulate a model that finds the cheapest way to assign all 5 jobs to the 4 machines such that M2 takes 2 jobs and the other machines take one job. J1J2J3J4J5J5 M19413821 M21412793 M3755614 M410761117
21
21 Exercise 6 Suppose that there are 5 jobs and 4 machines. Formulate a model that finds the cheapest way to assign all 5 jobs to the 4 machines such that each machine can take at most 2 jobs. J1J2J3J4J5J5 M19413821 M21412793 M3755614 M410761117
22
22 Exercise 7 Formulate a model that finds the shortest paths from nodes 1 and 2 to node 6 4 5 7 8 9 11 1 2 4 3 5 6 6 3 14
23
23 Transportation Problems
24
24 Transportation Problem two suppliers, A and B 60 units from A 40 units from B three customers, C, D, and E 20 units for C 45 units for D 25 units for E unit cost c ij for unit flow from supplier i to customer j as labeled on diagram, e.g., $5 (= c AD ) for each unit from A to D objective: minimize the total cost to satisfy the requirement 6 1 2 5 8 3 A B D C E 60 40 25 45 20
25
25 Transportation Problem steps of modeling define variables express the objective function in terms of the variables and parameters express the constraints in terms of the variables and parameters 6 1 2 5 8 3 A B D C E 60 40 25 45 20
26
26 Transportation Problem one trick to define variables: what decisions are made? answer: the amount of goods sent from supplier i to customer j let x ij = amount of goods sent from supplier i to customer j, i = A, B; j = C, D, F 6 1 2 5 8 3 A B D C E 60 40 25 45 20
27
27 Transportation Problem objective min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE constraints supply from A: x AC + x AD + x AE ≤ 60 supply from B: x BC + x BD + x BE ≤ 40 demand of C: x AC + x BC = 20 demand of D: x AD + x BD = 45 demand of E: x AE + x BE = 25 non-negativity: x AC, x AD, x AE, x BC, x AD, x AE 0 6 1 2 5 8 3 A B D C E 60 40 25 45 20
28
28 Questions is the formulation correct? can we use x AC + x BC 20, x AD + x BD 45, x AE + x BE 25 instead? what does it mean by can or cannot? 6 1 2 5 8 3 A B D C E 60 40 25 45 20 min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE ≤ 60, x BC + x BD + x BE ≤ 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AC, x AD, x AE, x BC, x AD, x AE 0.
29
29 Questions can we use 6 1 2 5 8 3 A B D C E 60 40 25 45 20 min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE = 60, x BC + x BD + x BE = 40, x AC + x BC 20, x AD + x BD 45, x AE + x BE 25, x AC, x AD, x AE, x BC, x AD, x AE 0. min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE = 60, x BC + x BD + x BE = 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AC, x AD, x AE, x BC, x AD, x AE 0.
30
30 Questions how to model: impossible to send goods from A to E setting c AE to numerically c AE = M, a large positive number 6 1 M 5 8 3 A B D C E 60 40 25 45 20 min 3x AC + 5x AD + Mx AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE ≤ 60, x BC + x BD + x BE ≤ 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AC, x AD, x AE, x BC, x AD, x AE 0. 6 1 5 8 3 A B D C E 60 40 25 45 20
31
31 Questions how to model: impossible to send goods from A to E omitting x AE (i.e., setting to x AE = 0) min 3x AC + 5x AD + x BC + 8x AD + 6x AE, s.t. x AC + x AD ≤ 60, x BC + x BD + x BE ≤ 40, x AC + x BC = 20, x AD + x BD = 45, x BE = 25, x AC, x AD, x AE, x BC, x AD, x AE 0. 6 1 5 8 3 A B D C E 60 40 25 45 20
32
32 Balanced Transportation Problems a balanced transportation problem: total supply = total demand computational advantages for a balanced transportation problem possible to transform any imbalanced transportation problem to a balanced one
33
total supply = 100 90 = total demand adding a dummy customer T what is b T ? what is c AT ? what is c BT ? 33 To Transform into a Balanced Transportation Problem 6 1 2 5 8 3 A B D C E 60 40 25 45 20 c AT c BT 6 1 2 5 8 3 A B D C E 60 40 25 45 20 T bTbT
34
b T = 100 90 = 10 can c AT = 0 and c BT = 0? what does it mean by can or cannot? can c AT = 19 and c BT = 19? can c AT = 19 and c BT = 31? the same trick for total supply total demand 34 To Transform into a Balanced Transportation Problem c AT c BT 6 1 2 5 8 3 A B D C E 60 40 25 45 20 T bTbT
35
35 Comments 0 0 6 1 2 5 8 3 A B D C E 60 40 25 45 20 T 10 min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE + x AT = 60, x BC + x BD + x BE + x BT = 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AT + x BT = 10, x AC, x AD, x AE, x BC, x AD, x AE, x AT, x BT 0.
36
36 A General Transportation Problem m suppliers n customers quantity supplied by supplier i, a i quantity demanded by customer j, b j cost of unit flow from supplier i to customer j, c ij objective: minimize the total shipment cost
37
37 Special Structure for the Set of Constraints very special property: as long as all a i and b j are integral, the minimum solution is integral no need to use integer programming x AC x AD x AE x AT = 60, x BC x BD x BE x BT = 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AT + x BT = 10, x AC, x AD, x AE, x BC, x AD, x AE, x AT, x BT 0. c AT c BT 6 1 2 5 8 3 A B D C E 60 40 25 45 20 T bTbT
38
38 Solution of a Transportation Problem at least three approaches linear programming, Simplex method by CPLEX, Gurobi special transportation Simplex by Dantzig (1951) (for balanced transportation problems) basically Simplex, but specialized steps because of the special structure of the problem network flow algorithm, Ford and Fulkerson (1956, 1962) min 3x AC + 5x AD + 2x AE + x BC + 8x AD + 6x AE, s.t. x AC + x AD + x AE + x AT = 60, x BC + x BD + x BE + x BT = 40, x AC + x BC = 20, x AD + x BD = 45, x AE + x BE = 25, x AT + x BT = 10, x AC, x AD, x AE, x BC, x AD, x AE, x AT, x BT 0.
39
39 Example 5.3 of [7] transportation problems occurring in many contexts, not necessarily transportation production capacities and demands in the next four months unit cost of production at regular time = $1 unit cost of production at overtime = $1.5 storage cost = $0.3 per month per unit how to produce to satisfy the demands in the four months with minimum total cost JanFebMarchApril Capacity in Regular Time (pcs)100150140160 Capacity in Overtime (pcs)50757080 Demand (pcs)80200300200
40
40 Example 5.3 of [7] possible to model as a transportation problem JanFebMarchApril JanRegular11.31.61.9 Overtime1.51.82.12.4 FebRegular 11.31.6 Overtime 1.51.82.1 MarchRegular 11.3 Overtime 1.51.8 AprilRegular 1 Overtime 1.5
41
41 Capacitated Transportation Problems lower and upper bounds for x ij 0 ≤ l ij ≤ x ij ≤ u ij solved by extensions of the specialized algorithms
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.