You are on page 1of 30

QM3 Skills

Mathematical programming:
Flow problems
Week 1, chapter 3
2020-2021

09/09/2023 1
A simple network flow problem
Transport some good (cars, water,electricity, money)
from 1 to 4 at minimum cost.

€20
2 €50

supply demand
1 €10 4
100 100

€40 €20
3

2
A simple network flow problem
Transport some good (cars, water,electricity, money)
from 1 to 4 at minimum cost, such that the capacity
of the arcs is not exceeded.

€20
2 €50
70 50 demand
supply
1 60 €10 4
100 100
40 70
€40 €20
3

3
Network Flow Model
• A set of nodes,
• A set of arcs or connections, having a direction from tail node to
head node, used to transport flow (amount of a good),
• A weight or cost to transport one unit of flow from tail to head,
• A capacity of each arc (acts as upper bound on the flow),

Arc
Tail node Head node
flow
i unit cost: €30
j
capacity: 60

Variable : amount of flow transported, directly, from node i to node j.

4
Network flow: variables

€20
2 €50
70 50 demand
supply
1 60 €10 4
100 100
40 70
€40 €20
3

Variables: the flows on the arcs

5
Network flow: objective

€20
2 €50
70 50 demand
supply
1 60 €10 4
100 100
40 70
€40 €20
3

Objective: minimize total flow costs

6
Network flow: constraints (1)

€20
2 €50
70 50 demand
supply
1 60 €10 4
100 100
40 70
€40 €20
3

Capacity constraints: flow upper bounds

7
Network flow: constraints (2)

€20
2 €50
70 50 demand
supply
1 60 €10 4
100 100
40 70
€40 €20
3

Balance constraints:

Amount entering node = amount leaving node


8
Flow balance

supply demand

inflow outflow

Inflow + Supply = Outflow + Demand


Standard form:

Inflow – Outflow = Demand – Supply


9
Flow balance
2
supply demand
1 4 100
100

3
Inflow + Supply = Outflow + Demand
Inflow – Outflow = Demand – Supply

Node 1:
Node 2:
Node 3:
Node 4:
10
Flow balance
2
supply demand
1 4 100
100

3
Supply node: node where flow (the supply) enters the network
Demand node: node where flow (the demand) leaves the network.
Transshipment node: node without demand or supply.

Type of node Constraint


Supply node Inflow Outflow = Supply
Demand node Inflow Outflow = Demand
Transshipment node Inflow Outflow = 0 11
Excel sheet Network Flow
Case Network Flow
Arcs X12 X13 X23 X24 X34
Variables 70 30 40 30 70
Objective 20 40 10 50 20 5900
Constraints Coefficients Oper. Oper. RHS
Capacity arc (1,2) 1       70 <= 70
Capacity arc (1,3)   1       30 <= 40
Capacity arc (2,3)     1     40 <= 60
Capacity arc (2,4)       1   30 <= 50
Capacity arc (3,4)         1 70 <= 70
Flow balance node 1 -1 -1     -100 = -100
Flow balance node 2 1   -1 -1   0 = 0
Flow balance node 3 1 1   -1 0 = 0
Flow balance node 4     1 1 100 = 100
12
Network flow: sensitivity report
Variable Cells
    Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$B$3 Variables X12 70 0 20 10 1E+30
$C$3 Variables X13 30 0 40 1E+30 10
$D$3 Variables X23 40 0 10 10 1E+30
$E$3 Variables X24 30 0 50 1E+30 20
$F$3 Variables X34 70 0 20 20 1E+30

Constraints
    Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$G$11 Flow balance node 1 -100 0 -100 1E+30 0
$G$12 Flow balance node 2 0 30 0 0 20
$G$13 Flow balance node 3 0 40 0 0 30
$G$14 Flow balance node 4 100 80 100 0 20
$G$6 Capacity arc (1,2) 70 -10 70 20 10
$G$7 Capacity arc (1,3) 30 0 40 1E+30 10
$G$8 Capacity arc (2,3) 40 0 60 1E+30 20
$G$9 Capacity arc (2,4) 30 0 50 1E+30 20
$G$10 Capacity arc (3,4) 70 -20 70 20 20
13
Network Flow Model
1. Variables: Flows on arcs variable

2. Objective: Minimize total costs

3. Constraints:
a. Capacity constraints, . One for each arc.
b. Flow balance constraints !!!!!
Inflow + Supply = Outflow + Demand
One for each node.

14
Case Car Transportation
Transport cars from stations with an excess to stations with a shortage
(we already made the decision of how many cars should be
transported to each of the stations with a shortage.

demand 30 -100
Boston Newark
50 2 1 supply
60 Col.
3 40 40
80
35 Atlanta 30 Richm. demand
5 4
35
demand
25 45 50
Mobile
70 6 50
J.ville
-110
7
supply
15
Complete model

Balance constraints for nodes 1 and 6

min 30 X 12  40 X 14  50 X 23  35 X 35  40 X 53  40 X 54  35 X 56  25 X 65  50 X 74  45 X 75  50 X 76
 X 12  X 14   100
 X 12  X 23  0
 X 23  X 35  X 53   60
 X 14  X 54  X 74   80 ,
 X 35  X 53  X 54  X 56  X 65  X 75  0
 X 56  X 65  X 76   70
 X 74  X 75  X 76   110
X 12 , X 14 , X 23 , X 35 , X 53 , X 54 , X 56 , X 65 , X 74 , X 75 , X 76  0

16
Complete model
min 30 X 12  40 X 14  50 X 23  35 X 35  40 X 53  40 X 54  35 X 56  25 X 65  50 X 74  45 X 75  50 X 76
 X 12  X 14   100
 X 12  X 23  0
 X 23  X 35  X 53   60
 X 14  X 54  X 74   80 ,
 X 35  X 53  X 54  X 56  X 65  X 75  0
 X 56  X 65  X 76   70
 X 74  X 75  X 76   110
X 12 , X 14 , X 23 , X 35 , X 53 , X 54 , X 56 , X 65 , X 74 , X 75 , X 76  0

When we add up all constraints, then the LHS of the sum


is 0, and therefore the RHS of the sum must be 0 too:

Total Demand Total Supply = 0


or
Total Supply = Total Demand 17
Excel sheet
Case Car Transportation
Case Travel Time
From Newark Boston Columbus Atlanta Mobile J'ville
Arcs X1,2 X1,4 X2,3 X3,5 X5,3 X5,4 X5,6 X6,5 X7,4 X7,5 X7,6
Variables 60 40 60 0 0 0 0 0 40 0 70
Objective 30 40 50 35 40 30 35 25 50 45 50 11900
Constraints Coefficients LHS Op. RHS
Newark -1 -1 -100 = -100
Boston 1 -1 0 = 0
Columbus 1 -1 1 60 = 60
Richmond 1 1 1 80 = 80
Atlanta 1 -1 -1 -1 -1 1 0 = 0
Mobile 1 1 1 70 = 70
J'ville -1 -1 -1 -110 = -110

18
Supply and demand
If total supply exceeds total demand, then not all supply
needs to be used to satisfy demand. Therefore, the balance
constraints for the supply nodes become:

Outflow – Inflow ≤ Supply

Inflow – Outflow  – Supply

(The in the balance constraints of the supply nodes is


replaced by )

In fact, we can do this for ALL nodes. So not only for the
supply nodes.

19
Supply and demand
If total demand exceeds total supply, then not all demand
can be satisfied. Therefore, the balance constraints for the
demand nodes become:

Inflow – Outflow ≤ Demand

(The in the balance constraints of the demand nodes is


replaced by )

In fact, we can do this for ALL nodes. So not only for the
demand nodes.

20
Special case: Travel Time
Find the shortest route from Birmingham 1 to Virginia
Beach 11: travel times in hours.

K’ville 5.0 L’burg


1.7
5 9
Chatt. 4.7 3.3
2.8 3
2.8
B’ham A’ville 3.0 G’boro Va Bch
1 1.7 6 8 11

2.5 Atlanta 1.5 1.1


2.0 2.7
2

G’ville Charl. Raleigh


2.5
4 7 2.3 10
1.5

21
Special case: Travel Time
Find the shortest route from Birmingham to Virginia Beach:
travel times in hours.
Finish 11:
Start 1: K’ville 5.0 L’burg
1.7 1 unit
1 unit 5 9
demand
supply Chatt. 4.7 3.3
2.8 3
2.8
B’ham A’ville 3.0 G’boro Va Bch
1 1.7 6 8 11

2.5 Atlanta 1.5 1.1


2.0 2.7
2

G’ville Charl. Raleigh


2.5
4 7 2.3 10
1.5

2-10: transshipment nodes


22
Case Travel Time: Shortest Path
• Traveling from Birmingham to Virginia Beach is like
sending one unit of flow (a car) from Birmingham to
Virginia Beach:
1. One unit of flow leaves Birmingham on some arc.
2. If the flow enters an intermediate node, it will also leave that
node again.
3. Finally the unit of flow arrives in Virginia Beach.

• The distance traveled is the sum of the distances.

• So, finding the shortest distance can be interpreted as,


sending one unit of flow the cheapest way from source
to destination.

23
Excel sheet Travel Time

Case Travel Tim e


From B'ham Atlanta Chatt G'ville K'ville A'Ville Charl G'boro L'burg Raleigh
Arcs X1,2 X1,3 X2,3 X2,4 X3,5 X3,6 X4,6 X4,7 X5,6 X5,9 X6,8 X6,9 X7,8 X7,10 X8,9 X8,10 X9,11 X10,11
Variables 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1
Objective 2,5 3 1,7 2,5 1,7 2,8 2 1,5 2 5 3 4,7 1,5 2,3 2 1,1 3,3 2,7 11,5
Constraints Coefficients LHS Oper. RHS
B'ham -1 -1 -1,00 = -1
Atlanta 1 -1 -1 0,00 = 0
Chatt 1 1 -1 -1 0,00 = 0
G'ville 1 -1 -1 0,00 = 0
K'ville 1 -1 -1 0,00 = 0
A'ville 1 1 1 -1 -1 0,00 = 0
Charl 1 -1 -1 0,00 = 0
G'boro 1 1 -1 -1 0,00 = 0
L'burg 1 1 1 -1 0,00 = 0
Raleigh 1 1 -1 0,00 = 0
Va Bch 1 1 1,00 = 1

24
Flow models
• In space:
– Transportation (min cost flow)
– Shortest path (min cost flow of one unit)
– Max flow (capacities on the arcs)
• In time:
– Inventory management models
– Financial models

25
Case Inventory management
• A company has an order for 39 microwave ovens,
– 7 have to be delivered in week one,
– 9 in week two,
– 12 in week three, and
– 11 in week four.
• Production cost: Euro 10,000 per microwave oven in
week 1, increases with Euro 100 per week.
• Production capacity: 10 microwave ovens per week.
• Capacity can be increased (by working overtime) to 12 in
weeks 3 and 4, at an additional cost of Euro 1,200 per
microwave oven.
• Inventory cost: Euro 550 per microwave oven per week.

• Determine an optimal production plan for this company.


26
Case Inventory management
R1 R2 R3 O3 R4 O4

≤10 ≤10 ≤10 ≤2 ≤10 ≤2

I12 I23 I34


W1 W2 W3 W4

=7 =9 =12 =11

27
Case Inventory management
• Decision Variables
– Regular production (supply) in periods 1 to 4: R1,
R2, R3, and R4 non-negative integers.
– Overtime production (supply) in periods 3 and 4: O3
and O4.
– Inventory between periods 1 and 2, 2 and 3, and 3 and 4:
I12, I23, and I34
• Objective
– 10,000*R1 + 10,100*R2 + 10,200*R3 + 10,300*R4 +
11,200*O3 + 11,300*O4 + 550*I12 + 550*I23 + 550*I34

28
Case Inventory management
• Constraints
– Regular capacity: R1, R2, R3, R4 ≤ 10
– Overtime capacity: O3, O4 ≤ 2
– Balance: supply + inflow = demand + outflow

R1 = 7 + I12
R2 + I12 = 9 + I23
R3 + O3 + I23 = 12 + I34
R4 + O4 + I34 = 11

– All variables nonnegative integers 29


Case Inventory management

Case Inventory
Regular Overtime Inventory
1 2 3 4 3 4 1 2 3
Variables 8 10 10 10 0 1 1 2 0
Objective 10000 10100 10200 10300 11200 11300 550 550 550 398950
Constraints Coefficients LHS Operator RHS
Constraint 1 1 -1 7 = 7
Constraint 2 1 1 -1 9 = 9
Constraint 3 1 1 1 -1 12 = 12
Constraint 4 1 1 1 11 = 11
Constraint 5 1 8 <= 10
Constraint 6 1 10 <= 10
Constraint 7 1 10 <= 10
Constraint 8 1 10 <= 10
Constraint 9 1 0 <= 2
Constraint 10 1 1 <= 2

30

You might also like