東京大学 情報理工学系研究科 創造情報学専攻 2012年8月実施 筆記試験 第1問
Author
Description
Official examination, archived Japanese PDF. An English conversation school plans to make pairs of students and teachers for private lessons. Given a set of students and a set of teachers, we make disjoint pairs of a student and a teacher, which we call a -match. Answer the following questions:
(1) How many -matches exist?
(2) For , given a list of preferable teachers by students (Table 1) draw a graph , and show a -match which maximizes the number of students who are fulfilled.
| Student | Teachers |
|---|---|
Table 1: List of Preferences
(3) Let the size of a set . Show an algorithm to get a -match which maximizes the number of students who are fulfilled and its complexity.
(4) For , given a ranked list of teachers by students (Table 2), show a -match which minimizes the total sum of ranks.
(5) In addition to the ranked list of teachers by students, consider a ranked list of students by teachers. Given a -match, if there exists no pair of student and teacher who would both get the higher rank than that of the current partner of the given -match, then, this -match is called an -match. For , given a ranked list of students by teachers (Table 3) in addition to the Table 2, show an -match.
| Ranking | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
Table 2: Rank of teachers by students
| Ranking | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
Table 3: Rank of students by teachers
(6) For , show an algorithm to get an -match and its complexity.
(7) We will develop a real software system for private lessons for an English conversation school. List possible study items (example: web reservation), and describe each item in two lines.
题目描述
某英语会话学校要为一对一课程把学生和教师配对。给定学生集合 与教师集合 ,把每名学生与每名教师各使用一次,组成 个互不相交的学生—教师对;称这样的完整配对为 -匹配。
-
一共有多少种 -匹配?
-
当 时,学生可接受的教师如下。令
画出图 ,并给出一个让“分配到可接受教师”的学生人数最多的 -匹配。
学生 可接受教师 -
设 。给出求上述满意学生数最大的 -匹配的算法,并分析复杂度。
-
当 时,学生对教师的完整名次如下。给出一个使所有学生所得教师名次之和最小的 -匹配。
学生 \ 名次 1 2 3 4 5 6 7 -
再给出教师对学生的名次表。若某个 -匹配中不存在这样一对尚未配在一起的学生与教师:二者都比起当前搭档更偏好对方,则称该匹配为 -匹配。结合上表和下表,为 给出一个 -匹配。
教师 \ 名次 1 2 3 4 5 6 7 -
对一般 ,给出求 -匹配的算法及其复杂度。
-
若要真正开发英语会话学校的一对一课程软件系统,列出可能需要研究或实现的项目(例如 Web 预约),每项用两行说明。
Kai
(1) Number of complete pairings
Choose a distinct teacher for each student in order: there are possible -matches. The empty instance has pairing.
(2) Maximum number of fulfilled students
The following bipartite graph contains exactly the preferred pairs in Table 1; its edges do not include the nonpreferred pairs that can still be used to complete a -match.
The three students collectively prefer only . At least one of these students must therefore receive a nonpreferred teacher, so at most four students can be fulfilled. The complete pairing
fulfills the first four students and attains that upper bound.
(3) Algorithm and complexity
Find a maximum-cardinality matching in the bipartite preference graph. Start with no matched edges; repeatedly search for a path that alternates unmatched and matched edges, beginning at an unmatched student and ending at an unmatched teacher. Reverse the membership of every edge on that augmenting path, increasing by one. When no augmenting path exists, the matching is maximum: otherwise the symmetric difference with a larger matching would contain an augmenting path.
There are at most augmentations. A straightforward search scans vertices and edges each time, giving time and space; with isolated vertices handled separately, the common edge-based implementation takes time. Hopcroft–Karp improves this to .
Finally pair the remaining unmatched students and teachers arbitrarily to obtain a complete -match. This preserves all preferred pairs. A preferred edge between any two unmatched vertices would augment , so no extra fulfilled pair has been missed. Conversely, the fulfilled pairs of any complete pairing form a matching in the preference graph and cannot exceed .
(4) Minimum total rank
One optimal complete pairing, listed in student order, is
Its ranks are , with sum .
To prove optimality, minimize each teacher's assigned rank independently. For teachers , these column minima are , summing to 14. However, the minimum for both and is attained only by . A complete pairing cannot use twice, so at least one of these ranks must exceed its column minimum by at least one. Thus every -match has total rank at least 15, attained above. A Hungarian or min-cost-flow algorithm can solve the general minimum-rank assignment problem.
(5) A stable matching
Student-proposing deferred acceptance gives
For example, choosing free students in queue order, the proposals made by each student are:
| Student | Teachers proposed to, in order | Final teacher |
|---|---|---|
Every teacher to whom a student would prefer to move has already rejected that student or subsequently replaced them with a preferred student. Teachers only improve their held partner. Therefore no student-teacher pair blocks this matching. For instance prefers to , but these teachers prefer their current partners , respectively, to . Stability is a different objective from the total-rank minimum in (4).
(6) Deferred acceptance
Initially everyone is free. While a student is free, they propose to their most preferred teacher not yet proposed to. A free teacher holds the proposal; an already engaged teacher keeps the more preferred of the current and new students and rejects the other. Engagements are provisional until no student remains free.
There are at most distinct proposals. Precompute each teacher's inverse ranking table for constant-time comparisons; total time and input/ranking storage are . The working queue, next-proposal indices and partners use additional space. Because the preference lists are complete and both sides have size , the algorithm ends with all students paired. If a student preferred some teacher to their final partner, that teacher rejected them and ends with a partner preferred to that student, proving stability.
(7) Software design items
| Item | Main consideration |
|---|---|
| Web reservation | Show available time slots and allow booking, cancellation and rescheduling; commit a booking atomically to prevent double booking. |
| Scheduling constraints | Match teacher availability, student availability, classroom capacity and lesson duration before optimizing preferences. |
| Preference management | Collect ranked choices and distinguish mandatory constraints from preferences; explain whether the chosen objective is satisfaction, total rank or stability. |
| Accounts and permissions | Authenticate students, teachers and administrators and restrict which schedules and personal records each role can access. |
| Payments and cancellation rules | Record fees, refunds and deadlines consistently with booking changes; make retries idempotent so payments are not duplicated. |
| Notifications | Send confirmations and reminders with the correct time zone, and track failed delivery without treating it as a cancelled reservation. |
| Operations and recovery | Keep audit records and backups, monitor service failures, and support recovery of bookings without losing their transaction history. |