Algorithms for Student-Project Allocation

Slides:



Advertisements
Similar presentations
Strong Stability in the Hospitals/Residents Problem Robert W. Irving, David F. Manlove and Sandy Scott University of Glasgow Department of Computing Science.
Advertisements

1 Approximability Results for Induced Matchings in Graphs David Manlove University of Glasgow Joint work with Billy Duckworth Michele Zito Macquarie University.
Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science.
1 Student-Project Allocation with Preferences over Projects David Manlove Gregg OMalley University of Glasgow Department of Computing Science Supported.
1 Student-Project Allocation with Preferences over Projects David Manlove University of Glasgow Department of Computing Science Joint work with Gregg OMalley.
Strong Stability in the Hospitals/Residents Problem
Covers, Dominations, Independent Sets and Matchings AmirHossein Bayegan Amirkabir University of Technology.
Minimum Clique Partition Problem with Constrained Weight for Interval Graphs Jianping Li Department of Mathematics Yunnan University Jointed by M.X. Chen.
Greed is good. (Some of the time)
Joint work with Rob Irving
Algorithms and Networks
Combinatorial Algorithms
CSE 421 Algorithms Richard Anderson Lecture 23 Network Flow Applications.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
The Maximum Network Flow Problem. CSE Network Flows.
Lectures on Network Flows
Introduction to Approximation Algorithms Lecture 12: Mar 1.
HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Popular Matching David Abraham Carnegie Mellon University Kavitha Telikepalli Max-Planck-Institut für Informatik Kurt Mehlhorn Rob Irving University of.
1 Combinatorial Dominance Analysis Keywords: Combinatorial Optimization (CO) Approximation Algorithms (AA) Approximation Ratio (a.r) Combinatorial Dominance.
1 Introduction to Approximation Algorithms Lecture 15: Mar 5.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Strong Stability in the Hospitals/Residents Problem Robert W. Irving, David F. Manlove and Sandy Scott University of Glasgow Department of Computing Science.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Homework 2. Problem 1 Families 1…..N go out for dinner together. To increase their social interaction, no two members of the same family use the same.
L3 #1 The Hospitals / Residents Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science Supported by EPSRC grant.
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
Chapter 15 Approximation Algorithm Introduction Basic Definition Difference Bounds Relative Performance Bounds Polynomial approximation Schemes Fully Polynomial.
 Rooted tree and binary tree  Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
Bipartite Matching. Unweighted Bipartite Matching.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Assignments and matchings Chapter 12 Presented by Yorai Geffen.
Network Flows Chun-Ta, Yu Graduate Institute Information Management Dept. National Taiwan University.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
1 “Almost stable” matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of.
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
Complexity and Efficient Algorithms Group / Department of Computer Science Testing the Cluster Structure of Graphs Christian Sohler joint work with Artur.
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
C&O 355 Lecture 19 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A A A A.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Chapter 10 Iterative Improvement
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Maximum Flow Chapter 26.
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Algorithms and Networks
Maximum Flow - Best algorithms
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
3.3 Applications of Maximum Flow and Minimum Cut
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Analysis of Algorithms
“Almost stable” matchings in the Roommates problem
3.5 Minimum Cuts in Undirected Graphs
Richard Anderson Autumn 2006 Lecture 1
Popularity in the Capacitated House Allocation Problem
Rank Maximal Matching By Robert W. Irving, Telikepalli Kavitha,
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
A Grand Tour of Stable Matching Problems
Lecture 22 Network Flow, Part 2
Presentation transcript:

Algorithms for Student-Project Allocation David Manlove University of Glasgow Department of Computing Science Joint work with David Abraham and Rob Irving Supported by EPSRC grant GR/R84597/01, Nuffield Foundation award NUF-NAL-02, and RSE / SEETLLD Personal Research Fellowship

Background Students may undertake project work during degree course Set of students, projects and lecturers Typically a wide range of projects – exceeding number of students Students may rank projects in preference order Lecturers may rank students in preference order Projects / lecturers may have capacities

Efficient algorithms Growing interest in automating the allocation process Efficient algorithms are important Can identify a family of matching problems Range of optimisation criteria possible Cases considered: Preferences Capacities Case Students Lecturers Projects 1   2 3 4

Case 1: formal definition No explicit preferences; project capacities only Set of students S={s1, s2, …, sn} Set of projects P={p1, p2, …, pm} Set of lecturers L={l1, l2, …, lq} Each lecturer lk offers a set of projects Pk  P assume that P1, P2, …, Pq partitions P Each project pj has a capacity cj Each student si finds acceptable a set of projects Ai  P

Definition of a matching An assignment M is a subset of S×P If (si, pj)M , where lk offers pj , we say that si is assigned to pj si is assigned to lk pj is assigned si lk is assigned si A matching M is an assignment such that: if si is assigned to pj in M then si finds pj acceptable si is assigned to at most one project in M pj is assigned at most cj students in M

Case 1: example Set of students, projects and lecturers: S={s1, s2, s3, s4, s5}, P={p1, p2, p3, p4, p5}, L={l1, l2, l3} Lecturers offer projects as follows: P1={p1, p2}, P2={p3}, P3={p4, p5} Project capacities: c1= c2 = c4 = c5 = 1, c3 =2 Students find projects acceptable as follows: A1={p1, p3} A2={p1 , p4} A3={p2, p4} A4={p1, p2, p4} A5={p2, p4}

Corresponding bipartite graph capacity s1 p1 1 s2 p2 1 s3 p3 2 s4 p4 1 s5 p5 1

A matching capacity A set of edges M is a matching in G if: 1 s2 p2 1 s3 p3 2 s4 p4 1 s5 p5 1 A set of edges M is a matching in G if: each student si is incident to at most one edge of M each project pj is incident to at most cj edges of M

A maximum matching capacity Degree-constrained subgraph problem: 1 s2 p2 1 s3 p3 2 s4 p4 1 s5 p5 1 Degree-constrained subgraph problem: A maximum matching may be found in time O where L is the number of edges (Gabow, 1983)

Case 2: student preferences Assume that each student si has a strictly-ordered ranking list Ri over Ai Project capacities only Let r denote the maximum length of any student’s preference list Define the signature of a matching M to be an r-tuple x1, x2, …, xr where xi denotes the number of students assigned in M to their ith-choice project A matching M is greedy if M has maximum signature (with respect to lexicographic order) i.e. the maximum number of students obtain their first-choice project, and subject to this condition, the maximum number of students obtain their second-choice project, etc.

Case 2: example Set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p1 p3 s3 : p2 p3 Matching M1={(s1, p1) (s2, p3) (s3, p2)}, signature 2, 0, 1 Matching M2={(s1, p1) (s2, p2) (s3, p3)}, signature 2, 1, 0 M2 is greedy

Case 2: example Set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p1 p3 s3 : p2 p3 Matching M1={(s1, p1), (s2, p3), (s3, p2)}, signature 2, 0, 1 Matching M2={(s1, p1) (s2, p2) (s3, p3)}, signature 2, 1, 0 M2 is greedy

Case 2: example Set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p1 p3 s3 : p2 p3 Matching M1={(s1, p1), (s2, p3), (s3, p2)}, signature 2, 0, 1 Matching M2={(s1, p1), (s2, p2), (s3, p3)}, signature 2, 1, 0 M2 is greedy

Finding a greedy matching Traditional method: transform to instance of assignment problem Create weighted bipartite graph G=(V, E) with V=SP and E={(si, pj) : pjAi} For any student si and project pj Ai, define ranki(pj)=k, where pj is the kth-choice project of si Weight of edge (si, pj) is nr-k where k=ranki(pj) Compute a maximum weight matching in G Complexity of algorithm: O(rn(L+nlog n)) (Fredman and Tarjan, 1987) Two problems: Arithmetic operations involving edge weights O(r) Possible implementation difficulties

A direct algorithm Combinatorial algorithm: O(min(n+R, Rn)m) where R is the largest rank used in a greedy matching (Irving, Kavitha, Mehlhorn, Michail and Paluch, “Rank-Maximal Matchings”, Proc. SODA 2004) Algorithm can be generalised to deal with arbitrary project capacities

Greedy matchings vs maximum matchings Greedy matchings need not be maximum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 p3 s2 : p2 s3 : p2 p1

Greedy matchings vs maximum matchings Greedy matchings need not be maximum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 p3 s2 : p2 s3 : p2 p1 Two greedy matchings: M1={(s1, p1), (s2, p2)}, signature 2, 0 M2={(s1, p1), (s3, p2)}, signature 2, 0

Greedy matchings vs maximum matchings Greedy matchings need not be maximum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3}, P={p1, p2, p3}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 p3 s2 : p2 s3 : p2 p1 Two greedy matchings: M1={(s1, p1), (s2, p2)}, signature 2, 0 M2={(s1, p1), (s3, p2)}, signature 2, 0 Maximum matching M3={(s1, p3), (s2, p2), (s3, p1)}, signature 1, 2

Greedy maximum matchings and rank-minimum matchings Define a greedy maximum matching to be a matching with maximum signature, taken over all maximum (cardinality) matchings The existence of a direct (combinatorial) algorithm for finding a greedy maximum matching remains open Greedy matchings could leave some people very badly off Alternative notion of optimality: define the cost of a matching M to be: cost(M)={ranki(pj) : (si, pj)M} Define a rank-minimum matching to be a matching with minimum cost, taken over all maximum matchings

Greedy matchings vs rank-minimum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3,, s4, s5}, P={p1, p2, p3, p4, p5}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p5 s3 : p3 s4 : p4 s5 : p1 p2 p3 p4 p5 Greedy matching: M1={(s1, p1), (s2, p2), (s3, p3), (s4, p4), (s5, p5)}, signature 4, 0, 0, 0, 1, cost 9 Rank-minimum matching M2={(s1, p1), (s2, p5), (s3, p3), (s4, p4), (s5, p2)}, signature 3, 2, 0, 0, 0, cost 7

Greedy matchings vs rank-minimum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3,, s4, s5}, P={p1, p2, p3, p4, p5}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p5 s3 : p3 s4 : p4 s5 : p1 p2 p3 p4 p5 Greedy matching: M1={(s1, p1), (s2, p2), (s3, p3), (s4, p4), (s5, p5)}, signature 4, 0, 0, 0, 1, cost 9 Rank-minimum matching M2={(s1, p1), (s2, p5), (s3, p3), (s4, p4), (s5, p2)}, signature 3, 2, 0, 0, 0, cost 7

Greedy matchings vs rank-minimum matchings E.g. set of students, projects and lecturers: S={s1, s2, s3,, s4, s5}, P={p1, p2, p3, p4, p5}, L={l1} Project capacities are all 1 Student preference lists: s1 : p1 s2 : p2 p5 s3 : p3 s4 : p4 s5 : p1 p2 p3 p4 p5 Greedy matching: M1={(s1, p1), (s2, p2), (s3, p3), (s4, p4), (s5, p5)}, signature 4, 0, 0, 0, 1, cost 9 Rank-minimum matching M2={(s1, p1), (s2, p5), (s3, p3), (s4, p4), (s5, p2)}, signature 3, 2, 0, 0, 0, cost 7

Case 3: lecturer capacities Assume that each lecturer lk has a capacity dk Assume that each student si ranks Ai as before Projects have capacities as before A matching M is an assignment such that: if si is assigned to pj in M then si finds pj acceptable si is assigned to at most one project in M pj is assigned at most cj students in M lk is assigned at most dk students in M An optimal solution is a rank-minimum matching

Finding a rank-minimum matching (1) Define a weighted network N as follows: Vertices are V={s}SPL{t} (s is source and t is sink) Add an edge (s, si) of capacity 1 for each si Add an edge (si, pj) of capacity 1 for each si and pj Ai Add an edge (pj, lk) of capacity cj for each lk and pj Pk Add an edge (lk, t) of capacity dk for each lk Edge (si, pj) has cost ranki(pj) All other edges have cost 0

Finding a rank-minimum matching (2) The cost of a flow f is cost(f)={cost(e)f(e) : eE} Find a min cost-max flow f in N Using f, create an assignment M as follows: For each si and pj , if f(si, pj)=1 add (si, pj ) to M M is a rank-minimum matching Complexity of algorithm: O(e(e+vlog v)log B/(m+n)) where v is number of vertices, e is number of edges and B is sum of edge capacities in N (Goldfarb and Jin, 1999)

Case 3: example Set of students, projects and lecturers: S={s1, …, s5}, P={p1, …, p7}, L={l1, l2, l3} Lecturers offer projects as follows: P1={p1, p2}, P2={p3, p4}, P3={p5, p6, p7} Project capacities: p5 has capacity 2; all others have capacity 1 Lecturer capacities: d1=2, d2=1, d3=2 Student preference lists: s1 : p1 p3 p5 s2 : p1 p4 p6 s3 : p4 p1 p5 s4 : p1 p6 p7 s5 : p5 p3 p2

Example network N Edge costs in green Edge capacities in red p1 1 1 s1 2 s 1 1 1 t s3 p4 l2 1 2 2 1 s4 p5 l3 1 2 3 s5 p6 1 All these edges have capacity 1 p7

Min cost-max flow f in N cost(f)=10 p1 s1 p2 s2 p3 l1 2 s 1 t s3 p4 l2 Blue edges have flow >0 - flow is 1 unless stated otherwise cost(f)=10 p7

Case 4: student and lecturer preferences Assume that each student si has a strictly-ordered ranking list Ri over Ai For each lecturer lk , let Bk denote the set of students who find acceptable a project offered by lk lk has a strictly-ordered ranking list over Bk A solution is a stable matching A matching M is stable if it admits no blocking pair Formal definition to follow For any student si matched in M, M(si) denotes the project that si is assigned to For any project pj, M(pj) denotes the set of students assigned to pj For any lecturer lk, M(lk) denotes the set of students assigned to lk

Definition of a blocking pair (si, pj)M is a blocking pair of M if: pj  Ai Either si is unmatched in M, or si prefers pj to M(si) Either pj is under-subscribed and lk is under-subscribed pj is under-subscribed and lk is full, and either siM(lk) or lk prefers si to the worst student in M(lk) pj is full and lk prefers si to the worst student in M(pj) where lk is the lecturer who offers pj Given this preference and capacity information, the problem of finding a stable matching is called the Student-Project Allocation Problem (SPA)

Example SPA instance Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1

SPA instance: blocking pair Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p6 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 p7 p8 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 (s1, p1) forms a blocking pair: s1 prefers p1 to M(s1)=p7 p1 is under-subscribed and l1 is under-subscribed

SPA instance: blocking pair Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p6 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 p7 p8 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 (s6, p5) forms a blocking pair: s6 prefers p5 to M(s6)=p6 p5 is under-subscribed and s6 is assigned to a project offered by l2

SPA instance: blocking pair Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p3 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 p7 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 (s1, p1) forms a blocking pair: s1 prefers p1 to M(s1)=p7 p1 is under-subscribed and l1 is full and l1 prefers s1 to the worst student assigned to l1

SPA instance: blocking pair Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p3 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 p7 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 (s5, p3) forms a blocking pair: s5 is unmatched and finds p3 acceptable p3 is full and l1 prefers s5 to the worst student assigned to p3

SPA instance: stable matching Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 The matching is stable

Finding a stable matching Every instance of SPA admits at least one stable matching Previous stable matching was student-optimal Each student obtains the best project that he/she could obtain in any stable matching HR is a special case of SPA in which all lecturers have capacity  Linear-time algorithms for HR produce stable matchings that are student-optimal or lecturer-optimal (Gusfield and Irving, 1989) For SPA with arbitrary lecturer capacities, there are also linear-time algorithms giving student-optimal and lecturer-optimal stable matchings (Abraham, Irving, Manlove, “The Student-Project Allocation Problem”, Proc. ISAAC 2003, LNCS vol 2906)

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s1 applies to p1 p1 remains under-subscribed l1 remains under-subscribed

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s2 applies to p1 p1 becomes full; p1 deleted from list of s5 l1 remains under-subscribed 

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p1 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s3 applies to p2 p2 becomes full; p2 deleted from lists of s2, s5 and s6 l1 becomes full; p3 deleted from lists of s5 and s6      

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s4 applies to p2 p2 becomes over-subscribed; p2 rejects s3      

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s4 applies to p2 p2 becomes over-subscribed; p2 rejects s3 p2 becomes full; p2 deleted from list of s3 l1 remains full       

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s3 applies to p1 p1 becomes over-subscribed; p1 rejects s2       

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s3 applies to p1 p1 becomes over-subscribed; p1 rejects s2 p1 becomes full; p1 deleted from list of s2 l1 remains full; p3 deleted from list of s2         

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s2 applies to p4 p4 becomes full; p4 deleted from list of s5 and s6 l2 remains under-subscribed           

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p2 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s6 applies to p5 p5 becomes full; p5 deleted from list of s7 l2 becomes full            

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s7 applies to p3 l1 becomes over-subscribed; l1 rejects s3            

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s7 applies to p3 l1 becomes over-subscribed; l1 rejects s3 p3 becomes full l1 becomes full; p1 deleted from list of s3             

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s3 applies to p4 p4 becomes over-subscribed; p4 rejects s2             

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s3 applies to p4 p4 becomes over-subscribed; p4 rejects s2 p4 becomes full; p4 deleted from list of s2 l2 becomes full              

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s2 applies to p5 p5 becomes over-subscribed; p5 rejects s6              

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 s2 applies to p5 p5 becomes over-subscribed; p5 rejects s6 p5 becomes full; p5 deleted from list of s6 l2 becomes full; p6 deleted from list of s6                

Execution of the algorithm Student preferences Lecturer preferences s1 : p1 p7 l1 : s7 s4 s1 s3 s2 s5 s6 d1 = 3 s2 : p1 p2 p3 p4 p5 p6 p3 p2 p1 l1 offers p1, p2, p3 s3 : p2 p1 p4 s4 : p2 l2 : s3 s2 s6 s7 s5 d2 = 2 s5 : p1 p2 p3 p4 p4 p5 l2 offers p4, p5, p6 s6 : p2 p3 p4 p5 p6 s7 : p5 p3 p8 l3 : s1 s7 d3 = 2 l3 offers p7, p8 c1 = 2; all other projects have capacity 1 Algorithm terminates Matching is stable                

Pseudocode of algorithm (1) assign each student to be free ; assign each project and lecturer to be totally unsubscribed ; while (some student si is free and si has a nonempty list) { pj = first project on si’s list; lk = lecturer who offers pj ; /* si applies to pj */ provisionally assign si to pj ; /* and to lk */ if (pj is over-subscribed) { sr = worst student assigned to pj ; break provisional assignment between sr and pj ; } else if (lk is over-subscribed) { sr = worst student assigned to lk ; pt = project assigned sr ; break provisional assignment between sr and pt ;

Pseudocode of algorithm (2) if (pj is full) { sr = worst student assigned to pj ; for (each successor st of sr on lk’s list) delete pj from st’s list ; } if (lk is full) { sr = worst student assigned to lk ; for (each project pu  Pk ) delete pu from st’s list ; } /* while loop */

Theoretical results Algorithm produces student-optimal stable matching, given an instance of SPA Algorithm may be implemented to run in O(L) time, where L is total length of the students’ preference lists Second algorithm finds lecturer-optimal stable matching Same set of students are matched in all stable matchings Each lecturer obtains the same number of students in all stable matchings A project offered by an under-subscribed lecturer has the same number of students in all stable matchings

Open problems Extend to the case where lecturers have preferences over (student,project) pairs Ties in the preferences lists Lower bounds on projects Complexity of finding a greedy maximum matching