跳到主要内容

東京大学 情報理工学系研究科 創造情報学専攻 2012年8月実施 筆記試験 第1問

Author​

itsuitsuki

Description​

Official examination, archived Japanese PDF. An English conversation school plans to make pairs of students and teachers for private lessons. Given a set S={s1,s2,…,sn}S = \{s_1, s_2, \dots, s_n\} of students and a set T={t1,t2,…,tn}T = \{t_1, t_2, \dots, t_n\} of teachers, we make disjoint nn pairs of a student and a teacher, which we call a pp-match. Answer the following questions:

(1) How many pp-matches exist?

(2) For n=5n = 5, given a list of preferable teachers by students (Table 1) V=S∪TV = S \cup T E={xy∣x∈S,y∈T,x prefers y.}E = \{xy \mid x \in S, y \in T, x \text{ prefers } y.\} draw a graph G=(V,E)G = (V, E), and show a pp-match which maximizes the number of students who are fulfilled.

StudentTeachers
s1s_1t1,t3t_1, t_3
s2s_2t2,t4,t5t_2, t_4, t_5
s3s_3t1,t3t_1, t_3
s4s_4t3,t5t_3, t_5
s5s_5t1,t3t_1, t_3

Table 1: List of Preferences

(3) Let the size of a set ∣E∣=m|E| = m. Show an algorithm to get a pp-match which maximizes the number of students who are fulfilled and its complexity.

(4) For n=7n = 7, given a ranked list of teachers by students (Table 2), show a pp-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 pp-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 pp-match, then, this pp-match is called an ss-match. For n=7n = 7, given a ranked list of students by teachers (Table 3) in addition to the Table 2, show an ss-match.

Ranking1234567
s1s_1t7t_7t1t_1t2t_2t6t_6t5t_5t4t_4t3t_3
s2s_2t7t_7t1t_1t2t_2t3t_3t4t_4t5t_5t6t_6
s3s_3t7t_7t5t_5t2t_2t6t_6t1t_1t4t_4t3t_3
s4s_4t1t_1t4t_4t3t_3t6t_6t2t_2t5t_5t7t_7
s5s_5t7t_7t3t_3t1t_1t2t_2t4t_4t5t_5t6t_6
s6s_6t3t_3t7t_7t2t_2t1t_1t5t_5t4t_4t6t_6
s7s_7t7t_7t3t_3t2t_2t6t_6t5t_5t4t_4t1t_1

Table 2: Rank of teachers by students

Ranking1234567
t1t_1s1s_1s2s_2s3s_3s4s_4s5s_5s6s_6s7s_7
t2t_2s1s_1s2s_2s4s_4s3s_3s7s_7s6s_6s5s_5
t3t_3s3s_3s2s_2s1s_1s5s_5s6s_6s4s_4s7s_7
t4t_4s2s_2s3s_3s1s_1s7s_7s4s_4s6s_6s5s_5
t5t_5s1s_1s3s_3s4s_4s2s_2s5s_5s6s_6s7s_7
t6t_6s1s_1s5s_5s3s_3s4s_4s2s_2s6s_6s7s_7
t7t_7s3s_3s5s_5s1s_1s4s_4s2s_2s7s_7s6s_6

Table 3: Rank of students by teachers

(6) For nn, show an algorithm to get an ss-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.

题目描述​

某英语会话学校要为一对一课程把学生和教师配对。给定学生集合 S={s1,…,sn}S=\{s_1,\ldots,s_n\} 与教师集合 T={t1,…,tn}T=\{t_1,\ldots,t_n\},把每名学生与每名教师各使用一次,组成 nn 个互不相交的学生—教师对;称这样的完整配对为 pp-匹配。

  1. 一共有多少种 pp-匹配?

  2. 当 n=5n=5 时,学生可接受的教师如下。令

    V=S∪T,E={xy∣x∈S, y∈T, x 喜欢 y}.V=S\cup T,\qquad E=\{xy\mid x\in S,\ y\in T,\ x\text{ 喜欢 }y\}.

    画出图 G=(V,E)G=(V,E),并给出一个让“分配到可接受教师”的学生人数最多的 pp-匹配。

    学生可接受教师
    s1s_1t1,t3t_1,t_3
    s2s_2t2,t4,t5t_2,t_4,t_5
    s3s_3t1,t3t_1,t_3
    s4s_4t3,t5t_3,t_5
    s5s_5t1,t3t_1,t_3
  3. 设 ∣E∣=m|E|=m。给出求上述满意学生数最大的 pp-匹配的算法,并分析复杂度。

  4. 当 n=7n=7 时,学生对教师的完整名次如下。给出一个使所有学生所得教师名次之和最小的 pp-匹配。

    学生 \ 名次1234567
    s1s_1t7t_7t1t_1t2t_2t6t_6t5t_5t4t_4t3t_3
    s2s_2t7t_7t1t_1t2t_2t3t_3t4t_4t5t_5t6t_6
    s3s_3t7t_7t5t_5t2t_2t6t_6t1t_1t4t_4t3t_3
    s4s_4t1t_1t4t_4t3t_3t6t_6t2t_2t5t_5t7t_7
    s5s_5t7t_7t3t_3t1t_1t2t_2t4t_4t5t_5t6t_6
    s6s_6t3t_3t7t_7t2t_2t1t_1t5t_5t4t_4t6t_6
    s7s_7t7t_7t3t_3t2t_2t6t_6t5t_5t4t_4t1t_1
  5. 再给出教师对学生的名次表。若某个 pp-匹配中不存在这样一对尚未配在一起的学生与教师:二者都比起当前搭档更偏好对方,则称该匹配为 ss-匹配。结合上表和下表,为 n=7n=7 给出一个 ss-匹配。

    教师 \ 名次1234567
    t1t_1s1s_1s2s_2s3s_3s4s_4s5s_5s6s_6s7s_7
    t2t_2s1s_1s2s_2s4s_4s3s_3s7s_7s6s_6s5s_5
    t3t_3s3s_3s2s_2s1s_1s5s_5s6s_6s4s_4s7s_7
    t4t_4s2s_2s3s_3s1s_1s7s_7s4s_4s6s_6s5s_5
    t5t_5s1s_1s3s_3s4s_4s2s_2s5s_5s6s_6s7s_7
    t6t_6s1s_1s5s_5s3s_3s4s_4s2s_2s6s_6s7s_7
    t7t_7s3s_3s5s_5s1s_1s4s_4s2s_2s7s_7s6s_6
  6. 对一般 nn,给出求 ss-匹配的算法及其复杂度。

  7. 若要真正开发英语会话学校的一对一课程软件系统,列出可能需要研究或实现的项目(例如 Web 预约),每项用两行说明。

Kai​

(1) Number of complete pairings​

Choose a distinct teacher for each student in order: there are n(n−1)⋯1=n!n(n-1)\cdots1=\boxed{n!} possible pp-matches. The empty instance has 0!=10!=1 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 pp-match.

The three students s1,s3,s5s_1,s_3,s_5 collectively prefer only t1,t3t_1,t_3. At least one of these students must therefore receive a nonpreferred teacher, so at most four students can be fulfilled. The complete pairing

{(s1,t1),(s2,t2),(s3,t3),(s4,t5),(s5,t4)}\boxed{\{(s_1,t_1),(s_2,t_2),(s_3,t_3),(s_4,t_5),(s_5,t_4)\}}

fulfills the first four students and attains that upper bound.

(3) Algorithm and complexity​

Find a maximum-cardinality matching MM 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 ∣M∣|M| 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 nn augmentations. A straightforward search scans O(n+m)O(n+m) vertices and edges each time, giving O(n(n+m))O(n(n+m)) time and O(n+m)O(n+m) space; with isolated vertices handled separately, the common edge-based implementation takes O(nm+n)O(nm+n) time. Hopcroft–Karp improves this to O((n+m)n)O((n+m)\sqrt n).

Finally pair the remaining unmatched students and teachers arbitrarily to obtain a complete pp-match. This preserves all ∣M∣|M| preferred pairs. A preferred edge between any two unmatched vertices would augment MM, 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 ∣M∣|M|.

(4) Minimum total rank​

One optimal complete pairing, listed in student order, is

(t1,t2,t5,t4,t7,t3,t6).\boxed{(t_1,t_2,t_5,t_4,t_7,t_3,t_6)}.

Its ranks are (2,3,2,2,1,1,4)(2,3,2,2,1,1,4), with sum 15\boxed{15}.

To prove optimality, minimize each teacher's assigned rank independently. For teachers t1,…,t7t_1,\ldots,t_7, these column minima are (1,3,1,2,2,4,1)(1,3,1,2,2,4,1), summing to 14. However, the minimum for both t1t_1 and t4t_4 is attained only by s4s_4. A complete pairing cannot use s4s_4 twice, so at least one of these ranks must exceed its column minimum by at least one. Thus every pp-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

{(s1,t1),(s2,t2),(s3,t7),(s4,t4),(s5,t3),(s6,t5),(s7,t6)}.\boxed{\{(s_1,t_1),(s_2,t_2),(s_3,t_7),(s_4,t_4), (s_5,t_3),(s_6,t_5),(s_7,t_6)\}}.

For example, choosing free students in queue order, the proposals made by each student are:

StudentTeachers proposed to, in orderFinal teacher
s1s_1t7,t1t_7,t_1t1t_1
s2s_2t7,t1,t2t_7,t_1,t_2t2t_2
s3s_3t7t_7t7t_7
s4s_4t1,t4t_1,t_4t4t_4
s5s_5t7,t3t_7,t_3t3t_3
s6s_6t3,t7,t2,t1,t5t_3,t_7,t_2,t_1,t_5t5t_5
s7s_7t7,t3,t2,t6t_7,t_3,t_2,t_6t6t_6

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 s6s_6 prefers t3,t7,t2,t1t_3,t_7,t_2,t_1 to t5t_5, but these teachers prefer their current partners s5,s3,s2,s1s_5,s_3,s_2,s_1, respectively, to s6s_6. 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 n2n^2 distinct proposals. Precompute each teacher's inverse ranking table for constant-time comparisons; total time and input/ranking storage are O(n2)O(n^2). The working queue, next-proposal indices and partners use O(n)O(n) additional space. Because the preference lists are complete and both sides have size nn, 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​

ItemMain consideration
Web reservationShow available time slots and allow booking, cancellation and rescheduling; commit a booking atomically to prevent double booking.
Scheduling constraintsMatch teacher availability, student availability, classroom capacity and lesson duration before optimizing preferences.
Preference managementCollect ranked choices and distinguish mandatory constraints from preferences; explain whether the chosen objective is satisfaction, total rank or stability.
Accounts and permissionsAuthenticate students, teachers and administrators and restrict which schedules and personal records each role can access.
Payments and cancellation rulesRecord fees, refunds and deadlines consistently with booking changes; make retries idempotent so payments are not duplicated.
NotificationsSend confirmations and reminders with the correct time zone, and track failed delivery without treating it as a cancelled reservation.
Operations and recoveryKeep audit records and backups, monitor service failures, and support recovery of bookings without losing their transaction history.