Hostname: page-component-54dcc4c588-b5cpw Total loading time: 0 Render date: 2025-09-15T12:32:36.494Z Has data issue: false hasContentIssue false

Finding Personalized Good-Enough Solutions to Unsatisfiable Stable Roommates Problems

Published online by Cambridge University Press:  12 September 2025

MÜGE FIDAN
Affiliation:
Faculty of Engineering and Natural Sciences, Sabanci University, Istanbul, Turkey (e-mails: mugefidan@sabanciuniv.edu, esraerdem@sabanciuniv.edu)
ESRA ERDEM
Affiliation:
Faculty of Engineering and Natural Sciences, Sabanci University, Istanbul, Turkey (e-mails: mugefidan@sabanciuniv.edu, esraerdem@sabanciuniv.edu)
Rights & Permissions [Opens in a new window]

Abstract

The Stable Roommates problems are characterized by the preferences of agents over other agents as roommates. A solution is a partition of the agents into pairs that are acceptable to each other (i.e., they are in the preference lists of each other), and the matching is stable (i.e., there do not exist any two agents who prefer each other to their roommates and thus block the matching). Motivated by real-world applications, and considering that stable roommates problems do not always have solutions, we continue our studies to compute “good-enough” matchings. In addition to the agents’ habits and habitual preferences, we consider their networks of preferred friends and introduce a method to generate personalized solutions to stable roommates problems. We illustrate the usefulness of our method with examples and empirical evaluations.

Information

Type
Original Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2025. Published by Cambridge University Press

1 Introduction

The Stable Roommates problem (Gale and Shapley Reference Gale and Shapley1962) (SR) is a matching problem (well-studied in economics and game theory) characterized by the preferences of an even number $n$ of agents over other agents as roommates: each agent ranks all others in strict order of preference. A solution to SR is then a partition of the agents into pairs that are acceptable to each other (i.e., they are in the preference lists of each other), and the matching is stable (i.e., there exist no two agents who prefer each other to their roommates and thus block the matching).

Motivated by real-world applications, variations of SR have been investigated. For instance, students may find it difficult to rank a large number of alternatives in strict order of preference. With such motivations, SR has been studied with incomplete preference lists (SRI) (Gusfield and Irving Reference Gusfield and Irving1989), with preference lists including ties (SRT) (Ronn Reference Ronn1990), and with incomplete preference lists including ties (SRTI) (Irving and Manlove Reference Irving and Manlove2002). In this study, we focus on SRTI.

As first noted by Gale and Shapley (Reference Gale and Shapley1962), unlike the well-known Stable Marriage problem (SM), there is no guarantee to find a solution to every SR problem instance (i.e. there might be no stable matching). In real-world applications, the preference lists are often too short or empty (e.g., for freshmen students). Thus, for SRI and SRTI instances, it gets harder to find a stable matching: students who are not in the preference lists of each other are considered unacceptable to each other, and thus they cannot be matched. In such cases, we still need to find a matching that is “good-enough.”

To find good-enough matchings, existing approaches consider more general variations of SR. For instance, Almost SR (Abraham et al. Reference Abraham, Biró and Manlove2005) aims to find a matching that minimize the total number of blocking pairs (i.e., pairs of agents who prefer each other to their roommates). Gärdenfors (Reference Gärdenfors1975) consider “popularity” instead of stability and aims to find a matching that maximizes the number of agents who are better off in this matching compared to other matchings. Thakur (Reference Thakur2021) introduces the property of “majority stability” to find a matching preferred by more than half of all agents over other matchings. Aziz et al. (Reference Aziz, Csáji and Cseh2023) generalize the idea of majority stability by proposing “ $k$ -stability” which aims to find a matching preferred by at least $k$ out of the $n$ agents. To relax restriction of popularity, Kavitha and Vaish (Reference Kavitha and Vaish2023) consider the notion of “semi-popularity” to find a matching which is undefeated by a majority of matchings. Afacan et al. (Reference Afacan, Aliogullari and Barlo2016) introduce the notion of “sticky stability” to accommodate appeal costs in school placements and allow priority violations when the rank difference between the claimed and the received objects are less than a certain threshold. In all these studies, every stable matching (if one exists) is also one of the targeted matchings, but not vice versa.

We propose a different (but orthogonal) approach to find good-enough solutions by extending the preference lists of agents with “suitable” candidates identified by further available knowledge. For instance, in our earlier work (Fidan and Erdem Reference Fidan and Erdem2021), we have introduced knowledge-based methods for SRTI that identify suitable candidates by considering the habits (e.g., smoking, studying) of students, the preferences over the habits of their roommates, and the preferences and the constraints of the colleges (e.g., to increase diversity and inclusion). We have observed the usefulness of this approach in computing not only good-enough matchings that are stable with respect to extended lists, but also more personalized, more diverse, and/or more inclusive matchings.

In this study, motivated by the promising results of our earlier studies and further observations we have made in real-world applications with the help of different parties involved, we propose a new method to further extend preference lists to be able to find a matching when there is no stable matching. In particular, based on the observations, students often make new friends by meeting friends of their friends; our method extends the preference lists further by considering the networks of agent’s preferred friends. At this point, the curious reader may think rightfully that not every student would agree with the preference lists of their friends, but actually many of the students do prefer as roommates a preferred friend’s friend if they cannot be assigned to any of their preferred friends. Indeed, according to a poll survey, as shown in Figure 1, conducted with 101 students at Sabanci University, the majority ( $75.2\%$ ) of the participants have expressed their preference of a roommate from the preference lists of their friends, if they cannot be assigned to any of their preferred friends. Hence, based on these results, extending the preference lists, based on their networks of preferred friends, is beneficial to align with student’s expectations for assigning a roommate. Based on this observation, our method further extends the preference list of an agent $x$ by including every agent $y$ who is not in $x$ ’s preference list but “ $k$ -connected” to $x$ (i.e., $x$ and $y$ are connected by a chain of $k$ PFOAF – preferred friend of a friend – relations).

Fig 1. A poll survey given to a set of students at Sabanci University, to find out whether the student prefers as roommate (a) someone from the preference lists of their preferred friends, or (b) anyone.

Also, based on our interviews (cf. the two interviews presented in the supplementary material accompanying the paper at the TPLP archive) we consider that some students may request not to be matched with some other students (e.g., previous roommates who they could not get along). Our method utilizes this knowledge about “forbidden pairs” as well, while identifying suitable candidates to extend the preference lists.

We illustrate the benefits of utilizing different types of knowledge to extend the preference lists, with examples. Also, we implement our method by utilizing the expressive languages and efficient solvers of Answer Set Programming (ASP) (Niemelä Reference Niemelä1999; Marek and Truszczyński Reference Marek and Truszczyński1999; Lifschitz Reference Lifschitz2002; Brewka et al. Reference Brewka, Eiter and Truszczynski2016), and evaluate its usefulness by a comprehensive set of experiments.

2 Preliminaries

In this study, we consider the definitions of SRTI (Erdem et al. Reference Erdem, Fidan, Manlove and Prosser2020) and its knowledge-based extentions (i.e., Personalized-SRTI) (Fidan and Erdem Reference Fidan and Erdem2021), as well as the ASP formulations to solve these problems, as in our earlier studies.

2.1 SRTI: Stable roommates problem with ties and incomplete lists

Let $A$ be a finite set of agents. For every agent $x\in A$ , let $A_x \subseteq A \backslash \{x\}$ be a set of agents that are acceptable to $x$ as roommates. For every $y$ in $A_x$ , we assume that $x$ prefers $y$ as a roommate compared to being single.

Let $\prec _{x}$ be a partial ordering of $x$ ’s preferences over $A_x$ where incomparability is transitive. We refer to $\prec _{x}$ as agent $x$ ’s preference list. For two agents $y$ and $z$ in $A_x$ , we denote by $y \prec _{x} z$ that $x$ prefers $y$ to $z$ . In this context, ties correspond to indifference in the preference lists: an agent $x$ is indifferent between the agents $y$ and $z$ , denoted by $y \sim _{x} z$ , if $y \not \prec _{x} z$ and $z \not \prec _{x} y$ . We denote by $\prec$ the collection of all preference lists.

A matching for a given SRTI instance is a function $M: A \mapsto A$ such that, for all $\{x,y\} \subseteq A\times A$ such that $x\in A_y$ and $y\in A_x$ , $M(x)=y$ if and only if $M(y)=x$ . If agent $x$ is mapped to itself, we then say he/she is single.

A matching $M$ is blocked by a pair $\{x, y\} \subseteq A \times A$ ( $x\neq y$ ) if the following hold: both agents $x$ and $y$ are acceptable to each other, $x$ is single with respect to $M$ , or $y \prec _{x} M(x)$ , and $y$ is single with respect to $M$ , or $x \prec _{y} M(y)$ .

A matching for SRTI is called stable if it is not blocked by any pair of agents.

We can declaratively solve SRTI using ASP as described in our earlier work (Erdem et al. Reference Erdem, Fidan, Manlove and Prosser2020). The input $I=(A,\prec )$ of an SRTI instance is formalized by a set $F_I$ of facts using atoms of the forms agent $(x)$ (“ $x$ is an agent in $A$ ”) and prefer2 $(x,y,z)$ (“agent $x$ prefers agent $y$ to agent $z$ , i.e., $y \prec _{x} z$ ”). For every agent $x$ , for every $y\in A_x$ , we also add facts of the form prefer2 $(x,y,x)$ to express that $x$ prefers $y$ as a roommate instead of being single. We recursively define the transitive closure of this preference relation:

\begin{align*} \begin{array}{l} \textit {prefer}(x,y,z) \leftarrow \textit {prefer2}(x,y,z). \\[5pt] \nonumber \textit {prefer}(x,y,z) \leftarrow \textit {prefer2}(x,y,w), \textit {prefer}(x,w,z). \end{array} \end{align*}

and acceptability of agents:

(1) \begin{align} \begin{array}{l} \textit {accept}(x,y) \leftarrow \textit {prefer}(x,y,\_). \\[3pt] \textit {accept}(x,y) \leftarrow \textit {prefer}(x,\_,y). \\[3pt] \textit {accept2}(x,y) \leftarrow \textit {accept}(x,y), \textit {accept}(y,x). \end{array} \end{align}

The output $M: A \mapsto A$ of an SRTI instance is characterized by atoms of the form room $(x,y)$ (“agents $x$ and $y$ are roommates”). For every agent $x$ , exactly one mutual acceptable agent $y$ is nondeterministically chosen as $M(x)$ :

\begin{align*} \begin{array}{l} 1\{\textit {room}(x,y){:} \textit {agent}(y), \textit {accept2}(x,y)\}1 \leftarrow \textit {agent}(x). \\[3pt] \leftarrow \textit {room}(x,y), \textit {not}\ \textit {room}(y,x). \end{array} \end{align*}

and the stability of the generated matching is ensured:

\begin{equation*} \leftarrow \textit {block}(x,y) \qquad (x\neq y) . \end{equation*}

where atoms of the form block $(x,y)$ describe the blocking pairs.

2.2 Personalized-SRTI: SRTI with personalized criteria

Let $B$ be a finite list $\langle b_{1},b_{2},\dots ,b_{k} \rangle$ of criteria. For every $b_{i} \in B$ , let $C_i$ be a finite list $\langle c_{i1},c_{i2},\dots ,c_{im} \rangle$ of its choices for $b_{i}$ , ordered with respect to a “closeness” measure.

Let $f$ be a function that maps an agent $x\in A$ and a criterion $b_{i} \in B$ to a positive integer $j$ ( $1\leq j \leq |C_{i}|$ ), describing the choice $c_{ij}$ of the agent $x$ . For every agent $x$ , $x$ ’s (preference) profile $P_{x}=\langle f(x,b_{1}),f(x,b_{2}),\dots ,f(x,b_{k})\rangle$ characterizes its choices of for each criterion in $B$ , respectively.

Every criterion in $B$ may have a different importance for each agent. For that, we introduce a weight function $w$ that maps an agent $x\in A$ and a criterion $b_{i} \in B$ to a non-negative integer such that $w(x,b_{i})$ denotes the importance of the criterion $b_{i}$ for $x\in A$ . For every agent $x\in A$ , let us denote by the weight list $W_{x}=\langle w(x,b_{1}),w(x,b_{2}),\dots ,w(x,b_{k})\rangle$ the respective weights of criteria in $B$ for $x$ .

For every agent $x\in A$ , with a profile $P_x$ and a weight list $W_x$ , let us denote the criteria of the same weight $u\gt 0$ and the agent $x$ ’s choices for them, by a nonempty set $E_u$ of tuples: $E_u = \{(f(x,\pi _{i}),\pi _i)\ |\ u=w(x,\pi _i)\gt 0,\ \pi _i \in \{b_{1},b_{2},\dots ,b_{k}\}\}.$ Then, for every agent $x\in A$ , we define a sorted profile $P_{x}^{'}$ for $x$ , with respect to $P_{x}$ and $W_x$ : $P_{x}^{'}=\langle E_{u_1}, E_{u_2}, \dots , E_{u_m} \rangle$ where $m \leq k$ , and, for each $i$ ( $1 {\leq } i {\lt } m$ ), $u_i \gt u_{i+1}$ .

For every agent $y\in A \backslash A_{x}$ (i.e., $y$ is not acceptable to $x$ ), $y$ is choice-acceptable to $x$ if there exists some criterion $b_{i}\in B$ where $w(x,b_i)\gt 0$ such that $f(y,b_{i})=f(x,b_{i})$ . For every agent $x$ with a sorted profile $P_{x}^{'}=\langle E_{u_1}, E_{u_2}, \dots , E_{u_m} \rangle$ ( $m \leq k$ ), for every two agents $y$ and $z$ that are choice-acceptable to $x$ , the agents $y$ and $z$ are choice-equal for $x$ relative to the first $j$ sets $E_{u_1}, E_{u_2}, \dots , E_{u_j}$ in $P_{x}^{'}$ (denoted $y =_{x} z |_j$ ) if $j=0$ , or $j\gt 0$ , $y =_{x} z |_{j-1}$ , and, for every $(f(x,\pi _{i}),\pi _i)\in E_{u_j}$ , $f(x,\pi _{i}) = f(y,\pi _{i}) = f(z,\pi _{i})$ .

We say that $x$ prefers $y$ to $z$ with respect to a sorted profile $P_{x}^{'}$ (denoted $y \prec '_{x} z$ ) if, for some $j\gt 0$ , $y =_{x} z |_{j-1}$ , and $|\{\pi _i |\ (f(x,\pi _{i}),\pi _i){\in } E_{u_j},\ f(x,\pi _{i}) {=} f(y,\pi _{i})\}|\ \gt$ $|\{\pi _i |\ (f(x,\pi _{i}),\pi _i){\in } E_{u_j},\ f(x,\pi _{i}) {=} f(z,\pi _{i})\}|.$

A criteria-based personalized preference list $\prec _{x}^{'}$ is a partial ordering of $x$ ’s preferences over $A'_x$ with respect to a sorted profile $P_{x}^{'}$ , where incomparability is transitive. An extended preference list $\prec _{x}^{''}$ is obtained by concatenating $\prec _{x}$ and $\prec _{x}^{'}$ , depending on the importance given to these two types of lists. Personalized-SRTI is then characterized by $(A,\prec ^{''})$ where $A$ is a finite set of agent, and $\prec ^{''}$ is the collection of the extended preference list of each agent $x\,\in \,A$ .

Table 1. A Personalized-SRTI instance, characterized by a set of students $x$ , and their extended preference lists $\prec _{x}^{''}$

Example 1. Suppose that a set $\{a,b,c,d,e\}$ of freshman students applies for an accommodation at a dormitory by filling out a questionnaire, like the one shown in Table 4 of (Fidan and Erdem Reference Fidan and Erdem2021). The roommate questionnaires request from the students to provide their preferences over others, for example by considering first impressions if they have a chance to meet. Table 1 shows preferences $\prec _{x}$ of these students, extracted from these questionnaires. Here, the SRTI instance $I=(A,\prec )$ does not have a stable matching since there is no pair of students who are acceptable to each other.

So, let us identify some suitable candidates relative to the habits (e.g., smoking, studying) of students and their priorities and preferences over the habits of their roommates, and then extend the preference lists by including these suitable candidates. The ordering $\prec _{x}^{'}$ of the suitable candidates is shown in Table 1. Considering the aggregate preference list $\prec _{x}^{''}=\prec _{x} + \prec '_{x}$ , the Personalized-SRTI instance $I'=(A,\prec ^{''})$ does not have a stable matching.

3 $k$ -Personalized-SRTI: Personalized-SRTI with $k$ -connection

Students often meet other students through mutual friends, for example, the friends of their friends, and sometimes get along with each other. Based on this observation, we propose a new method to further extend preference lists to be able to find a matching when there is no stable matching.

In particular, for every agent $x$ , our method extends the preference list of $x$ by including every agent $y$ who is not already in $x$ ’s preference list but “ $k$ -connected” to $x$ (i.e., $x$ and $y$ are connected a chain of $k$ PFOAF – preferred friend of a friend – relations).

Let us introduce the relevant definitions and notation to make this idea more rigorous.

3.1 Defining $\boldsymbol{{k}}$ -acceptable pairs with respect to $\boldsymbol{\prec} _{\boldsymbol{{x}}}$

Let $A_x^{+}$ be a set of acceptable agents to $x \in A$ , and $A_x^{-}$ be a set of unwanted agents by $x \in A$ . Note that $A_x^{+} \cup A_x^{-} \subseteq A$ . Let $A^{-}$ be a set of unwanted pairs, that is $A^{-} = \{\{x,y\}: x \in A_y^{-},\,y\in A\}$ . If an agent $x$ states $y$ as acceptable or unwanted, then we say that $y$ is known by $x$ .

Let $K_x$ be a set of agents known by $x$ . We assume that $A_x^{+} \cup A_x^{-} = K_x$ . We denote by $K$ the set of pairs of agents who are known by each other, i.e., $K = \{\{x,y\}: x \in K_y,\,y\in A\}$ . Note that $K$ does not require that agents mutually know each other.

A $k$ -acceptability graph is an undirected graph $G_A=(V,E)$ , where every vertex $x \in V$ uniquely denotes an agent in $A$ , and every edge $\{x,y\}\in E$ denotes pairs of agents that know each other and none of them is unwanted by the other: $\{x,y\} \in K \setminus A^{-}$ . The curious reader may notice that the “known by” relation is not symmetric but the graph $G_A$ is undirected (since it includes an undirected edge to denote one-sided known but non-unwanted pairs). We construct $G_A=(V,E)$ a bit more generously based on the following assumption: if a student $x$ is known by another student $y$ , and neither student finds the other one unwanted, then the pair $\{x,y\} \in E$ regardless of $y$ is known by $x$ . This assumption is reasonable and allows more possibilities for good-enough matchings. Indeed, a student $x$ might state someone $y$ in their preference list without being listed in return because the other student $y$ has not provided any preferences; in such cases, it is reasonable to assume that $x$ is not unwanted by $y$ and it is possible that $y$ might include $x$ in their list if they provide their preferences.

We say that agents $x$ and $y$ form a $k$ -connected pairs if there exists a path of length $k$ that connects $x$ and $y$ in $G_A$ . Let us denote by $P^{k}_{G_A}$ the set of all $k$ -connected pairs in $G_A$ , and, for simplicity, we will refer to it as $P^k$ throughout the remainder of the paper.

Example 2. Consider the running example. Let us denote a pair $\{x,y\}$ of students in $A$ by $xy$ . Suppose that $b$ states that $d$ is unwanted $A_{b}^{-} = \{d\}$ . Then, $A^{-}=\{bd\}$ . The $k$ -acceptability graph $G_A=(V,E)$ is defined as follows: $V= \{a,\,b,\,c,\,d,\,e\}$ and $E= \{ae,\,bc,\,be,\,de\}$ . According to the $k$ -acceptability graph $G_A=(V,E)$ , $k$ -connected pairs for $k=1,2,3$ are defined as follows: $P^1 = \{ae,\,bc,\,be,\,de\}$ , $P^2 = \{ad,\,ab,\,bd,\,ce\}$ , and $P^3 = \{ac,\,cd\}$ .

3.2 Breaking ties in $\boldsymbol{\prec} _{\boldsymbol{{x}}}^{\boldsymbol{\prime}}$ by considering $\boldsymbol{{k}}$ -connected pairs

Let $I_x$ be a set of agents that are inferred as acceptable to $x$ as roommates, that is $I_x = \{y: y \in \prec '_{x}\}$ . If an agent $x$ is indifferent between $y$ and $z$ in $I_x$ , then this tie is broken by considering $k$ -connected pairs according to the following rule: if there exists a value $k$ such that $\{x,y\} \in P{^k}$ , and there is no $l$ such that $\{x,z\} \in P{^l}$ for $l\leq k$ , then $y \prec '_{x} z$ .

Example 3. Consider the running example. According to $\prec '_{c}$ , student $c$ is indifferent between student $a$ and $e$ . We can break this tie by considering $k$ -connected pairs: $e \prec _{c}' a$ since there exist a value $k=2$ such that $ce \in P{^2}$ and $ac \notin P{^2}$ , but $ac \in P{^3}$ .

3.3 Defining the $\boldsymbol{{k}}$ -extended preference lists $\boldsymbol{\prec} _{\boldsymbol{{x}}}^{\boldsymbol{{k}}^{\boldsymbol{\prime}\boldsymbol{\prime}}}$

Let $O_{x}$ be a set of agents that may be acceptable to $x$ , that is $O_x = \{y: y \in A \backslash {(K_x} \cup I_x)\}$ . Let $\prec _{x}^{k}$ be a partial ordering of $x$ ’s preferences over $O_{x}$ where incomparability is transitive. For two agents $y$ and $z$ in $O_x$ , $y \prec _{x}^{k} z$ if $\{x,y\} \in P{^{i}}$ and $\{x,z\} \notin P{^{i}}$ , but $\{x,z\} \in P{^{k}}$ for some $0\lt i\lt k$ . Note that for every $y \in O_{x}$ , $y \in \prec _{x}^1$ if $\{x,y\} \in P{^1}$ .

Considering $k$ -connected pairs, we define $\prec _{x}^{k''} = \prec _{x}^{''} + \prec _{x}^{k}$ as a $k$ -extended preference list. Note that $\prec _{x}^{k''}$ is the same as $\prec _{x}^{''}$ when $k=0$ . Let us denote by $\prec ^{k''}$ the collection of the $k$ -extended preference lists of each agent $x \in A$ .

Table 2. A $k$ -Personalized-SRTI instance, characterized by a set of students $x$ , sets $A_x^{-}$ of unwanted students as roommates, and the $k$ -extended lists $\prec _{x}^{k''}$ of preferred students as roommates for $k=1$ and $k=2$

Example 4. For the running example, Table 2 shows $k$ -extended preference lists for each student, for $k=1$ and $k=2$ . Students $a$ and $c$ may be acceptable to $b$ by $O_{b}= \{a,\,c\}\,$ . Since $bc \in P{^1}$ , $ab \notin P^1$ and $ab \in P^2$ , $c \in \prec _{b}^1$ and $c \prec _{b}^{2} a$ .

A $k$ -Personalized-SRTI instance is an SRTI instance characterized by a set $A$ of agents, a set $A^-$ of pairs of agents (denoting which agents are forbidden for which), and a collection $\prec ^{k''}$ of the $k$ -extended preference lists of each agent $x \in A$ . A solution to a $k$ -Personalized-SRTI instance is defined in the following section, as “ $k$ -stable matchings.”

3.4 Defining $\boldsymbol{{k}}$ -matchings with respect to $\boldsymbol{\prec} _{\boldsymbol{{y}}}^{\boldsymbol{{k}}^{\boldsymbol{\prime}\boldsymbol{\prime}}}$

We say that $x$ is $k$ -acceptable to $y$ if $x \in \prec _{y}^{k''}$ . If an agent $x$ is $k$ -acceptable to $y$ and $y$ is $k$ -acceptable to $x$ , then $x$ and $y$ are called $k$ -mutually acceptable.

A $k$ -matching for a given $k$ -Personalized-SRTI instance $(A,A^-,\prec ^{k''})$ , is a function $M: A \mapsto A$ such that, for all $\{x,y\} \subseteq A\times A$ where $x\in A_{y}{^{+}} \cup I_y \cup O_y$ and $y \in A_{x}{^{+}} \cup I_x \cup O_x$ , $M(x){=}y$ if and only if $M(y){=}x$ .

A pair $\{x,y\}\subseteq A\times A\,(x \neq y)$ is a $k$ -blocking pair with respect to $M$ if

  1. i) $x$ and $y$ are $k$ -mutually acceptable to each other,

  2. ii) $x$ is single in $M$ , or $y \prec _{x}^{k''} M(x)$ , and

  3. iii) $y$ is single in $M$ , or $x \prec _{y}^{k''} M(y)$ .

A $k$ -matching $M$ is called $k$ -stable if there is no $k$ -blocking pair with respect to $M$ .

Example 5. For the running example, we can find a $1$ -stable matching $M_1 = \{a,bc,de\}$ . This solution is also $2$ -stable.

SRTI with $k$ -connection ( $k$ -SRTI) is a special case of $k$ -Personalized-SRTI $(A,\prec ^{k''})$ where, for every agent $x\in A, \prec _{x}^{''} = \prec _{x}$ .

Proposition 1. $k$ -SRTI (and thus $k$ -Personalized-SRTI) is NP-complete.

3.5 Observations about $\boldsymbol{{k}}$ -Personalized-SRTI

Table 3. A $k$ -Personalized-SRTI instance, characterized by a set of students $x$ , sets $A_x^{-}$ of unwanted students as roommates, and the $k$ -extended lists $\prec _{x}^{k''}$ of preferred students as roommates for $k=1$ and $k=2$

Observation 1 ( $k$ -stability is not monotone.) Consider the example shown in Table 3. Consider $I=(A,\prec )$ as an instance of SRTI, and $I'=(A,\prec ^{''})$ as an instance of Personalized-SRTI. For both of them, there is no stable matching since there is no student who prefers each other. Then, we consider $I''=(A,A^{-},\prec ^{1''})$ as an instance of $1$ -SRTI. There are two $1$ -stable matchings: $M_1 = \{ab,cd,e,f\}$ , and $M_2=\{af,bc,d,e\}$ . If we further consider $I'''={(A,A^{-},\prec ^{2''})}$ as an instance of $2$ -SRTI, $M_1$ is not a $2$ -stable matching but $M_2$ is a $2$ -stable matching.

Observation 2 (A stable matching may not be a $k$ -stable matching.) Consider the example shown in Table 4. Consider the SRTI instance $I=(A,\prec )$ , and Personalized-SRTI instance $I'=(A,\prec ^{''})$ . For both of them, there is a stable matching: $M=\{ab,cd,e\}$ . Then, for the $1$ -SRTI instance $I''=(A,A^{-},\prec ^{1''})$ , $M$ is not a $1$ -stable matching since $be$ blocks the matching $M$ . Hence, $M_1=\{be,cd,a\}$ is a $1$ -stable matching.

Table 4. A $k$ -Personalized-SRTI instance, characterized by a set of students $x$ , sets $A_x^{-}$ of unwanted students as roommates, and the $k$ -extended lists $\prec _{x}^{1''}$ of preferred students as roommates for $k=1$

4 Solving $k$ -Personalized-SRTI using ASP

We formalize the input $I=(A,{ A^{-}},\prec ^{k''})$ of a $k$ -Personalized-SRTI instance in ASP by a set $F_I$ of facts using atoms of the forms agent $(x)$ (“ $x$ is an agent in $A$ ”), unwanted(x,y) (“agent $x$ states that agent $y$ is unwanted, i.e., $y \in {A_x^{-}}$ ”), and kPrefer $(x,y,z)$ (“agent $x$ prefers agent $y$ to agent $z$ by degree $k$ , i.e., $y\,\prec _{x}^{k''}\,z$ ”).

Preferences of each agent in $\prec _{x}$ and $\prec _{x}^{'}$ . We use atoms of the forms prefer2 $(x,y,z)$ (“agent $x$ prefers agent $y$ to agent $z$ , i.e., $y \prec _{x} z$ ”), iprefer $(x,y,z)$ (“agent $x$ prefers agent $y$ to agent $z$ in terms of the criteria-based personalized preference lists $y \prec _{x}^{'} z$ ”), and tie $(x,y,z)$ (“agent $x$ is indifferent between agent $y$ and agent $z$ ”).

Recall that, based on the stated preferences of agents, we define acceptable pairs (cf. rules (1)). Similarly, based on the inferred preferences by $\prec _{x}^{'}$ , we define inferred acceptable pairs:

\begin{align*} \begin{array}{l} \textit {inferred}(x,y) \leftarrow \textit {iprefer}(x,y,\_), \textit {not}\ \textit {prefer2}(x,y,\_). \\[3pt] \textit {inferred}(x,y) \leftarrow \textit {iprefer}(x,\_,y). \end{array} \end{align*}

Defining $k$ -acceptability graphs. Based on the stated unwanted agents, we define unacceptable pairs:

Considering also the acceptable pairs, we define pairs of agents who know each other:

After we define the edges in the $k$ -acceptability graph:

we define $k$ -connected pairs recursively:

\begin{align*}\begin{array}{l} \textit {connected}(x,y,1) \leftarrow \textit {edge}(x,y) \qquad (x\neq y, k\gt 0). \\[3pt] \textit {connected}(x,y,i+1) \leftarrow \textit {connected}(x,z,i),\,\textit {edge}(z,y) \qquad (x\neq y, i\lt k). \end{array}\end{align*}

Breaking ties. Considering $k$ -connected pairs, ties in $\prec _{x}^{'}$ are broken:

\begin{equation*}\begin{array}{l} \textit {iprefer}(x,y,z) \leftarrow \textit {tie}(x,y,z),\,\textit {connected}(x,y,i),\,\textit {not}\ \textit { connected}(x,z,i). \\ \end{array}\end{equation*}

Defining the $k$ -extended preference lists $\prec _{x}^{k''}$ . Based on $\prec _{x}^{k}$ , we define the concept of may be acceptable agents $y$ ( $y \in A \backslash ( K_x \cup I_x) {\text{ and }} \{x,y\} \in P{^k}$ ) with degree $k$ :

Extending the preferences to define $k$ -matching. Based on the preferences of each agent in $\prec _{x}$ and $\prec _{x}^{'}$ , we define extended preferences in $\prec _{x}^{''}$ :

\begin{align*}\begin{array}{l} \textit {ePrefer}(x,y,z) \leftarrow \textit {prefer2}(x,y,z). \\[3pt] \textit {ePrefer}(x,y,z) \leftarrow \textit {iprefer}(x,y,z). \\[3pt] \textit {ePrefer}(x,y,z) \leftarrow \textit {prefer2}(x,\_,y),\,\textit {iprefer}(x,z,\_). \\[3pt] \textit {ePrefer}(x,z,x) \leftarrow \textit {iprefer}(x,\_,z),\,\textit {not}\ \textit {prefer2}(x,z,\_) \\ \end{array}\end{align*}

Based on the preferences of each agent in $\prec _{x}^{''}$ , we extend preferences by degree $k$ recursively:

Finally, we define the preferences of each agent in $\prec _{x}^{k''}$ :

\begin{align*}\begin{array}{l} \textit {kPrefer}(x,y,z) \leftarrow \textit {ePrefer}(x,y,z) \qquad (x\neq y). \\[3pt] \textit {kPrefer}(x,y,z) \leftarrow \textit {prefer}(x,y,z,i) \qquad (x\neq y,\,i\lt k+1). \\ \end{array}\end{align*}

$k$ -matching. A $k$ -Personalized-SRTI instance is characterized by $(A,{A^{-}},\prec ^{k''})$ where $A$ is a finite set of agent, $A^{-}$ is a finite set of unwanted pairs, and $\prec ^{k''}$ is the collection of the $k$ -extended preference list of each agent $x \in A$ . To solve a $k$ -Personalized-SRTI instance, that is to compute a $k$ -matching, we utilize SRTI-ASP (Erdem et al. Reference Erdem, Fidan, Manlove and Prosser2020) (as briefly described in Section 2.1) using the atoms of the form kPrefer $(x,y,z)$ instead of prefer2 $(x,y,z)$ .

5 Experimental evaluations

In our earlier work (Fidan and Erdem Reference Fidan and Erdem2021), we have experimentally evaluated our ASP-based method for Personalized-SRTI to better understand its scalability, usefulness, and applicability by utilizing the domain-specific knowledge inferred from the agents’ habits and habitual preferences.

In this study, we investigate the usefulness and the applicability of utilizing the knowledge about the networks of the agents’ preferred friends. We design and perform two types of experiments to study the following questions:

  1. Q1 When there is no stable matching to a given SRTI instance or a good-enough matching to its corresponding Personalized-SRTI instance that also considers the agents’ habitual preferences, can we compute good-enough matchings considering also the networks of the agents’ preferred friends?

  2. Q2 Does it make sense to compute good-enough matchings by considering the networks of the agents’ preferred friends?

In the first set of experiments (addressing Q1), we evaluate the usefulness of the additional knowledge about the networks of the agents’ preferred friends from the computational perspectives. We randomly generate instances and evaluate the results with respect to objective measures (i.e., how many more instances can be solved with this additional knowledge?).

In the second set of experiments (addressing Q2), we evaluate the usefulness of the additional knowledge from the perspective of the users. We perform polls, surveys, and interviews with students to obtain their feedback and use subjective measures to evaluate the results.

The full encoding and benchmark instances are made available on the following GitHub page: https://github.com/mugefidan/k-SRTI.git.

5.1 Experimental evaluation with objective measures

Benchmark instances. First we randomly generate SRTI instances using Prosser’s software (SRItoolkit 2019) based on Merten’s idea (Reference Mertens2005): (1) we generate a random graph ensemble $G(n,p)$ according to the Erdös-Rényi model (Reference Erdös and Rényi1960), where $n$ is the required number of agents and $p$ is the edge probability (i.e., each pair of vertices is connected independently with probability $p$ ); (2) since the edges characterize the acceptability relations, we generate a random permutation of each agent’s acceptable partners to provide the preference lists.

Then, motivated by the real-world applications, (3) in each SRTI instance, we shorten the given preference lists so as to contain the first 5 choices for each agent. Then, (4) we populate each instance to a set of Personalized-SRTI instances by extending these lists by including the choices inferred from the habitual preferences of agents: we consider 2 and 5 habitual criteria, randomly generate the importance of each criterion, and randomly generate the habitual preferences of 20% and 50% of agents.

For each instance generated with the method above, we define its completeness degree (c.d.) as the probability of an agent occurring in a preference list (i.e., the edge probability). We define the mutual acceptability rate (m.a.p.) of an instance as the ratio of the number of mutually acceptable pairs to the number of all possible pairs. Consider the example shown in Table 2. For a given $2$ -Personalized-SRTI instance, there are $14$ mutually acceptable pairs out of 16 possible pairs. There are two pairs, such as $\{a,c\}$ and $\{b,d\}$ , that are not mutually acceptable. Hence, the mutually acceptability rate is $\frac {14}{16}$ , which simplifies to $0.875$ .

We generate two sets of benchmarks, with respect to their m.a.p.: HMA instances have high m.a.p. of 75% or more, while LMA instances have lower m.a.p..

For HMA instances, first, as described in steps (1) and (2) above, we generate SRTI instances with 40, 60, 80, 100, 150, and 200 agents, with c.d. of 0.075, 0.05, 0.0375, 0.03, 0.02, and 0.015, respectively. Such low c.d. allow us to generate SRTI instances with preference lists with approximate length 3.

In our earlier study (Erdem et al. Reference Erdem, Fidan, Manlove and Prosser2020) that investigates the scalability of our approach to solve SRTI problems, we have already generated benchmark instances using Prosser’s software, as described in steps (1) and (2) above. For LMA instances, we start with those instances with 40, 60, 80, 100, 150, and 200 agents, and with c.d. 0.25.

Then, in each benchmark set, for each number of criteria and the percentage of agents who specify their habitual preferences, we populate each SRTI instance by generating 20 Personalized-SRTI instances, as described in steps (3) and (4) above.

The characteristics of each set of benchmarks are summarized in Tables 5 and 6. Consider, for instance, the first row of Table 5 that describes average values for 20 HMA instances with 40 agents. The SRTI instances (generated after steps (1), (2), and (3)) have an average c.d. of 0.073 and an average m.a.p. of 0.965. After step (4) where we add knowledge about the habitual preferences of 50% of agents by considering 5 criteria, the average c.d. increases to 0.207 while the average m.a.p. decreases to 0.757.

Table 5. HMA instances: average completeness degree (c.d.) and average percentage of mutually acceptability rate (m.a.p.)

Table 6. LMA instances: average completeness degree (c.d.) and average percentage of mutually acceptability rate (m.a.p.)

Experimental results. We have evaluated our method over these two sets of benchmarks to understand the usefulness of adding knowledge about agents’ networks of preferred friends.

Fig 2. Usefulness of $2$ -SRTI over SRTI.

When there is no stable matching to the seed SRTI instances, Figure 2 shows the computational benefit of extending the preference lists by only suitable candidates obtained from networks of preferred friends, considering $2$ -connected pairs (i.e., preferred friend of a preferred friend): while only some HMA instances have good-enough matchings, almost all LMA instances have good-enough matchings. This result is expected because, as the preferences lists are extended, we have a higher number of mutually acceptable pairs, and this allows exploring more number of potential matchings and thus increasing the chances of finding a good-enough solution.

When there is no stable matching to the seed SRTI instances and no good-enough solution after extending the preference lists considering only the agents’ habits and habitual preferences, Figure 3 shows that extending the preference lists by suitable candidates obtained from networks of preferred friends is still useful.

In these experiments, the scalability of SRTI-ASP for $k$ -SRTI is also observed (Figure 4): computing good-enough matchings usually takes a few seconds on a machine with Intel Xeon(R) W-2155 3.30 GHz CPU and 32 GB RAM.

Fig 3. Usefulness of $2$ -SRTI over Personalized-SRTI: (top) 2 criteria and (bottom) 5 criteria.

Fig 4. Scalability of SRTI-ASP in computation time, for $2$ -SRTI over Personalized-SRTI: (left) 2 criteria and (right) 5 criteria. Legend as in Figure 3.

5.2 Experimental evaluation with subjective measures

We evaluate the usefulness of the additional knowledge from the perspective of the users. We design and perform poll survey and interviews with students to obtain their feedback and use subjective measures to evaluate the results.

Online poll survey with students. The objective is to find out whether it makes sense to match roommates considering the networks of preferred friends. It includes one question to learn whether the students prefer to roommate with someone from the preference lists of their preferred friends, when the dormitory system cannot match them with any of their friends on their preference lists. The survey, shown in Figure 1, is conducted online with 101 students at Sabanci University. In the end, 76 students prefer option of extending their preference lists with their preferred friends’ preferences (i.e., option (a) in the poll).

Interviews with students. The objective is to get more detailed information about their poll answers and learn the underlying reasons of students’ answers. Face-to-face interviews are conducted with 20 volunteers (8 female and 12 male) with diverse academic backgrounds. Each interview session is done one-to-one, taking an average of $12-15$ minutes. Before the interview, each volunteer is informed about the objective and the process of the interview, and their permission is requested for recording the interviews. In the interview, the following questions are asked in an appropriate order based on their answers: “Why did you choose this option at the poll?”, “Can you say a little more about …?”, “Did you have such an experience?”, “What if …”, “Why do you think …?”. To provide concrete examples to illustrate the kinds of questions asked and the kinds of responses gathered, two interview transcripts are included in the supplementary material accompanying the paper at the TPLP archive.

Among the volunteers, 4 students have experienced to be roommates with a friend of their friend, positively. At the beginning of the interview, 14 volunteers have chosen option (a) of the poll, that is to be roommates with someone from the preference lists of their preferred friends. During the interview, 4 of the volunteers who chose option (b) of the poll, that is to be roommates with anyone, have changed their decision. According to their final decisions, 18 volunteers choose option (a).

Table 7 shows the volunteers’ reasons for choosing option (a) of the poll, that is to be roommates with someone from the preference lists of their preferred friends, and how many of them give the same reason. For instance, most of the volunteers (16 out of 18) indicate that they trust the person their friend prefers to be roommate with, instead of someone they do not know anything about.

Table 7. Out of 20 students, 14 students have chosen option (a), i.e., they prefer as roommates someone from the preference lists of their preferred friends, compared to anyone. The reasons they have provided for this decision, the number of students who have given the same reason for their decisions before the interview and changed their minds during/after the interview are also provided

Table 8 displays the volunteers’ reasons for choosing option (b) of the poll, that is to be roommates with anyone, and how many of them give this reason. There are 6 such students, and 4 of them have changed their decision during the interview. For instance, one volunteer have said “I may have some friends, who have friends I do not like, in my preference list.” As a follow-up question, we have asked “What if the dormitory system allows you to specify also the students you do not want to be matched with as roommates?”, and the volunteer changed their preference from option (b) to option (a).

Table 8. Out of 20 students, 6 students have chosen option (b), i.e., they prefer as roommates anyone compared to someone from the preference lists of their preferred friends. The reasons they have provided for this decision, the number of students who have given the same reason for their decisions before the interview and changed their minds during/after the interview are also provided

Experimental results: quantitative comparisons. Most of the students (75.2%) who participated in the online poll survey have chosen option (a) at the poll survey. This result illustrates that it makes sense to consider the preferred friends of preferred friends while assigning roommates and extending the preference lists with suitable candidates accordingly. On the other hand, only 10% of the volunteers in the interviews have chosen option (b).

Experimental results: qualitative comparisons. The reasons for choosing option (a), obtained from the students significantly coincide. For instance, getting assigned to a roommate from the preference lists of their preferred friends is preferable (compared to random assignment) because they would be more comfortable and get along well with each other. These results also indicate the usefulness of our knowledge-based approach from the users’ point of view.

6 Discussions

Finding a solution to every SRTI instance cannot be guaranteed, and, to address this limitation, we have introduced a knowledge-based method that extends the preference lists of agents with “suitable” candidates. In our earlier work, we have introduced a method for identifying such suitable candidates by considering the living styles and habitual preferences of students (e.g., smoking, studying). However, it might not always be sufficient to find such suitable candidates because of relevant but inaccessible knowledge about the students, due to ethical and fairness concerns. For instance, it would not be appropriate to ask questions in a roommate search questionnaire related to students’ political opinions, although people with similar ideas tend to get along better. As also observed in our surveys and interviews, the networks of preferred friends implicitly provide such valuable insights into potential compatibility between roommates, leading to personalized good-enough matchings for roommates.

Motivated by the promising empirical results of our emerging application, we plan to enrich our method with further types of relevant knowledge and deploy it at our university.

As mentioned in the introduction, when an SRTI instance does not have a stable matching, alternative approaches “relax” the notion of stability (e.g., almost stability, sticky stability, popularity). Our approach of finding “good-enough” matchings by extending preference lists is orthogonal to these approaches. Investigations of combining these two different approaches is a part of our ongoing work.

Acknowledgments

We would like to thank the participants of the poll survey and interviews for their participation and valuable feedback, Baturay Yilmaz for helpful discussions, and the anonymous reviewers for their valuable comments.

Competing interests

The authors declare no competing interests.

Supplementary material

The supplementary material for this article can be found at https://doi.org/10.1017/S1471068425100252.

References

Abraham, D. J., Biró, P. and Manlove, D. F. 2005. “Almost stable” matchings in the roommates problem. In International Workshop on Approximation and Online Algorithms, Springer, 114.Google Scholar
Afacan, M. O., Aliogullari, Z. H. and Barlo, M. 2016. Sticky matching in school choice. Economic Theory 64, 3, 509538.CrossRefGoogle Scholar
Aziz, H., Csáji, G. and Cseh, Á. 2023. Computational complexity of k-stable matchings. In International Symposium on Algorithmic Game Theory, Springer, 311328.Google Scholar
Brewka, G., Eiter, T. and Truszczynski, M. 2016. Answer set programming: An introduction to the special issue. AI Magazine 37, 3, 56.CrossRefGoogle Scholar
Erdem, E., Fidan, M., Manlove, D. and Prosser, P. 2020. A general framework for stable roommates problems using answer set programming. Theory and Practice of Logic Programming 20, 6, 911925.CrossRefGoogle Scholar
Erdös, P. and Rényi, A. 1960. On the evolution of random graphs. In Publication of the Mathematical Institute of the Hungarian Academy of Sciences, 5, 1761.Google Scholar
Fidan, M. and Erdem, E. 2021. Knowledge-based stable roommates problem: A real-world application. Theory and Practice of Logic Programming 21, 6, 852869.CrossRefGoogle Scholar
Gale, D. and Shapley, L. 1962. College admissions and the stability of marriage. The American Mathematical Monthly 69, 1, 915.CrossRefGoogle Scholar
Gärdenfors, P. 1975. Match making: Assignments based on bilateral preferences. Systems Research and Behavioral Science 20, 166173.Google Scholar
Gusfield, D. and Irving, R. W. 1989. The Stable Marriage Problem: Structure and Algorithms. MIT Press, Cambridge, MA, USA.Google Scholar
Irving, R. W. and Manlove, D. F. 2002. The stable roommates problem with ties. Journal of Algorithms 43, 1, 85105.CrossRefGoogle Scholar
Kavitha, T. and Vaish, R. 2023. Semi-popular matchings and copeland winners. In Proc. of AAMAS 2023, 957965. International Foundation for Autonomous Agents and Multiagent Systems.Google Scholar
Lifschitz, V. 2002. Answer set programming and plan generation. Artificial Intelligence 138, 3954.CrossRefGoogle Scholar
Marek, V. and Truszczyński, M. 1999. Stable models and an alternative logic programming paradigm. In The Logic Programming Paradigm: A 25-Year Perspective. Springer Verlag, 375398.CrossRefGoogle Scholar
Mertens, S. 2005. Random stable matchings. Journal of Statistical Mechanics: Theory and Experiment 2005, 10, P10008.CrossRefGoogle Scholar
Niemelä, I. 1999. Logic programs with stable model semantics as a constraint programming paradigm. Annals of Mathematics and Artificial Intelligence 25, 241273.CrossRefGoogle Scholar
Ronn, E. 1990. NP-complete stable matching problems. Journal of Algorithms 11, 2, 285304.CrossRefGoogle Scholar
Sritoolkit. 2019. https://www.dcs.gla.ac.uk/~pat/roommates/distribution/. [Accessed on November 21, 2019].Google Scholar
Thakur, A. 2021. Combining social choice and matching theory to understand institutional stability. ECONtribute Discussion Paper 085, University of Bonn and University of Cologne, Germany.Google Scholar
Figure 0

Fig 1. A poll survey given to a set of students at Sabanci University, to find out whether the student prefers as roommate (a) someone from the preference lists of their preferred friends, or (b) anyone.

Figure 1

Table 1. A Personalized-SRTI instance, characterized by a set of students $x$, and their extended preference lists $\prec _{x}^{''}$

Figure 2

Table 2. A $k$-Personalized-SRTI instance, characterized by a set of students $x$, sets $A_x^{-}$ of unwanted students as roommates, and the $k$-extended lists $\prec _{x}^{k''}$ of preferred students as roommates for $k=1$ and $k=2$

Figure 3

Table 3. A $k$-Personalized-SRTI instance, characterized by a set of students $x$, sets $A_x^{-}$ of unwanted students as roommates, and the $k$-extended lists $\prec _{x}^{k''}$ of preferred students as roommates for $k=1$ and $k=2$

Figure 4

Table 4. A $k$-Personalized-SRTI instance, characterized by a set of students $x$, sets $A_x^{-}$ of unwanted students as roommates, and the $k$-extended lists $\prec _{x}^{1''}$ of preferred students as roommates for $k=1$

Figure 5

Table 5. HMA instances: average completeness degree (c.d.) and average percentage of mutually acceptability rate (m.a.p.)

Figure 6

Table 6. LMA instances: average completeness degree (c.d.) and average percentage of mutually acceptability rate (m.a.p.)

Figure 7

Fig 2. Usefulness of $2$-SRTI over SRTI.

Figure 8

Fig 3. Usefulness of $2$-SRTI over Personalized-SRTI: (top) 2 criteria and (bottom) 5 criteria.

Figure 9

Fig 4. Scalability of SRTI-ASP in computation time, for $2$-SRTI over Personalized-SRTI: (left) 2 criteria and (right) 5 criteria. Legend as in Figure 3.

Figure 10

Table 7. Out of 20 students, 14 students have chosen option (a), i.e., they prefer as roommates someone from the preference lists of their preferred friends, compared to anyone. The reasons they have provided for this decision, the number of students who have given the same reason for their decisions before the interview and changed their minds during/after the interview are also provided

Figure 11

Table 8. Out of 20 students, 6 students have chosen option (b), i.e., they prefer as roommates anyone compared to someone from the preference lists of their preferred friends. The reasons they have provided for this decision, the number of students who have given the same reason for their decisions before the interview and changed their minds during/after the interview are also provided

Supplementary material: File

Fidan and Erdem supplementary material

Fidan and Erdem supplementary material
Download Fidan and Erdem supplementary material(File)
File 96.4 KB