Professional Documents
Culture Documents
This
is
a
minimum-‐cost
flow
problem.
To
set
up
a
spreadsheet
model,
first
list
all
of
the
arcs
as
shown
in
B4:C11,
along
with
their
capacity
(F4)
and
unit
cost
(G4:G11).
Only
the
arc
from
F1
to
WH1
is
capacitated.
Then
list
all
of
the
nodes
as
shown
in
I4:I11
along
with
each
node’s
supply
or
demand
(L4:L11).
1
B C D E F G H I J K L
3 From To Capacity Unit Cost Nodes Supply/Demand
4 F1 WH1 250 $40 F1 400
5 F1 WH2 $35 F2 250
6 F2 WH2 $25 WH1 0
7 WH1 WS1 $60 WH2 0
8 WH1 WS2 $35 WS1 -200
9 WH2 WS2 $55 WS2 -100
10 WH2 WS3 $50 WS3 -150
11 WH2 WS4 $65 WS4 -200
The
changing
cells
are
the
amount
of
flow
to
send
through
each
arc.
These
are
shown
in
Flow
(D4:D11)
below,
with
an
arbitrary
value
of
10
entered
for
each.
The
flow
through
the
arc
from
F1
to
WH1
must
be
less
than
the
capacity
of
250,
as
indicated
by
the
constraint
D4
<=
F4.
B C D E F G
3 From To Flow Capacity Unit Cost
4 F1 WH1 10 <= 250 $40
5 F1 WH2 10 $35
6 F2 WH2 10 $25
7 WH1 WS1 10 $60
8 WH1 WS2 10 $35
9 WH2 WS2 10 $55
10 WH2 WS3 10 $50
11 WH2 WS4 10 $65
2
For
each
node,
calculate
the
net
flow
as
a
function
of
the
changing
cells.
This
can
be
done
using
the
SUMIF
function.
In
each
case,
the
first
SUMIF
function
calculates
the
flow
leaving
the
node
and
the
second
one
calculates
the
flow
entering
the
node.
For
example,
consider
the
F1
node
(I4).
SUMIF(From,
Nodes,
Flow)
sums
each
individual
entry
in
Flow
(the
changing
cells
in
D4:D11)
if
that
entry
is
in
a
row
where
the
entry
in
From
(B4:B11)
is
the
same
as
in
that
row
of
Nodes
(i.e.,
F1).
Since
I4
=
F1
and
the
only
rows
that
have
F1
in
From
(B4:B11)
are
rows
4
and
5,
the
sum
in
the
ship
column
is
only
over
these
same
rows,
so
this
sum
is
D4+D5.
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 10 <= 250 $40 F1 20 = 400
5 F1 WH2 10 $35 F2 10 = 250
6 F2 WH2 10 $25 WH1 10 = 0
7 WH1 WS1 10 $60 WH2 10 = 0
8 WH1 WS2 10 $35 WS1 -10 = -200
9 WH2 WS2 10 $55 WS2 -20 = -100
10 WH2 WS3 10 $50 WS3 -10 = -150
11 WH2 WS4 10 $65 WS4 -10 = -200
J
3 Net Flow
4 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
The
goal
is
to
minimize
the
total
cost
of
shipping
the
product
from
the
factories
to
the
wholesalers.
The
cost
is
the
SUMPRODUCT
of
the
Unit
Costs
with
the
Flow,
or
Total
Cost
=
SUMPRODUCT(UnitCost,
Flow).
This
formula
is
entered
into
TotalCost
(D13).
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 10 <= 250 $40 F1 20 = 400
5 F1 WH2 10 $35 F2 10 = 250
6 F2 WH2 10 $25 WH1 10 = 0
7 WH1 WS1 10 $60 WH2 10 = 0
8 WH1 WS2 10 $35 WS1 -10 = -200
9 WH2 WS2 10 $55 WS2 -20 = -100
10 WH2 WS3 10 $50 WS3 -10 = -150
11 WH2 WS4 10 $65 WS4 -10 = -200
12
13 Total Cost $3,650
C D
13 Total Cost =SUMPRODUCT(UnitCost,Flow)
3
The
Solver
information
and
solved
spreadsheet
are
shown
below.
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 250 <= 250 $40 F1 400 = 400
5 F1 WH2 150 $35 F2 250 = 250
6 F2 WH2 250 $25 WH1 0 = 0
7 WH1 WS1 200 $60 WH2 0 = 0
8 WH1 WS2 50 $35 WS1 -200 = -200
9 WH2 WS2 50 $55 WS2 -100 = -100
10 WH2 WS3 150 $50 WS3 -150 = -150
11 WH2 WS4 200 $65 WS4 -200 = -200
12
13 Total Cost $58,500
Solver Parameters
Set Objective Cell: TotalCost
Range Name Cells
To: Min
Capacity F4
By Changing Variable Cells:
Flow D4:D11
Flow
From B4:B11
Subject to the Constraints:
NetFlow J4:J11
D4 <= Capacity Nodes I4:I11
NetFlow = SupplyDemand SupplyDemand L4:L11
Solver Options: To C4:C11
Make Variables Nonnegative TotalCost D13
Solving Method: Simplex LP UnitCost G4:G11
J
3 Net Flow
4 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
C D
13 Total Cost =SUMPRODUCT(UnitCost,Flow)
Thus,
Flow
(D4:D11)
indicates
how
to
distribute
the
product
so
as
to
achieve
the
minimum
Total
Cost
(D13)
of
$58,500.
4
6.S2 Assessing the Capacity of a Pipeline Network
Exxo
76
is
an
oil
company
that
operates
the
pipeline
network
shown
below,
where
each
pipeline
is
labeled
with
its
maximum
flow
rate
in
million
cubic
feet
(MMcf)
per
day.
A
new
oil
well
has
been
constructed
near
A.
They
would
like
to
transport
oil
from
the
well
near
A
to
their
refinery
at
G.
Formulate
and
solve
a
network
optimization
model
to
determine
the
maximum
flow
rate
from
A
to
G.
15 D
14
B 6
20 12
4 G
A 2 F
20
8 16
15
C 23
E
This
is
a
minimum-‐cost
flow
problem.
Associated
with
each
pipe
in
the
network
will
be
an
arc
(or,
for
pipes
which
might
flow
in
either
direction,
two
arcs,
one
in
each
direction).
To
set
up
a
spreadsheet
model,
first
list
all
of
the
arcs
as
shown
in
B5:C19,
along
with
their
capacity
(F5:F19).
Then
list
all
of
the
nodes
as
shown
in
H5:H11.
All
the
transshipment
nodes
(every
node
except
the
start
node
A
and
the
end
node
G)
will
be
constrained
to
have
net
flow
=
0
(Supply/Demand
=
0).
The
start
node
(A)
and
end
node
(G)
are
left
unconstrained.
We
want
to
maximize
the
net
flow
out
of
node
A.
B C D E F G H I J K
4 From To Capacity Nodes Supply/Demand
5 A B 20 A
6 A C 20 B = 0
7 B C 2 C = 0
8 B D 15 D = 0
9 B F 12 E = 0
10 C B 2 F = 0
11 C E 23 G
12 C F 8
13 D F 6
14 D G 14
15 E F 15
16 E G 16
17 F D 6
18 F E 15
19 F G 4
5
The
changing
cells
are
the
amount
of
flow
to
send
through
each
pipe
(arc).
These
are
shown
in
Flow
(D5:D19)
below,
with
an
arbitrary
value
of
0
entered
for
each.
The
flow
through
each
arc
is
capacitated
as
indicated
by
the
<=
in
E5:E19.
B C D E F
3 thousands of gallons / hour
4 From To Flow Capacity
5 A B 0 <= 20
6 A C 0 <= 20
7 B C 0 <= 2
8 B D 0 <= 15
9 B F 0 <= 12
10 C B 0 <= 2
11 C E 0 <= 23
12 C F 0 <= 8
13 D F 0 <= 6
14 D G 0 <= 14
15 E F 0 <= 15
16 E G 0 <= 16
17 F D 0 <= 6
18 F E 0 <= 15
19 F G 0 <= 4
6
For
each
node,
calculate
the
net
flow
as
a
function
of
the
changing
cells.
This
can
be
done
using
the
SUMIF
function.
In
each
case,
the
first
SUMIF
function
calculates
the
flow
leaving
the
node
and
the
second
one
calculates
the
flow
entering
the
node.
For
example,
consider
the
A
node
(H5).
SUMIF(From,
Nodes,
Flow)
in
I5
sums
each
individual
entry
in
Flow
(the
changing
cells
in
D5:D19)
if
that
entry
is
in
a
row
where
the
entry
in
From
(B5:B19)
is
the
same
as
in
the
entry
in
that
row
of
Nodes
(i.e.,
A).
Since
the
only
rows
that
have
A
in
From
(B5:B19)
are
rows
5
and
6,
the
sum
in
the
ship
column
is
only
over
these
same
rows,
so
this
sum
is
D5+D6.
B C D E F G H I J K
3 thousands of gallons / hour thousands of gallons / hour
4 From To Flow Capacity Nodes Net Flow Supply/Demand
5 A B 0 <= 20 A 0
6 A C 0 <= 20 B 0 = 0
7 B C 0 <= 2 C 0 = 0
8 B D 0 <= 15 D 0 = 0
9 B F 0 <= 12 E 0 = 0
10 C B 0 <= 2 F 0 = 0
11 C E 0 <= 23 G 0
12 C F 0 <= 8
13 D F 0 <= 6
14 D G 0 <= 14
15 E F 0 <= 15
16 E G 0 <= 16
17 F D 0 <= 6
18 F E 0 <= 15
19 F G 0 <= 4
I
4 Net Flow
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7
The
goal
is
to
maximize
the
amount
shipped
from
A
to
G.
Since
nodes
B
through
F
are
transshipment
nodes
(net
flow
=
0),
any
amount
that
leaves
A
must
enter
G.
Thus,
maximizing
the
flow
out
of
A
will
achieve
our
goal.
Thus,
the
formula
entered
into
the
objective
cell
MaximumFlow
(D21)
is
=I5.
B C D E F G H I J K
3 thousands of gallons / hour thousands of gallons / hour
4 From To Flow Capacity Nodes Net Flow Supply/Demand
5 A B 0 <= 20 A 0
6 A C 0 <= 20 B 0 = 0
7 B C 0 <= 2 C 0 = 0
8 B D 0 <= 15 D 0 = 0
9 B F 0 <= 12 E 0 = 0
10 C B 0 <= 2 F 0 = 0
11 C E 0 <= 23 G 0
12 C F 0 <= 8
13 D F 0 <= 6
14 D G 0 <= 14
15 E F 0 <= 15
16 E G 0 <= 16
17 F D 0 <= 6
18 F E 0 <= 15
19 F G 0 <= 4
20
21 Maximum Flow 0
C D
21 Maximum Flow =I5
8
The
Solver
information
and
solved
spreadsheet
are
shown
below.
B C D E F G H I J K
3 thousands of gallons / hour thousands of gallons / hour
4 From To Flow Capacity Nodes Net Flow Supply/Demand
5 A B 20 <= 20 A 34
6 A C 14 <= 20 B 0 = 0
7 B C 0 <= 2 C 0 = 0
8 B D 14 <= 15 D 0 = 0
9 B F 8 <= 12 E 0 = 0
10 C B 2 <= 2 F 0 = 0
11 C E 12 <= 23 G -34
12 C F 0 <= 8
13 D F 0 <= 6
14 D G 14 <= 14
15 E F 0 <= 15
16 E G 16 <= 16
17 F D 0 <= 6
18 F E 4 <= 15
19 F G 4 <= 4
20
21 Maximum Flow 34
Solver Parameters
Set Objective Cell: MaximumFlow
To: Max Range Name Cells
By Changing Variable Cells: Capacity F5:F19
Flow Flow D5:D19
Subject to the Constraints: From B5:B19
Flow <= Capacity MaximumFlow D21
NetFlow = SupplyDemand NetFlow I6:I10
Solver Options: Nodes H5:H11
Make Variables Nonnegative SupplyDemand K6:K10
Solving Method: Simplex LP To C5:C19
I
4 Net Flow
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow) C D
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
21 Maximum Flow =I5
Thus,
Flow
(D5:D19)
indicates
how
to
send
oil
through
the
network
so
as
to
achieve
the
Maximum
Flow
(D21)
of
34
thousand
gallons/hour.
9
6.S3 Driving to the Mile-High City
Sarah
and
Jennifer
have
just
graduated
from
college
at
the
University
of
Washington
in
Seattle
and
want
to
go
on
a
road
trip.
They
have
always
wanted
to
see
the
mile-‐high
city
of
Denver.
Their
road
atlas
shows
the
driving
time
(in
hours)
between
various
city
pairs,
as
shown
below.
Formulate
and
solve
a
network
optimization
model
to
find
the
quickest
route
from
Seattle
to
Denver?
Seattle
Butte
Billings
10
3 4
9 7
Portland 7 7
Boise 12 7
6 14
Cheyenne
7
Salt Lake 1
5
City
4
Grand Denver
Junction
This
is
a
shortest
path
problem.
To
set
up
a
spreadsheet
model,
first
list
all
of
the
arcs
as
shown
in
B4:C11,
along
with
their
capacity
(F4).
Only
the
arc
from
F1
to
WH1
is
capacitated.
Then
list
all
of
the
nodes
as
shown
in
I4:I11
along
with
each
node’s
supply
or
demand
(L4:L11).
B C D E F G H I J K L
3 From To Capacity Unit Cost Nodes Supply/Demand
4 F1 WH1 250 $40 F1 400
5 F1 WH2 $35 F2 250
6 F2 WH2 $25 WH1 0
7 WH1 WS1 $60 WH2 0
8 WH1 WS2 $35 WS1 -200
9 WH2 WS2 $55 WS2 -100
10 WH2 WS3 $50 WS3 -150
11 WH2 WS4 $65 WS4 -200
The
changing
cells
are
the
amount
of
flow
to
send
through
each
arc.
These
are
shown
in
Flow
(D4:D11)
below,
with
an
arbitrary
value
of
10
entered
for
each.
The
flow
through
the
arc
from
F1
to
WH1
must
be
less
than
the
capacity
of
250,
as
indicated
by
the
constraint
D4
<=
F4.
10
B C D E F G
3 From To Flow Capacity Unit Cost
4 F1 WH1 10 <= 250 $40
5 F1 WH2 10 $35
6 F2 WH2 10 $25
7 WH1 WS1 10 $60
8 WH1 WS2 10 $35
9 WH2 WS2 10 $55
10 WH2 WS3 10 $50
11 WH2 WS4 10 $65
For
each
node,
calculate
the
net
flow
as
a
function
of
the
changing
cells.
This
can
be
done
using
the
SUMIF
function.
In
each
case,
the
first
SUMIF
function
calculates
the
flow
leaving
the
node
and
the
second
one
calculates
the
flow
entering
the
node.
For
example,
consider
the
F1
node
(I4).
SUMIF(From,
I4,
Flow)
sums
each
individual
entry
in
Flow
(the
changing
cells
in
D4:D11)
if
that
entry
is
in
a
row
where
the
entry
in
From
(B4:B11)
is
the
same
as
in
I4
(i.e.,
F1).
Since
I4
=
F1
and
the
only
rows
that
have
F1
in
From
(B4:B11)
are
rows
4
and
5,
the
sum
in
the
ship
column
is
only
over
these
same
rows,
so
this
sum
is
D4+D5.
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 10 <= 250 $40 F1 20 = 400
5 F1 WH2 10 $35 F2 10 = 250
6 F2 WH2 10 $25 WH1 10 = 0
7 WH1 WS1 10 $60 WH2 10 = 0
8 WH1 WS2 10 $35 WS1 -10 = -200
9 WH2 WS2 10 $55 WS2 -20 = -100
10 WH2 WS3 10 $50 WS3 -10 = -150
11 WH2 WS4 10 $65 WS4 -10 = -200
J
3 Net Flow
4 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11
The
goal
is
to
minimize
the
total
cost
of
shipping
the
product
from
the
factories
to
the
wholesalers.
The
cost
is
the
SUMPRODUCT
of
the
Unit
Costs
with
the
Flow,
or
Total
Cost
=
SUMPRODUCT(UnitCost,
Flow).
This
formula
is
entered
into
TotalCost
(D13).
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 10 <= 250 $40 F1 20 = 400
5 F1 WH2 10 $35 F2 10 = 250
6 F2 WH2 10 $25 WH1 10 = 0
7 WH1 WS1 10 $60 WH2 10 = 0
8 WH1 WS2 10 $35 WS1 -10 = -200
9 WH2 WS2 10 $55 WS2 -20 = -100
10 WH2 WS3 10 $50 WS3 -10 = -150
11 WH2 WS4 10 $65 WS4 -10 = -200
12
13 Total Cost $3,650
C D
13 Total Cost =SUMPRODUCT(UnitCost,Flow)
12
The
Solver
information
and
solved
spreadsheet
are
shown
below.
B C D E F G H I J K L
3 From To Flow Capacity Unit Cost Nodes Net Flow Supply/Demand
4 F1 WH1 250 <= 250 $40 F1 400 = 400
5 F1 WH2 150 $35 F2 250 = 250
6 F2 WH2 250 $25 WH1 0 = 0
7 WH1 WS1 200 $60 WH2 0 = 0
8 WH1 WS2 50 $35 WS1 -200 = -200
9 WH2 WS2 50 $55 WS2 -100 = -100
10 WH2 WS3 150 $50 WS3 -150 = -150
11 WH2 WS4 200 $65 WS4 -200 = -200
12
13 Total Cost $58,500
Solver Parameters
Set Objective Cell: Total Cost Range Name Cells
To: Min Capacity F4
By Changing Variable Cells: Flow D4:D11
Flow From B4:B11
Subject to the Constraints: NetFlow J4:J11
D4 <= Capacity Nodes I4:I11
NetFlow = SupplyDemand SupplyDemand L4:L11
Solver Options: To C4:C11
Make Variables Nonnegative TotalCost D13
Solving Method: Simplex LP
UnitCost G4:G11
J
3 Net Flow
4 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
5 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
6 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
7 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
8 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
9 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
10 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
11 =SUMIF(From,Nodes,Flow)-SUMIF(To,Nodes,Flow)
C D
13 Total Cost =SUMPRODUCT(UnitCost,Flow)
Thus,
Flow
(D4:D11)
indicates
how
to
distribute
the
product
so
as
to
achieve
the
minimum
Total
Cost
(D13)
of
$58,500.
13