A General Framework for Stable Roommates Problems using Answer Set Programming

The Stable Roommates problem (SR) is characterized by the preferences 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 so that each pair shares a room, and there is no pair of agents that would block this matching (i.e., who prefers the other to their roommate in the matching). There are interesting variations of SR that are motivated by applications (e.g., the preference lists may be incomplete (SRI) and involve ties (SRTI)), and that try to find a more fair solution (e.g., Egalitarian SR). Unlike the Stable Marriage problem, every SR instance is not guaranteed to have a solution. For that reason, there are also variations of SR that try to find a good-enough solution (e.g., Almost SR). Most of these variations are NP-hard. We introduce a formal framework, called SRTI-ASP, utilizing the logic programming paradigm Answer Set Programming, that is provable and general enough to solve many of such variations of SR. Our empirical analysis shows that SRTI-ASP is also promising for applications. This paper is under consideration for acceptance in TPLP.


Introduction
The Stable Roommates problem (Gale and Shapley 1962) (SR) is a matching problem (wellstudied 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).
SR is an interesting computational problem, not only due to its applications (e.g., for pairing in large-scale chess competitions (Kujansuu et al. 1999), for campus house allocation (Arkin et al. 2009), pairwise kidney exchange (Roth et al. 2005), creating partnerships in P2P networks (Gai et al. 2007)) but also due to its computational properties described below.
Incomplete preference lists with ties. Upon a question posed by Knuth (1997) in 1976 about the existence of an algorithm for SR, Irving (1985) developed a linear-time algorithm for SR. Meanwhile, researchers have started investigating variations of SR motivated by further observations and applications. For instance, in practice (like large-scale chess tournaments), agents 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 1989), with preference lists including ties (SRT) (Ronn 1990), and with incomplete preference lists including ties (SRTI) (Irving and Manlove 2002). Interestingly, some of these slight variations (i.e., the existence of a stable matching in SRT and SRTI) are proven to be NP-complete (Table 1).
Stable and more fair solutions. With the motivation of finding more fair stable solutions, variations of SR have been studied. For instance, Egalitarian SR aims to maximize the total satisfaction of preferences of all agents; it is NP-hard (Feder 1992). Rank Maximal SRI aims to maximize the number of agents matched with their first preference, and then, subject to this condition, to maximize the number of agents matched with their second preference, and so on; it is also NP-hard (Cooper 2020).
Not stable but good-enough solutions. As first noted by Gale and Shapley (1962), unlike the 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). When an SR instance does not have a stable solution, variations of SR have been studied to find a good-enough solution. Almost SR aims to minimize the total number of blocking pairs (i.e., pairs of agents who prefer each other to their roommates); it is NP-hard (Abraham et al. 2005).
Alongside these interests in SR, some exact methods and software (SRItoolkit 2019; Match-ingToolkit 2020) have been developed to solve SR and SRI (both solvable in poly-time) using Constraint Programming (CP) (Prosser 2014), and based on Irving's algorithm (Irving 1985). However, to the best of the authors' knowledge, there is no exact method (except for the enumeration based method for Egalitarian SRI) and implementation, that provides a solution to any intractable variation of SR, described in three groups above.
Our Contributions. We introduce a formal framework and its implementation, called SRTI-ASP, that are general enough to provide solutions to all variations of SR mentioned above, including the intractable decision/optimization versions: SRT, SRTI, Egalitarian SRTI, Rank Maximal SRTI, Almost SRTI. SRTI-ASP provides a flexible framework to study variations of SR.
SRTI-ASP utilizes a logic programming paradigm, called Answer Set Programming (ASP) (Brewka et al. 2016), to declaratively solve stable roommates problems. We represent SRI and its variations in the expressive formalism of ASP, and SRTI-ASP computes models of these formulations using the ASP solver CLINGO (Gebser et al. 2011). For each variation of SR, given a problem instance, SRTI-ASP returns a solution (or all solutions) if one exists; otherwise, it returns that the problem does not have a solution. We prove that SRTI-ASP is sound and complete (Theorem 1).
We have evaluated SRTI-ASP over different sizes of SRI instances (randomly generated with the software (SRItoolkit 2019), called SRI-CP from now on) to understand its scalability, as the input size, and the degree of completeness of preference lists increase. We have developed a method to add ties to these instances, and empirically analyzed the scalability of SRTI-ASP on SRTI instances as well.
We have compared SRTI-ASP with SRI-CP, over SRI instances. We have also investigated the use of SRI-CP to solve Egalitarian SRI, Rank Maximal SRI and Almost SRI based on enumeration-based brute-force methods, and compared SRTI-ASP with these methods.
In addition, we have compared SRTI-ASP with the ASP method proposed by Amendola (2018) for SR (called SR-AF from now on) based on Argumentation Framework (AF) (Dung 1995), over SR instances.

Stable Roommates Problems
Let us start with defining the Stable Roommate problem with Incomplete lists (SRI). Let A be a finite set of agents. For every agent x ∈ A, let ≺ x be a strict and total ordering of preferences over a subset A x of A\{x}. We refer to ≺ x as agent x's preference list. For two agents y and z, we denote by y ≺ x z that x prefers y to z. Since the ordering of preferences is strict and total, for every agent x ∈ A, for every two distinct agents y and z in A x , either y ≺ x z or z ≺ x y. Note that the preferences of agents with respect to ≺ x are transitive and asymmetric. If an agent x is in y's preference list, then x is called acceptable to y. We denote by ≺ the collection of all preference lists.
A matching for a given SRI instance is a function M : A → A such that, for all {x, y} ⊆ A such that x ∈ A y and y ∈ 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} ⊆ A (x = y) if B1 both agents x and y are acceptable to each other, B2 x is single with respect to M, or y ≺ x M(x), and B3 y is single with respect to M, or x ≺ y M(y).
A matching for SRI is called stable if it is not blocked by any pair of agents. Fig. 1 illustrates three examples for SRI. The Stable Roommates problem (SR) is a special case of SRI where the preference orderings are strict and complete (i.e., for every agent x ∈ A, A x =A \ {x}), and |A| is even.
Ties. The Stable Roommates problem with Ties and Incomplete Lists (SRTI) is a variation of SRI where the preference lists are partial orderings and where incomparability is transitive. 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 ∼ x z, if y ≺ x z and z ≺ x y. There are three levels of stability (Irving and Manlove 2002): weak stability, strong stability, and super stability. We will focus on weak stability in this paper, since it is a harder problem compared to the other two versions (Table 1). Relative to weak stability, a pair {x, y} of agents blocks a matching M if conditions B1-B3 hold.
The Stable Roommates problem with Ties (SRT) is a special case of SRTI where the preference ordering of each agent x is over A \ {x} and complete, and |A| is even.
Note that, while the problems SR and SRI are in P, SRT and SRTI under weak stability are NP-complete (Table 1).
Fairness. When an SRI instance has many stable matchings, it may be useful to identify a stable matching that is fair to all agents. Different fairness criteria on top of stability have led to optimization variations of SRI.
Let M denote the set of all stable matchings of a given SRI instance (A, ≺). For every agent x and every agent y ∈ A x , let rank(x, y) denote the rank of agent y in the preference list A x of agent x. We assume that agents prefer matching with a roommate: for every agent x, let rank(x, x) be a number larger than rank(x, y) for every y ∈ A x .
Egalitarian SRI aims to maximize the total satisfaction of preferences of all agents. Let M be a matching. For every agent x, we define the satisfaction c M (x) of x's preferences with respect to M as follows: c M (x)=I if rank(x, M(x))=I. Then the total satisfaction of preferences of all agents is defined as follows: c(M) = ∑ x∈A c M (x). Note that for SRI, all matching M have the same number of contributions of rank(x, x) values to c(M). Since the preferred agents have lower rankings, the total satisfaction of preferences of all agents is maximized when c(M) is minimized. Then, a matching M∈M with the minimum c(M) is egalitarian.
Rank Maximal SRI considers different fairness criterion: it aims to maximize the number of agents matched with their first preferences, and then, subject to this condition, to maximize the number of agents matched with their second preference, and so on. We start with the set M of all matchings of a given SRI instance (A, ≺), and define a series of subsets M max (i) of these matchings where the maximum number of agents are matched with their i'th preferences: Consider the SRI instance sri8 illustrated in Fig. 1, with two stable matchings. Stable matching M 1 is egalitarian and M 2 is rank-maximal.
Almost stable. Unlike the Stable Marriage problem, there is no guarantee to find a solution to every SRI problem instance (cf. sri4 in Fig. 1). When an SRI instance does not have a stable matching, further variations of SRI have been studied to find a good-enough solution.
Almost SRI aims to minimize the total number of blocking pairs. Let bp M (x, y) denote the set of blocking pairs of a given matching M. A matching M∈M is almost stable if it is blocked by the minimum number |bp M (x, y)| of pairs.

Answer Set Programming
SRTI-ASP utilizes Answer Set Programming (ASP) (Brewka et al. 2016) to declaratively solve stable roommates problems. The idea of problem solving with ASP is (1) to represent the given problem by a program whose answer sets (Gelfond and Lifschitz 1988;Gelfond and Lifschitz 1991) characterize the solutions of the problem, and (2) to solve the problem using answer set solvers, like CLINGO (Gebser et al. 2011).
Why ASP? We use ASP as an underlying paradigm for modeling and solving stable roommates problems for the following reasons. (1) Deciding whether a program in ASP has an answer set is NP-complete (Dantsin et al. 2001), so ASP is expressive enough for solving hard SR problems.
(2) ASP has expressive languages with a rich set of utilities, such as nondeterministic choices, hard constraints, weighted weak constraints with priorities, and thus allow us to easily formulate different variations of SR. (3) Efficient ASP solvers, like CLINGO, supports these utilities. (4) Such an elaboration tolerant (McCarthy 1998) representation framework and flexible software environment are useful in studying and understanding variations of SR in different applications. (5) Due to declarative problem solving in the formal framework of ASP, we can easily prove the soundness and completeness of SRTI-ASP (see Theorem 1).
Programs in ASP Let us briefly describe the syntax of programs and useful constructs used in the paper. We consider ASP programs that consist of rules of the form where n ≥ m ≥ 0, Head is an atom or ⊥, and each A i is an atom. A rule is called a fact if m = n = 0 and a (hard) constraint if Head is ⊥. Cardinality expressions are special constructs of the form l{A 1 , . . . , A k }u where each A i is an atom and l and u are nonnegative integers denoting the lower and upper bounds (Simons et al. 2002). Programs using these constructs can be viewed as abbreviations for programs that consist of rules of the form (1). Such an expression describes the subsets of the set {A 1 , . . . , A k } whose cardinalities are at least l and at most u. Cardinality expressions can be used in heads of rules; then they generate many answer sets whose cardinality is at least l and at most u.
Schematic variables A group of rules that follow a pattern can be often described in a compact way using "schematic variables". For instance, the cardinality expression 1{p 1 , . . . , p 7 }1 can be represented as 1{p(i) : index(i)}1, along with a definition of index(i) that describes the ranges of variables: index(1..7).
Weighted weak constraints with priorities The ASP programs can be augmented with "weak constraints"-expressions of the following form (Buccafurri et al. 2000): Here, Body(t 1 , ...,t n ) is a formula (as in the body of a rule) with the terms t 1 , ...,t n . Intuitively, whenever an answer set for a program satisfies Body(t 1 , ...,t n ), the tuple t 1 , ...,t n contributes a cost of w to the total cost function of priority p. The ASP solver tries to find an answer set with the minimum total cost. For instance, the following weak constraint instructs CLINGO to compute an answer set that does not include both p(i) and p(i + 1), if possible. However, if CLINGO cannot find such an answer set, it is allowed to compute an answer set with these atoms p(i) and p(i + 1) but with an additional cost of 1 per each such i. Weak constraints are considered by CLINGO according to their priorities.

Solving SRI using ASP
We formalize the input I = (A, ≺) of an SRI instance in ASP 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 ≺ x z "). For instance, the preference list of agent a in sri4 of Fig. 1 is described by the following facts: prefer2(a, b, c). prefer2(a, c, d).
For every agent x, since x prefers being matched with a roommate y in A x instead of being single, for every y ∈ A x , we also add facts of the form prefer2(x, y, x). For the example above, the input also includes the facts: prefer2(a, b, a). prefer2(a, c, a). prefer2(a, d, a).
In the ASP formulation P of SRI, the variables x, y, z and w denote agents in A. The program P starts with the definition of preferences of agents with respect to ≺ x : prefer(x, y, z) ← prefer2(x, y, z). prefer(x, y, z) ← prefer2(x, y, w), prefer(x, w, z). (2) The first rule expresses that being single is the least preferred option. The second rule expresses that the preference relation is transitive.
Based on the preferences of agents, we define the concept of acceptability for each agent: accept(x, y) ← prefer(x, y, ). accept(x, y) ← prefer(x, , y).
The output M : A → A of an SRI instance is characterized by atoms of the form room(x, y) ("agents x and y are roommates"). The ASP formulation P of SRI first generates pairs of roommates. For every agent x, exactly one mutual acceptable agent y is nondeterministically chosen as M(x) by the choice rules: 1{room(x, y):agent(y), accept2(x, y)}1 ← agent(x).
Here, the roommate relation is symmetric: ← room(x, y), not room(y, x).
The agents who are not matched with a roommate are single agents: Then, the stability of the generated matching is ensured by the hard constraints: Here, atoms of the form block(x, y) describe the blocking pairs (i.e., conditions B1-B3): block(x, y) ← accept2(x, y), single(x), single(y), not room(x, y). (x = y) block(x, y) ← accept2(x, y), single(x), like(y, x), not room(x, y). (x = y) block(x, y) ← accept2(x, y), like(x, y), single(y), not room(x, y). (x = y) block(x, y) ← accept2(x, y), like(x, y), like(y, x), not room(x, y). (x = y) where x =y in each rule, and atoms like(x, y) describe that agent x prefers agent y to her/his roommate x = M(x): Given the ASP formulation P whose rules are described above and the ASP description F I of an SRI instance I, the ASP solver CLINGO generates a stable matching (or all stable matchings), if one exists; otherwise, it returns that there is no solution. This is possible since the ASP program P (i.e., (2)-(10)) is sound and complete.

Theorem 1
Given an SRI instance I = (A, ≺), for each answer set S for P ∪ F I , the set of atoms of the form room(x, y) in S encodes a stable matching M : A → A to the SRI problem instance. Conversely, each stable matching for the given SRI instance corresponds to a single answer set for P ∪ F I .

Proof
First, we show that the answer set for (2)-(4) correctly describes the acceptability relation.
1. Due to Proposition 4 of Erdem and Lifschitz (2003) about the correctness of the transitive closure definition, the answer set X 0 for (2) correctly defines preferences of each agent x (by means of atoms of the prefer(x, y, z)). (2004), adding (3) to (2) conservatively extends X 0 to X 1 , which also describes the preference lists for each agent x (by means of atoms of the accept(x, y)). 3. Due to Proposition 3 of Erdogan and Lifschitz (2004), adding (4) to (2) ∪ (3) conservatively extends X 1 to X. 4. The answer set X describes the acceptability of every pair of agents x and y to each other (by means of atoms of the accept2(x, y)).

Due to Proposition 3 of Erdogan and Lifschitz
Next, we show that the answer set for (2)-(6) correctly characterizes a matching.
1. We use the splitting set theorem (Erdogan and Lifschitz 2004;Lifschitz and Turner 1994): Let Π be the program (2)-(5), and the splitting set U be the set of atoms of the form prefer(x, y, z), accept(x, y), and accept2(x, y). 2. The bottom b U (Π) consists of (2)-(4), and the top part consists of rules (5).
3. Every answer set Y for the top part e U (Π \ b U (Π), X) evaluated with respect to X, describes a function, via atoms of the form room(x, y), which maps every agent x to exactly one agent y so that x and y are acceptable to each other (when accept2(x, y) ∈ X). Moreover, every such mapping can be characterized by a unique answer set for e U (Π \ b U (Π), X). 4. According to the splitting set theorem, X ∪Y is an answer set for (2)-(5). 5. Then, X ∪ Y describes a mapping between acceptable pairs of agents. The symmetry of this mapping is guaranteed by (6), using Proposition 2 of Erdogan and Lifschitz (2004), leading to a matching. 6. Therefore, there is a one-to-one correspondence between the answer sets for (2)-(6) and the matchings between acceptable pairs of agents.
Next, using Proposition 3 of Erdogan and Lifschitz (2004) three times, we show that adding definitions (7), (10), and (9) to (2)-(6) one by one conservatively extends the answer sets for (2)-(6), by describing singles (by means of atoms of the single(x)), preferences y of every agent x over her/his roommate (by means of atoms of the like(x, y, z)), and then blocking pairs (by means of atoms of the block(x, y)).
Finally, we show that stability is guaranteed by (8), using Proposition 2 of Erdogan and Lifschitz (2004). Therefore, there is a one-to-one correspondence between every answer set S for (2)-(8) and every stable matching.
Ties (weak stability). As noted by Cseh (2019), relative to weak stability, stability in SRTI instances can be defined in exactly the same way as for SRI. Therefore, we can use the SRI formulation P to solve SRTI instances too.
Fairness. Let us describe the ranks of agents by a set of facts using atoms of the form rank(x, y, i) ("the rank of agent y according to agent x's preferences is i"). For each agent x, since x's preference ordering ≺ x is total, we can define the ranks as follows: the i'th agent in the preference list A x of x has rank i, and x has a rank larger than the ranks of i. rank(x, b, 1) ← #count{a : prefer(x, a, b), a = b}=0, accept(x, b) rank(x, b, i) ← rank(x, a, i−1), prefer(x, a, b), #count{c : prefer(x, a, c), prefer(x, c, b), c = a, c = b}=0 (a = b, i > 1) Egalitarian SRI aims to maximize the total satisfaction of preferences of all agents by a matching M. The satisfaction c M (x) of an agent x's preferences with respect to M is defined as the rank of M(x). Since more preferred agents have lower ranks, the total satisfaction of preferences of all agents is maximized when c(M)= ∑ x∈A c M (x) is minimized. Therefore, to solve Egalitarian SRI, we simply add to the SRI formulation P, the weighted weak constraints: ∼ ← room(x, y), rank(x, y, r). [r@1, x] which instruct CLINGO to minimize the sum of the ranks r of roommates.
Rank Maximal SRI tries to maximize the number of agents matched with their first preferences, and, subject to this condition, tries to maximize the number of agents matched with their second preferences, and so on. Such an iterative definition can be modeled elegantly by the following weak constraints: ∼ ← room(x, y), rank(x, y, r). [−1@|A| − r, x, y] (x = y) Note that the priorities of these weak constraints are defined as |A| − r for every pair of roommates {x, y} (x = y), where rank(x, y) = r. As the rank changes from 1 to |A| − 1, the priority decreases. The ASP solver CLINGO handles weak constraints with respect to their priorities. On the other hand, note that the weights of these weak constraints are specified as -1 for every pair of roommates {x, y} (x = y). Therefore, CLINGO first considers the highest priority |A| − 1, and tries to minimize the total weights of agents matched with their first preferences. Then, CLINGO considers the next highest priority |A| − 2, and further tries to minimize the total weights of agents matched with their second preferences, and so on. In this way, CLINGO finds a rank maximal stable matching.
Almost stable. Almost SRI aims to minimize the total number of blocking pairs for a matching M.
For that, we simply replace the hard constraint (8) that ensures stability, with the following weak constraints in our ASP formulation P of SRI: Elaboration tolerance. According to McCarthy (1998), a representation is elaboration tolerant to the extent that it is convenient to modify a set of formulas expressed in the formalism to take into account new phenomena, and the simplest kind of elaboration is the addition of new formulas.
In that sense, our representation P of SRI is elaboration tolerant to variations of SRI, since the program P is not changed at all (e.g., we add new rules to P for Egalitarian SRI) or it is changed minimally (e.g., we replace a hard constraint by a weak constraint for Almost SRI).

Experimental Evaluations
We have experimentally evaluated SRTI-ASP to understand its scalability over intractable SRTI problems, and how it compares with two closely related methods over tractable SR problems.
Setup. We have generated instances using the random instance generator that comes with SRI-CP. It is based on the following idea (Mertens 2005): 1) generate a random graph ensemble G(n, p) according to the Erdos-Renyi model (Erdös and Rényi 1960), 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, generate a random permutation of each agents acceptable partners to provide the preference lists. We define the completeness degree for an instance as the percentage p * 100.
In our experiments, we have used CLINGO (Version 5.2.2) on a machine with Intel Xeon(R) W-2155 3.30GHz CPU and 32GB RAM.
Scalability of SRTI-ASP: SRI and its variations. We have generated instances of different sizes, where the number of agents are 20, 40, 60, 80,100, 150 and 200, and the completeness degrees are 25%, 50%, 75% and 100%. For each number of agents and for each completeness degree, we have generated 20 instances. We have experimented with these randomly generated instances to analyze the scalability of SRTI-ASP for SRI, Egalitarian SRI, Rank Maximal SRI, and Almost SRI. The results are shown in Table 2. We make the following observations from this table: O1 The computation times for finding a stable matching (if one exists) and finding out that there exists no stable matching are comparable to each other.
Consider, for instance, the completeness degree 25%, and 80 agents. For 13 (out of 20) instances, the average CPU time to compute a stable matching is 0.167 seconds. For the remaining 7 instances, the average CPU time to find that a stable matching does not exist is 0.183 seconds. These timings are comparable to each other. O2 Computing an egalitarian stable matching generally takes slightly less time than computing a rank maximal stable matching.
For instance, for the 13 instances with a stable matching, computing egalitarian stable matchings takes on average 0.255 seconds; computing rank maximal stable matchings takes a similar amount of time, 0.256 seconds. For larger instances, we can observe that the latter takes a bit more time.
O3 Computing an almost stable matching significantly takes more time, compared to computing an egalitarian or a rank maximal stable matching. O4 Solving the optimization variants of SRI takes significantly more time, compared to solving SRI.
For instance, for the 7 instances without any stable matching, computing almost stable matchings takes in 4.416 seconds on average. Fig. 2. Comparison of SRI with its optimization variants, when the completeness degree is 50%.
The observations O2 and O3 are interesting, considering all the three optimization variations of SRI are NP-hard. Though, the observation O4 (better illustrated in Fig. 2) is not surprising, considering that SRI is in P (Table 1).
We can can further observe the following about scalability: O5 As the completeness degree increases, the computation times increase. O6 As the number of agents increases, the computation times increase.
Scalability of SRTI-ASP: SRI vs. SRTI. To experiment with SRTI-ASP on SRTI instances (under weak stability), we have randomly generated ties for the randomly generated SRI instances with the completeness degree 25%. For each agent x, we have 1) identified the set T of agents that are not acceptable to x and vice versa, and randomly picked one of these agents, say y, 2) identified the set U of agents that are acceptable to x and vice versa, and randomly picked one of these agents, say z, and 3) added y in preference list of x so that x is indifferent between y and z.
We have added ties as many as 25%, 50%, 75%, 100% of the number of agents. The results of these experiments are shown in Table 3. We can observe the following: O7 Solving SRTI takes significantly more time, compared to solving SRI. O8 SRI instances that do not have any stable matching, often have stable matchings after ties are added.
The observation O7 is expected, since SRTI is NP-complete whereas SRI is in P (Table 1). O8 is reasonable since adding ties reduces the number of potential blocking pairs in general, and thus allows SRTI-ASP to explore more possibilities.
Scalability of SRTI-ASP vs. SRI-CP. We have experimented with SRI-CP (SRItoolkit 2019), which utilizes the CP solver CHOCO (Version 2.1.5), on the SRI instances generated by SRI-CP's random instance generator. The results for 80-200 agents are shown in Table 4.
O9 For large SRI instances, SRI-CP performs significantly better than SRTI-ASP.
This observation has led to the following idea (mentioned by Prosser (2014)) for SRI instances that have stable matchings: "Can we solve Egalitarian SRI faster than SRTI-ASP, by first enumerating all stable matchings using SRI-CP, and then finding the optimal one?" We have noticed that the instances (generated by the random instance generator of SRI-CP) generally have one or two stable matchings. In that case, the answer to this question is Yes. This observation contradicts with the theoretical result on the NP-hardness of Egalitarian SRI. So we have generated some instances with more stable matchings. For example, for an instance (sri90) with 90 agents and with more than 9 million stable matchings, SRTI-ASP takes 1.75 seconds to find an egalitarian stable matching whereas SRI-CP can not enumerate all these solutions (due to fast consumption of memory). For SRI instances with many stable matchings, it may be better to use SRTI-ASP to solve Egalitarian SRI; further investigations are planned as part of our future work. Meanwhile, we have investigated a similar question for SRI instances that do not have any stable matching: "Can we solve Almost SRI instances with n agents faster than SRTI-ASP, by checking whether removing n 2 , n 4 , .. agents (i.e., potential blocking pairs) leads to a stable matching?" We have observed that, for small SRI instances with one blocking pairs, the answer to this question is Yes: If we remove two agents, then we can find a stable matching. For larger instances with many blocking pairs, the answer is negative. For example, for an instance (sri60a) with 60 agents, that does not have any stable matching, we have observed that SRTI-ASP finds an almost stable matching with 10 blocking pairs in 9.057 seconds. With the enumerate-test method mentioned in the question, we have to enumerate 60 2 + 60 4 + ... + 60 10 (more than 7×10 10 ) instances, and check them one by one using SRI-CP until an almost stable matching is found. Assuming that SRI-CP takes 0.001 seconds per instance, in the worst case we will have to test all 7×10 10 instances, and it will take at least 2 years. This observation confirms with the theoretical result on the NP-hardness of Almost SRI; further investigations are planned as part of our future work.
Scalability of SRTI-ASP vs. SR-AF The ASP-based method SR-AF (Amendola 2018) utilizes abstract argumentation frameworks (Dung 1995) for the Stable Marriage problem. According to SR-AF, an argumentation framework AF=(Arg, Att) models an SR instance if the arguments in Arg are pairs of different agents, and the attacks ((a, b), (x, y)) in Att ⊆ Arg×Arg satisfy the following properties: (i) x = a and b ≺ x y, or (ii) y = b and a ≺ y x. For every SR instance, once the arguments and attacks are generated, they are translated into a program P AF using the existing methods (Wu et al. 2009). In particular, for every argument (a, b) in AF, if (x 1 , y 1 ), (x 2 , y 2 ), . . . , (x m , y m ) are the arguments that attack (a, b), the following rule is included in P AF : in(a, b) ← not in(x 1 , y 1 ), not in(x 2 , y 2 ), . . . , not in(x m , y m ).
There is a one-to-one correspondence between the answer sets for the program P AF and the stable extensions of AF, due to Theorem 2 of Amendola (2018).
We have extended SR-AF's argumentation framework from SR to SRI, by defining the arguments as pairs of agents that are acceptable to each other. implemented (in Python) the transformation of an SRI instance into an argumentation framework AF and then to a program P AF . We have experimented with this extended SR-AF (called SRI-AF from now on) on the SR instances generated by SRI-CP's random instance generator. The results are shown in Table 5.
O10 For large SRI instances, SRI-AF performs significantly better than SRTI-ASP.