CO 370 Midterm Exam, Fall 2017
Page 1
Question 1
(20 points)
p
families go out to dinner together. Family
i
has
a
i
members, for all
i
= 1
, . . . , p
. There are
q
tables
available, and table
j
has
b
j
seating capacity, for each
j
= 1
, . . . , q
.
The families want to be seated so that no two members of the same family sit in the same table.
(a) (10 points) How can the families use max-flow to solve the problem of finding a seating arrangement
satisfying the above constraints (or show that it is not possible to have such a seating assignment)?
Clearly define your max-flow problem, what each variable will represent and how the max-flow
problem can be used to solve the above problem.
Solution:
Define one vertex
f
i
for every family
i
= 1
, . . . , p
. Define one vertex
t
j
for every family
j
=
1
, . . . , q
.
Define arcs (
f
i
, t
j
), for every
i
= 1
, . . . , p
,
j
= 1
, . . . , q
with capacity 1. Integer flows on these
arcs will represent the number of people from family
i
assigned to table
j
.
Also, add vertices
s, t
and arcs (
s, f
i
) with capacity
a
i
and (
t
j
, t
) with capacity
b
j
, for every
i
= 1
, . . . , p
,
j
= 1
, . . . , q
respectively.
Integer flows on arcs (
s, f
i
) will represent the number of people from family
i
that get a seat
at some table. Integer flows on arcs (
t
j
, t
) will represent the total number of people seated at
table
j
.
Since all data is integral, the solution to the max flow problem will also be integral, and
in addition at most one member of each family will seat at each table, thus satisfying the
requirement of no two members of the same family sitting at the same table. Note, in addition,
that the upper bound on arcs (
t
j
, t
) enforce that at most
b
j
people seat at table
j
.
Now the max flow out of
s
can be at most
p
∑
i
=1
a
i
, since these are the upper bounds on all the
arcs out of
s
.
If the value of the max flow is exactly equal to
p
∑
i
=1
a
i
, then that means that all members of all
families got seated satisfying the requirement.
Otherwise, there is no possible way to seat all
p
∑
i
=1
a
i
people while satisfying the requirements.
3pts : Graph
2pts : Capacities
3pts : Explanation of what flows represent
2pts: How to use max flow