Title: Lecture 2 Shortest-Path Problems Assignment Problems Transportation Problems
1Lecture 2 Shortest-Path Problems Assignment
ProblemsTransportation Problems
2Agenda
- shortest-path problems
- assignment problems
- transportation problems
- transshipment problems
3Yet 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?
min length of path s.t. a set of constraints
representing a path
4Yet 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
xij such that xijs form a route from the source
to the sink?
4
5Yet Another Simple Concrete Numerical Example
- 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
5
6Formulation
- min 3x12 6x13 2(x23x32) 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.
7Formulation - Question
- min 3x12 6x13 2(x23x32) 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?
7
8Formulation
- 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(x12x21) 6(x13x31) 2(x23x32)
5(x24x42) (x34x43), - s.t.
- x12 x13 1 (node 1, source)
- x12 x32 x42 x21 x23x24 (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
9Formulation - Question
- Would the following formulation be all right?
- min 3(x12x21) 6(x13x31) 2(x23x32)
5(x24x42) (x34x43), - s.t.
- x12 x13 1 (node 1, source)
- x12 x32 x42 x21 x23x24 (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
9
10Formulation
- the formulation for the shortest distance between
node 1 and node 6 - Min z 5(x12x21)8(x13x31)7(x14x41)6(x23x32
)1(x34x43)13(x25x52) 7(x35x53)16(x46x64)6
(x56x65) - s.t. (i.e., subject to)
- x12x13x14 1 (source node)
- x12x32x52 x21x23x25 (node 2)
- x13x23x43x53 x31x32x34x35 (node 3)
- x14x34x64 x41x43x46 (node 4)
- x25x35x65 x52x53x56 (node 5)
- x56x46 1 (node 6)
- xij 0 or 1 for all i, j combinations
Actually it is possible to drop the red
variables.
10
11Assignment Problems
12An 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
J1 J2 J3 J4
M1 9 M 13 8
M2 14 12 7 M
M3 M 5 M 6
M4 10 7 6 11
13An Assignment Problem
- let xij 1 if machine i takes up job j, and 0,
otherwise, i 1, 2, 3, 4, j 1, 2, 3, 4
J1 J2 J3 J4
M1 9 M 13 8
M2 14 12 7 M
M3 M 5 M 6
M4 10 7 6 11
(each machine has one job)
(each job is assigned to one machine)
14Comments
- 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
15Exercise 1
- Can we omit variables xij if the corresponding
cij M, where M is a large positive number
practically representing infinity? - physical meaning setting such xij to zero
J1 J2 J3 J4
M1 9 M 13 8
M2 14 12 7 M
M3 M 5 M 6
M4 10 7 6 11
16Exercise 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.
J1 J2 J3 J4
M1 9 M 13 8
M2 14 12 7 M
M3 M 5 M 6
M4 10 7 6 11
17Exercise 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.
J1 J2 J3 J4
M1 9 M 13 8
M2 14 12 7 M
M3 M 5 M 6
M4 10 7 6 11
18Exercise 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.
J1 J2 J3 J4 J5
M1 9 4 13 8 21
M2 14 12 7 9 3
M3 7 5 5 6 14
M4 10 7 6 11 17
19Exercise 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.
J1 J2 J3 J4 J5
M1 9 4 13 8 21
M2 14 12 7 9 3
M3 7 5 5 6 14
M4 10 7 6 11 17
20Exercise 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.
J1 J2 J3 J4 J5
M1 9 4 13 8 21
M2 14 12 7 9 3
M3 7 5 5 6 14
M4 10 7 6 11 17
21Exercise 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.
J1 J2 J3 J4 J5
M1 9 4 13 8 21
M2 14 12 7 9 3
M3 7 5 5 6 14
M4 10 7 6 11 17
22Exercise 7
- Formulate a model that finds the shortest paths
from nodes 1 and 2 to node 6
23Transportation Problems
24Transportation 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 cij for unit flow from supplier i to
customer j as labeled on diagram, e.g., 5 (
cAD) for each unit from A to D - objective minimize the total cost to satisfy the
requirement
25Transportation 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
26Transportation Problem
- one trick to define variables what decisions are
made? - answer the amount of goods sent from supplier i
to customer j - let xij amount of goods sent from supplier i
to customer j, i A, B j C, D, F
27Transportation Problem
- objective
- min 3xAC 5xAD 2xAE
- xBC 8xAD 6xAE
- constraints
- supply from A xAC xAD xAE 60
- supply from B xBC xBD xBE 40
- demand of C xAC xBC 20
- demand of D xAD xBD 45
- demand of E xAE xBE 25
- non-negativity xAC, xAD, xAE, xBC, xAD, xAE ? 0
28Questions
- is the formulation correct?
- can we use xAC xBC ? 20, xAD xBD ? 45, xAE
xBE ? 25 instead? - what does it mean by can or cannot?
min 3xAC 5xAD 2xAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE 60, xBC xBD xBE
40, xAC xBC 20, xAD xBD 45, xAE xBE
25, xAC, xAD, xAE, xBC, xAD, xAE ? 0.
29Questions
min 3xAC 5xAD 2xAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE 60, xBC xBD xBE
40, xAC xBC ? 20, xAD xBD ? 45, xAE xBE ?
25, xAC, xAD, xAE, xBC, xAD, xAE ? 0.
min 3xAC 5xAD 2xAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE 60, xBC xBD xBE
40, xAC xBC 20, xAD xBD 45, xAE xBE
25, xAC, xAD, xAE, xBC, xAD, xAE ? 0.
30Questions
- how to model impossible to send goods from A to
E - setting cAE to ?
- numerically cAE M, a large positive number
min 3xAC 5xAD MxAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE 60, xBC xBD xBE
40, xAC xBC 20, xAD xBD 45, xAE xBE
25, xAC, xAD, xAE, xBC, xAD, xAE ? 0.
31Questions
- how to model impossible to send goods from A to
E - omitting xAE (i.e., setting to xAE 0)
min 3xAC 5xAD xBC 8xAD 6xAE, s.t. xAC
xAD 60, xBC xBD xBE 40, xAC xBC
20, xAD xBD 45, xBE 25, xAC, xAD,
xAE, xBC, xAD, xAE ? 0.
32Balanced 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
33To Transform into a Balanced Transportation
Problem
- total supply 100 ? 90 total demand
- adding a dummy customer T
- what is bT?
- what is cAT?
- what is cBT?
34To Transform into a Balanced Transportation
Problem
- bT 100?90 10
- can cAT 0 and cBT 0?
- what does it mean by can or cannot?
- can cAT 19 and cBT 19?
- can cAT 19 and cBT 31?
- the same trick for total supply ? total demand
35Comments
min 3xAC 5xAD 2xAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE xAT 60, xBC xBD xBE
xBT 40, xAC xBC 20, xAD xBD 45, xAE
xBE 25, xAT xBT 10, xAC, xAD, xAE, xBC,
xAD, xAE, xAT, xBT ? 0.
36A General Transportation Problem
- m suppliers
- n customers
- quantity supplied by supplier i, ai
- quantity demanded by customer j, bj
- cost of unit flow from supplier i to customer j,
cij - objective minimize the total shipment cost
37Special Structure for the Set of Constraints
- very special property as long as all ai and bj
are integral, the minimum solution is integral - no need to use integer programming
?xAC ? xAD ? xAE ? xAT
?60, ?xBC ? xBD ? xBE
? xBT ?40, xAC xBC 20,
xAD xBD
45, xAE xBE
25, xAT xBT 10, xAC,
xAD, xAE, xBC, xAD, xAE, xAT, xBT ? 0.
38Solution 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 3xAC 5xAD 2xAE xBC 8xAD 6xAE,
s.t. xAC xAD xAE xAT 60, xBC xBD xBE
xBT 40, xAC xBC 20, xAD xBD 45, xAE
xBE 25, xAT xBT 10, xAC, xAD, xAE, xBC,
xAD, xAE, xAT, xBT ? 0.
39Example 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
Jan Feb March April
Capacity in Regular Time (pcs) 100 150 140 160
Capacity in Overtime (pcs) 50 75 70 80
Demand (pcs) 80 200 300 200
40Example 5.3 of 7
- possible to model as a transportation problem
Jan Feb March April
Jan Regular 1 1.3 1.6 1.9
Overtime 1.5 1.8 2.1 2.4
Feb Regular ? 1 1.3 1.6
Overtime ? 1.5 1.8 2.1
March Regular ? ? 1 1.3
Overtime ? ? 1.5 1.8
April Regular ? ? ? 1
Overtime ? ? ? 1.5
41Capacitated Transportation Problems
- lower and upper bounds for xij
- 0 lij xij uij
- solved by extensions of the specialized algorithms