0% found this document useful (0 votes)
196 views4 pages

Algorithms

The document describes a problem involving switching data streams between input and output wires that meet at junction boxes. Each input wire carries a distinct data stream that must be switched to a different output wire, without any two streams passing through the same junction box. The problem is to find a valid switching that meets these criteria, for any pattern in which the wires meet. The response proposes using a modified Gale-Shapley algorithm to find a stable matching, where the input preferences are the nearest outputs first and output preferences are the farthest inputs first, to avoid conflicts at junction boxes.

Uploaded by

Leo Urbina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
196 views4 pages

Algorithms

The document describes a problem involving switching data streams between input and output wires that meet at junction boxes. Each input wire carries a distinct data stream that must be switched to a different output wire, without any two streams passing through the same junction box. The problem is to find a valid switching that meets these criteria, for any pattern in which the wires meet. The response proposes using a modified Gale-Shapley algorithm to find a stable matching, where the input preferences are the nearest outputs first and output preferences are the farthest inputs first, to avoid conflicts at junction boxes.

Uploaded by

Leo Urbina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Alumno: Leopoldo Urbina Marquez

Problem

Decide whether you think the following statement is true or false. If it is true, give a
short explanation. If it is false, give a counterexample.
True or false? In every instance of the Stable Matching Problem, there is a stable matching containing a pair (m, w) such that m is ranked rst on the preference list of w and w is ranked rst on
the preference list of m.

False

Pf. We have the next preferences.


Men
Albert
Baird
Caesar

1
Zelda
Ximena
Zelda

2
Ximena
Yalena
Yalena

(a) Men's preferences

3
Yalena
Zelda
Ximena

1
Baird
Albert
Caesar

Ximena
Yalena
Zelda

2
Caesar
Caesar
Albert

3
Albert
Baird
Baird

(b) Women's preferences

Table 1: Preferences
If we want to make the matching with the rst member of the preference list of each Woman, we
dont have any problem (in this case), but It won't be a stable matching, because Albert and Caesar
aren't happy with their partners.
Ximena - Baird
Yalena - Albert
Zelda - Caesar
(a) Matching w*

Caesar - Zelda
Baird - Ximena
Albert - Yalena
(b)

Stable

Matching

S*

Table 2: Matching

Problem

Decide whether you think the following statement is true or false. If it is true, give a
short explanation. If it is false, give a counterexample.
True or false? Consider an instance of the Stable Matching Problem in which there exists a man
m and a woman w such that m is ranked rst on the preference list of w and w is ranked rst on the
preference list of m. Then in every stable matching S for this instance, the pair (m, w) belongs to S.

True

Pf. Given the list of Preferences in Table 1, we could build a Stable Matching Table 2b In this
Perfect Matching we could realize that Ximena prefers Baird before all the men, and Baird prefers
Ximena before all women, They are no way that this pair wasn't in S*

Problem

Gale and Shapley published their paper on the Stable Matching Problem in 1962; but a
version of their algorithm had already been in use for ten years by the National Resident
Matching Program, for the problem of assigning medical residents to hospitals.
Basically, the situation was the following. There were m hospitals, each with a certain number of available positions for hiring residents. There were n medical students
graduating in a given year, each interested in joining one of the hospitals. Each hospital
had a ranking of the students in order of preference, and each student had a ranking
of the hospitals in order of preference. We will assume that there were more students
graduating than there were slots available in the m hospitals.
The interest, naturally, was in nding a way of assigning each student to at most one
hospital, in such a way that all available positions in all hospitals were lled. (Since we
are assuming a surplus of students, there would be some students who do not get assigned
to any hospital.)
We say that an assignment of students to hospitals is stable if neither of the following
situations arises.
First type of instability: There are students





s' , and a hospital h , so that

s is assigned to h , and
s' is assigned to no hospital, and
h prefers s' to s .

Second type of instability: There are students

that





and

and

s' , and hospitals h

and

h' , so

s is assigned to h , and
s' is assigned to h' , and
h prefers s' to s , and
s' prefers h to h' .

So we basically have the Stable Matching Problem, except that (i) hospitals generally
want more than one resident, and (ii) there is a surplus of medical students. Show that
there is always a stable assignment of students to hospitals, and give an algorithm to nd
one.

In instance, we have some dierence between Gale-Shapley and this Stable Matching Problem, rst
one, an hospital could receive more than one students, second one, a student can not have any hospital
for practice. We could edit the Gale-Shapley Algorithm for this new dierence:
While t h e r e i s a student n who i s f r e e and hasn ' t proposed to every h o s p i t a l
Choose such a student n
Let m be the h i g h e s t ranked h o s p i t a l i n the p r e f e r e n c e l i s t o f n
to whom n has not yet proposed
If
m has vacancy then
m accepts n
E l s e m hasn ' t vacancy
If
m p r e f e r s a l l t h e i r s t u d e n t s b e f o r e n then
n remains f r e e
Else m p r e f e r s n before a l l t h e i r students
m a c c e p t s n and r e j e c t s the l a s t student that p r e f e r
Endif
Endif
Endwhile
2

Given this list of Preferences Table 3, we could use our new Algorithm to obtain a list of stable
matching.
1
Mayo Clinic
Johns Hopkins Hospital
Johns Hopkins Hospital
Cleveland Clinic
Johns Hopkins Hospital
Mayo Clinic
Cleveland Clinic
Mayo Clinic

Andy
Baird
Caesar
Duran
Eva
Fabian
Gloria
Hilary

2
Cleveland Clinic
Mayo Clinic
Cleveland Clinic
Johns Hopkins Hospital
Mayo Clinic
Cleveland Clinic
Mayo Clinic
Cleveland Clinic

3
Johns Hopkins Hospital
Cleveland Clinic
Mayo Clinic
Mayo Clinic
Cleveland Clinic
Johns Hopkins Hospital
Johns Hopkins Hospital
Johns Hopkins Hospital

(a) Residents' preferences

Mayo Clinic
Cleveland Clinic
Johns Hopkins Hospital

Vacancy
1
2
2

1
Caesar
Gloria
Eva

2
Andy
Hilary
Gloria

3
Fabian
Andy
Baird

4
Eva
Duran
Duran

5
Hilary
Baird
Fabian

6
Baird
Eva
Caesar

7
Gloria
Caesar
Andy

(b) Hospitals' preferences

Table 3: Preferences of hospitals and residents

Mayo Clinic
Cleveland Clinic
Johns Hopkins Hospital
No Hospital

Caesar
Gloria
Eva
Andy

Residents
Hilary
Baird
Duran

Fabian

Table 4: Stable Matching


Then we need to prove that there aren't any instability in this Stable Matching.
First type of instability: There are students





and

s' , and a hospital h , so that

s is assigned to h , and
s' is assigned to no hospital, and
h prefers s' to s .

This instability cant be possible cause, for what s' has no Hospital, he had to propose to all the
hospitals and It seems that he appeared at the last of the preferences lists.
Second type of instability: There are students

that





and

s' , and hospitals h

s is assigned to h , and
s' is assigned to h' , and
h prefers s' to s , and
s' prefers h to h' .

If s' was assigned to h', It shows that s' prefers h' before h, It isn't possible.

and

h' , so

8
Duran
Fabian
Hilary

Problem

Some of your friends are working for CluNet, a builder of large communication networks,
and they are looking at algorithms for switching in a particular type of input/output
crossbar.
Here is the setup. There are n input wires and n output wires, each directed from
a source to a terminus . Each input wire meets each output wire in exactly one distinct
point, at a special piece of hardware called a junction box . Points on the wire are naturally
ordered in the direction from source to terminus; for two distinct points x and y on the
same wire, we say that x is upstream from y if x is closer to the source than y , and
otherwise we say x is downstream from y . The order in which one input wire meets the
output wires is not necessarily the same as the order in which another input wire meets
the output wires. (And similarly for the orders in which output wires meet input wires.)
Now, here's the switching component of this situation. Each input wire is carrying
a distinct data stream, and this data stream must be switched onto one of the output
wires. If the stream of Input i is switched onto Output j , at junction box B , then this
stream passes through all junction boxes upstream from B on Input i , then through B ,
then through all junction boxes downstream from B on Output j . It does not matter
which input data stream gets switched onto which output wire, but each input data
stream must be switched onto a dierent output wire. Furthermoreand this is the
tricky constraintno two data streams can pass through the same junction box following
the switching operation.
Finally, here's the problem. Show that for any specied pattern in which the input
wires and output wires meet each other (each pair meeting exactly once), a valid switching
of the data streams can always be foundone in which each input data stream is switched
onto a dierent output, and no two of the resulting streams pass through the same
junction box. Additionally, give an algorithm to nd such a valid switching.

We use Gale Shapley algorithm, for nd the stable matching, but we have to manipulate the list
of preference, in case of the input, they prefere the nearest outups than the others, and in the case of
the outputs, they prefere the farthest inputs than the others.

You might also like