04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24<br />

Chapter 1 Introduction: Some Representative Problems<br />

The interest, naturally, was in finding a way of assigning each student<br />

to at most one hospital, in such a way that all available positions in all<br />

hospitals were filled. (Since we are assuming a surplus of students, there<br />

would be some students who do not get assigned to any hospital.)<br />

We say that an assignment of students to hospitals is stable ff neither<br />

of the following situations arises.<br />

¯ First type of instability: There are students s and s’, and a hospital h,<br />

so that<br />

- s is assigned to h, and<br />

- s’ is assigned to no hospital, and<br />

- h prefers s’ to s.<br />

° Second type of instability: There are students s and s ~, and hospitals<br />

t~ and h’, so that<br />

- s is assigned to h, and<br />

s’ is assigned to tff, and<br />

- t~ prefers s’ to s, and<br />

- s’ prefers tt to h’.<br />

So we basically have the Stable Matching Problem, except that (i)<br />

hospitals generally want more than one resident, and (ii) there is a surplus<br />

of medical students.<br />

Show that there is always a stable assignment of students to hospitals,<br />

and give an algorithm to find one.<br />

The Stable Matching Problem, as discussed in the text, assumes that all<br />

men and women have a fully ordered list of preferences. In this problem<br />

we will consider a version of the problem in which men and women can be<br />

indifferent between certain options. As before we have a set M of n men<br />

and a set W of n women. Assume each man and each woman ranks the<br />

members of the opposite gender, but now we allow ties in the ranking.<br />

For example (with n = 4), a woman could say that ml is ranked in first<br />

place; second place is a tie between mz and m3 (she has no preference<br />

between them); and m4 is in last place. We will say that tv prefers m to m’<br />

if m is ranked higher than m’ on her preference list (they are not tied).<br />

With indifferences in the ranldngs, there could be two natural notions<br />

for stability. And for each, we can ask about the existence of stable<br />

matchings, as follows.<br />

(a) A strong instability in a perfect matching S consists of a man m and<br />

a woman tv, such that each of m and tv prefers the other to their<br />

partner in S. Does there always exist a perfect matching with no<br />

(b)<br />

Exercises<br />

strong instability? Either give an example of a set of men and women<br />

with preference lists for which every perfect matching has a strong<br />

instability; or give an algorithm that is guaranteed to find a perfect<br />

matching with no strong instability.<br />

A weak instability in a perfect matching S consists of a man m and<br />

a woman tv, such that their partners in S are tv’ and m’, respectively,<br />

and one of the following holds:<br />

- m prefers u~ to ui, and tv either prefers m to m’ or is indifferent<br />

be~veen these two choices; or<br />

u~ prefers m to m’, and m either prefers u~ to u3’ or is indifferent<br />

between these two choices.<br />

In other words, the pairing between m and tv is either preferred<br />

by both, or preferred by one while the other is indifferent. Does<br />

there always exist a perfect matching with no weak instability? Either<br />

give an example of a set of men and women with preference lists<br />

for which every perfect matching has a weak instability; or give an<br />

algorithm that is guaranteed to find a perfect matching with no weak<br />

instability.<br />

6. Peripatetic Shipping Lines, inc., is a shipping company that owns n ships<br />

and provides service to n ports. Each of its ships has a schedule that says,<br />

for each day of the month, which of the ports it’s currently visiting, or<br />

whether it’s out at sea. (You can assume the "month" here has m days,<br />

for some m > n.) Each ship visits each port for exactly one day during the<br />

month. For safety reasons, PSL Inc. has the following strict requirement:<br />

(t) No two ships can be in the same port on the same day.<br />

The company wants to perform maintenance on all the ships this<br />

month, via the following scheme. They want to truncate each ship’s<br />

schedule: for each ship Sg, there will be some day when it arrives in its<br />

scheduled port and simply remains there for the rest of the month (for<br />

maintenance). This means that S~ will not visit the remaining ports on<br />

its schedule (if any) that month, but this is okay. So the truncation of<br />

S~’s schedule will simply consist of its original schedule up to a certain<br />

specified day on which it is in a port P; the remainder of the truncated<br />

schedule simply has it remain in port P.<br />

Now the company’s question to you is the following: Given the schedule<br />

for each ship, find a truncation of each so that condition (t) continues<br />

to hold: no two ships are ever in the same port on the same day.<br />

Show that such a set of truncations can always be found, and give an<br />

algorithm to find them.<br />

25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!