We study a variation of the Stable Marriage problem, where every man and every woman express their preferences as preference lists which may be incomplete and contain ties. This problem is called the Stable Marriage problem with Ties and Incomplete preferences (SMTI). We consider three optimization variants of SMTI, Max Cardinality, Sex-Equal and Egalitarian, and empirically compare the following methods to solve them: Answer Set Programming, Constraint Programming, Integer Linear Programming. For Max Cardinality, we compare these methods with Local Search methods as well. We also empirically compare Answer Set Programming with Propositional Satisfiability, for SMTI instances. This paper is under consideration for acceptance in Theory and Practice of Logic Programming (TPLP).READ FULL TEXT VIEW PDF
Matching problems have been studied in economics, starting with the seminal paper of gale1962college, which has led to a Nobel Prize in 2012, utilizing game theory methods with the goal of a mechanism design. Matching problems are about markets where individuals are matched with individuals, firms, or items, typically across two sides, as in employment[A. E. Roth and M. Sotomayor (1992)] (e.g., who works at which job), kidney donation (e.g., who receives which transplantable organ) [D. F. Manlove and G. O’malley (2015), A. E. Roth, T. Sonmez, and M. Utku Unver (2005)], and marriages [K. Iwama, S. Miyazaki, Y. Morita, and D. Manlove (1999), D. Gale and L. S. Shapley (1962)] (e.g., who marries with whom). In each problem, preferences of individuals, firms, or items are given, possibly along with other information (e.g., the quotas of the universities in university entrance) [A. Alkan and H. Moulin (2003), A. Alkan and D. Gale (2003)].
One of the well-known matching problems is the Stable Marriage Problem (SM). In SM, for a set of men and women, we are given the preferences of individuals: for each man, a complete ranking of the women is specified as preferred partners; similarly, for each woman, a complete ranking of the men is specified as preferred partners. The goal is to marry all men and women (i.e., to find couples) in such a way that marriages are stable: no man and woman in different couples prefer each other to their partners.
We consider a variant of SM, called SMTI, where rankings may be incomplete (i.e., some partners are not acceptable) or may include ties (i.e., some partners are preferred equally). We investigate three hard variants of SMTI [A. Kato (1993), D. F. Manlove, R. W. Irving, K. Iwama, S. Miyazaki, and Y. Morita (2002)], that aim to compute optimal stable matchings with respect to different measures of fairness: sex-equality (preferences of men and women are considered to be equally important), egalitarian (preferences of every individual are considered to be equally important), maximum cardinality (minimizes the number of singles).
We present a variety of methods to solve these problems, using Answer Set Programming (ASP) [V. W. Marek and M. Truszczyński (1999), I. Niemelae (1999), V. Lifschitz (2002), P. Simons, I. Niemelae, and T. Soininen (2002), G. Brewka, T. Eiter, and M. Truszczynski (2016)], Integer Linear Programming (ILP) [L. V. Kantorovich (1960)], Constraint Programming (CP) [J. Jaffar and J.-L. Lassez (1987), P. Van Hentenryck (1989), F. Rossi, P. v. Beek, and T. Walsh (2006)], and Local Search (including Hill-Climbing [S. Lin and B. W. Kernighan (1973), B. Selman and C. P. Gomes (2006)]J. H. Holland (1992)]).
The ASP formulations of SMTI and its hard variants (Sex-Equal SMTI, Egalitarian SMTI, Max Cardinality SMTI) are novel (Section 3); they are implemented for the ASP solver Clingo [M. Gebser, R. Kaminski, B. Kaufmann, and T. Schaub (2019)]. We consider the ILP formulation of Max Cardinality SMTI, by Delorme et al. 2019 as a basis, and introduce the ILP formulations for Sex-Equal SMTI and Egalitarian SMTI (Section 4); they are implemented for Gurobi and Google-OR Tools (MIP and CP). We consider the local search algorithms introduced by Gelain et al. 2013 and Haas et al. 2020 for Max Cardinality SMTI (Section 5), and implement them with slight variations. We compare these methods empirically over a large set of randomly generated instances (Section 6).
We also compare ASP with propositional satisfiability (SAT) Gomes et al. (2007); Biere et al. (2009) over randomly generated SMTI instances. For a comparison of ASP with SAT, we adapt the ASP implementation of SMTI for Cmodels Giunchiglia et al. (2004) that utilizes the SAT solver ZChaff Moskewicz et al. (2001) to compute solutions. We also adapt the SAT formulation of SMTI by Drummond et al. (2015) (SAT-E) to include ties, and use the SAT solver Lingeling Biere (2010) to compute solutions.
The implementations and the benchmarks are available at https://github.com/KRR-SU/SMTI-TPLP-2021.
The Stable Marriage problem with Ties and Incomplete lists (SMTI) is defined by a set of men, a set of women, for each man a partial ordering over , and for each woman a partial ordering over .
Let be a partial function such that represents that a woman is man ’s th preferred choice with respect to and be a partial function such that represents that a man is woman ’s th preferred choice with respect to .
A man is acceptable to a woman if is defined. Similarly, a woman is acceptable for a man if is defined.
A matching for a given SMTI instance is a partial function . A man is single if is undefined and a woman is single if is undefined.
A pair of a man and a woman is called a blocking pair for a matching if the following conditions hold:
and are acceptable to each other,
and are not married to each other (i.e., ),
and are both single,
and is single,
and is single or
A matching for SMTI is called stable if it is not blocked by any pair of agents. Note that we consider weakly stable matchings. It is assumed that marriage to an acceptable partner is preferred over being single.
We consider three hard variants of SMTI Kato (1993); Manlove et al. (2002), that aim to compute optimal stable matchings with respect to different measures of fairness: sex-equality, egalitarian and maximum cardinality.
Egalitarian SMTI maximizes the total satisfaction of the preferences of all agents. Since the preferred agents have lower rankings, this total satisfaction is maximized when the sum of ranks of all agents is minimized.
Let be a matching and denote the set of matchings in a given problem. For every man , we define the satisfaction of ’s preferences with respect to as follows: if . Similarly, for every woman , we define the satisfaction if . Then, the total satisfaction of preferences of all agents is defined as follows: Then, a matching with the minimum is egalitarian.
Sex-Equal SMTI maximizes the equality of satisfaction among sexes. We define the sex equality by the following cost function Then, a matching with the minimum is sex-equal.
Max Cardinality SMTI maximizes the number of matched pairs. A matching is a maximum cardinality matching if it is a matching that maximizes . The number of matched pairs is maximized when the number of singles is minimized.
We formalize input of an SMTI instance in ASP by a set of facts using atoms of the forms (“ is a man in ”), (“ is a woman in ”), (i.e., ) and (i.e., ). In the ASP formulation of SMTI, the variables , denote men in and , denote women in .
The first pair of rules of the program characterize a set of individuals of the opposite set for each man and woman who they prefer over being single:
and the concept of mutual acceptability:
We define preferences of man (i.e., prefers to ) and woman (i.e., prefers to ) in terms of rankings.
We define a matching between men and women where both parties find each other acceptable with the cardinal constraint of 1 for each man.
In order to guarantee that a woman is not matched to more than one man, we use the following constraint:
Individuals who stay single under the represented matching by marry atoms are described by the msingle and wsingle atoms.
To establish stability, we refer to conditions A1–A3. The following set of constraints respectively describe and eliminate blocking pairs that are described by (a) – (d) of A3. Conditions A1 and A2 also hold for each constraint.
Given the ASP formulation whose rules are described above and the ASP description of an SMTI instance , the ASP solver Clingo generates a stable matching.
We can transform the ASP program into an equivalent propositional theory so that the answer sets for and the models for are in a 1-1 correspondence Erdem and Lifschitz (2003); Lin and Zhao (2004). The ASP solver Cmodels Giunchiglia et al. (2004) is developed on this idea, and thus allows us to utilize SAT solvers (e.g., ZChaff Moskewicz et al. (2001)) to compute solutions for SMTI instances. An alternative SAT encoding of SMTI can be obtained from the formulation of Drummond et al. (2015).
To solve Sex-Equal SMTI, we add the following weak constraint to optimize sex equality:
To solve Egalitarian SMTI, we add the following weak constraint to minimize the cost function:
To solve Max Cardinality SMTI, we add the following weak constraints to minimize the number of singles:
Note that combinations of these optimizations are possible, by giving priorities to weak constraints: instead of specifying just the weight of the weak constraints, we need to specify also their priorities by an expression . The weak constraints are supported by the ASP solver Clingo but not by Cmodels.
We consider the ILP formulation of Max Cardinality SMTI by Delorme et al. 2019 as a basis and introduce ILP formulations for Sex-Equal SMTI and Egalitarian SMTI.
Let us introduce the necessary notation to describe the ILP formulation.
: A list of lists of size . represents a preference list of man .
: A list of lists of size . represents a preference list of woman .
: Set of men that woman ranks at the same level or better than man .
: Set of women that man ranks at the same level or better than woman .
: The rank of woman in .
: The rank of man in .
: A matrix of size which denotes the matching where rows represent men and columns represent women.
: A binary variable that refers to an index of, and is equal to 1 if man and woman are matched, 0 otherwise.
The acceptability constraint forces the variable to be 0 if man and woman are not mutually acceptable:
The following constraint ensures that each man is matched to at most one woman. Since at most one value can be equal to 1, sum of the cells in a row of should be at most one:
Similarly, the following constraint ensures each woman is matched to at most one man:
The stability constraint ensures that there are no blocking pairs. The variable in the following constraint represents a member of the set of women who has the same or better rank than woman for a man , and represents a member of the set of men who has the same or better rank than man for woman . Hence, if man is matched to someone who is not , or woman is matched to someone who is not , man and woman form a blocking pair:
The following objective function represents the Max Cardinality optimization for the ILP model:
Since the matrix denotes the matching and every matrix cell, denoted by variable , is 1 when the pair represented with that cell is matched; maximizing the sum of all cells corresponds to maximizing the number of matched pairs.
We use the following objective function for Sex-Equal optimization:
This objective function aims to minimize the difference between the sum of the ranks of matched pairs from men’s perspective and the sum of the ranks of matched pairs from women’s perspective.
The following objective function provides Egalitarian optimization:
In Egalitarian optimization, the total satisfaction of individuals is maximized. Since better preference yields lower rank, by minimizing sum of ranks of all matched pairs, the total satisfaction is maximized.
We implement the ILP models using Gurobi and Google OR-Tools MIP. With slight variations of the Google-OR Tools MIP implementation, we can also utilize Google-OR Tools CP.
To compare with the ASP, ILP and CP approaches to solve Max Cardinality SMTI, we also consider the existing local search algorithms.
We consider the local search algorithm LTIU introduced by Gelain et al. 2013 to solve Max Cardinality SMTI as the basis. The input of this algorithm consists of the sets of men and women, preference lists of each man and woman, and a step or a time limit .
LTIU performs a random-restart stochastic hill-climbing search (Algorithm 1). The local search starts from a random matching. The neighbors of a matching are all matchings obtained from by removing one “undominated” blocking pair.111Given two blocking pairs and , dominates (from the men’s point of view) if prefers to . It is also defined for the women’s point of view. A men- (resp., women-) undominated blocking pair is a blocking pair such that there is no other blocking pair that dominates it from the men’s (resp., women’s) point of view. The objective function is the sum of the number of blocking pairs and the number of singles.
LTIU tries to minimize the value of this objective function: at each search step, it chooses a random matching that has the minimum evaluation value. If there exists no matching such that its evaluation value is less than the current matching, then the algorithm chooses a random matching from the neighborhood. Furthermore, with a certain probability, LTIU can choose a random matching in the neighborhood.
The algorithm terminates when it finds a perfect matching (i.e., a matching with no singles and no blocking pairs) or it reaches the time limit. If the algorithm does not find any stable matching during the search, then the best matching with a minimum evaluation value is returned.
During the search, a random restart is applied in order to avoid search near local minima (i.e., it reaches a matching with no blocking pair and thus, has an empty neighborhood).
We consider the genetic algorithm (GA) introduced by Haas (2020) to solve Max Cardinality SMTI (Algorithm 2). Unlike other methods, the algorithm generates stable pairs at every step to obtain matchings with improved properties.
According to the GA approach, chromosomes are solutions to the given SMTI problem. In other words, a chromosome is a stable matching containing several genes which are pairs of matched women and men . To create stable chromosomes for the initial population, ties are arbitrarily broken, then the Gale-Shapley algorithm, also known as deferred acceptance algorithm (DA), is used to find stable matchings.
The fitness function is constructed based on the optimization variant. For Max Cardinality SMTI, a chromosome/matching is said to be fitter if the property is higher for that matching.
To improve the fitness of the chromosome/matching to the desired outcome, two genetic operators are used: the cycle crossover operator and the mutation operator. The fittest individuals are chosen randomly at each iteration to mate and bear offspring. Initially, individuals are randomly selected based on their ranks. The formula for calculating the chance to select an individual (for population and individual ) is as follows:
By integrating two parents’ solutions, the cycle crossover operator produces new possible solutions by selecting a sequence of two or more pairs and flips either or for each pair in the sequence.
The mutation operator searches for Pareto-improvement cycles as described by Erdil and Ergin (2008) to increase the number of matched participants, provided a certain mutation probability.
Our implementation of GA concentrates solely on stable allocations for the Two-Sided Matching application. Particularly, as part of crossover and mutation operators, we have included additional controls that define possible blocking pairs introduced by the changes and only consider adjustments to be acceptable if they do not lead to blocking pairs to ensure that the genetic algorithm returns valid and stable allocations Haas (2020).
We have empirically compared different methods to solve SMTI and its hard variants.
To test and analyze the models and our implementations, we need an instance generator. For this, we have implemented the random instance generator proposed by Gent and Prosser (2002).
The random instance generator takes 3 inputs to generate instances: instance size , (i.e, number of men and women), probability of incompleteness , and probability of ties . We have generated a benchmark set, with instance sizes and , where the value of changes in the range of [0.1, 0.8] and the value of changes in the range [0.1, 0.9] with 0.1 step. There are 144 combinations and for each combination, we have generated 10 instances and averaged the results.
The tests were run on a local machine which has Ubuntu 18.04.1 as operating system and x86_64 processor. The algorithms are implemented in Python programming language with version 3.6.9. Additionally, we use Gurobi version 9.1.1, OR-Tools version 8.1.8487, Clingo version 5.2.2, Cmodels version 3.79 with the SAT solver ZChaff 2007.3.12, and SAT-E version released on May 17, 2016 with the SAT solver Lingeling bcj.
We set the time limit for each solver to 2000 seconds, memory limit to 2 GB, and step limits for LTIU and GA implementations to 50000, and 10000, respectively. In GA experiments, the population size is set to 50, the number of evolution rounds is set to 1000, and the mutation probability is set to . In LTIU experiments, we set the probability of selecting a random matching from the neighborhood to .
For SMTI, we have compared two approaches using three implementations: ASP (using Clingo), SAT (using Cmodels with ZChaff), and SAT (using SAT-E with Lingeling). For thand ese experiments, we have adapted the ASP formulation presented above, to the input language of Cmodels, and the SAT-E implementation to consider ties.
For each solver, for each combination of and , the average CPU times are reported in Table 1 for , and in Table 2 for . We have observed that for all three implementations, the computation time decreases as (i.e., probability of incompleteness) increases. As (i.e., probability of ties) increases, the computation time decreases for Clingo and Cmodels, while it slightly increases for SAT-E. Clingo and Cmodels are comparable for but Clingo is more advantageous than Cmodels due to less consumption of memory for . In general, SAT-E is more advantageous than Cmodels, due to smaller theory sizes (Table 9 and Table 10) and a more efficient SAT solver. For instance, for and , SAT-E generates a propositional theory with 9022 atoms and 124392 clauses in average, whereas Cmodels generates a propositional theory with 113425 atoms and 1296263 clauses in average. According to a survey about the SAT solver competitions Järvisalo et al. (2012), Lingeling performs significantly better than ZChaff.
For Max Cardinality, we have compared four methods using six implementations: ASP (using Clingo), ILP (using Gurobi and Google-OR Tools MIP), CP (Google-OR Tools CP), and local search (LTIU and GA).
For each solver, for each combination of and , the average CPU times are reported in Tables 3 and 4 for , and in Tables 5 and 6 for . We have observed that, for a pair of and values, the average CPU time required for each solver to solve the instances increases with the value of . This is due to the increase in the number of constraints to be satisfied in ILP approaches (Gurobi and OR-Tools solvers), larger space of matchings to search in the local search approaches (LTIU and GA), and the larger program size for ASP (Clingo).
For a pair of and values, as increases, the number of blocking pairs most likely decreases, and thus the average CPU time usually increases for local search methods (due to larger space of matchings). Meanwhile, the preference lists get shorter, and thus the average CPU time usually decreases for the other approaches (due to less number of constraints / rules).
For a pair of and values, as increases, the number of ties increases, and thus the average CPU time usually decreases for the local search methods (due to larger possibility of stable matchings, and, in addition, due to more variety in the initial population for GA). Meanwhile, the number of blocking pairs most likely increases, and thus the average CPU time usually increases for ILP and CP methods (due to larger constraints). The rules / constraints in ASP do not get larger, but the number of stability constraints increases, and thus the average CPU time usually decreases.
Figure 1 provides a comparison of the different approaches with respect to the CPU time for . It can be observed that, for most instances, these approaches (except for Gurobi) are comparable to each other, and that the local search methods takes more time for larger values of (when the preference lists are less incomplete). For , we can observe in Table 5 that, for smaller values of , GA is more efficient, whereas, for larger values of , Google-OR Tools MIP and Clingo are more efficient.
For Sex-Equal and Egalitarian SMTI, we have compared the ILP approach using Google-OR Tools MIP, the CP approach using Google-OR Tools CP, and the ASP approach using Clingo. The results are shown in Tables 7 and 8 for .
For Sex-Equal SMTI, we observe that the average CPU times are larger for the CP and ASP approaches when compared with the Max Cardinality SMTI experimental results (Table 3). Also, note that there is a larger number of instances that could not be solved with these approaches within the given time threshold. In the table, the numbers in square brackets denote how many of the 10 instances could be solved. The ILP approach, on the other hand, performs better for Sex-Equal SMTI.
For Egalitarian SMTI, we observe that the average CPU times are larger for the CP approach when compared with the Max Cardinality SMTI experimental results (Table 3). Also, note that there is a larger number of instances that could not be solved with this approach within the given time threshold. The ASP and ILP approaches, on the other hand, perform better for Egalitarian SMTI.
It is interesting to observe that Clingo has better results for Egalitarian SMTI and Max Cardinality SMTI, compared to Sex-Equal SMTI. This may be related to the objective functions: Sex-Equal SMTI aims to minimize the sum of absolute values of differences of nonnegative numbers, whereas Egalitarian SMTI and Max Cardinality SMTI aim to minimize the sum of nonnegative numbers. The large CPU times for the ASP approach for Sex-Equal SMTI could also be due to the use of aggregates in weak constraints.
We have conducted an empirical study to compare different approaches to solve hard instances of SMTI: Max Cardinality SMTI, Sex-Equal SMTI, and Egalitarian SMTI. For that, we have introduced formulations of these problems in Answer Set Programming utilizing weak constraints, and implemented them for Clingo. We have adapted an existing Integer Linear Programming model of Max Cardinality SMTI, for other optimization variants of SMTI, and implemented them for Gurobi and Google-OR Tools (MIP and CP). We have also implemented two different existing local search algorithms to solve Max Cardinality SMTI, with slight adaptations. We have compared these approaches empirically over randomly generated instances.
We have also performed experiments to compare Answer Set Programming with Propositional Satisfiability, over SMTI instances. For the latter, we have utilized Cmodels with the SAT solver ZChaff, and SAT-E implementation with the SAT solver Lingeling.
There are several important discussions. First of all, modeling is an important step in all these problem-solving methods. For that reason, we have utilized the existing and empirically evaluated models in the literature, for SAT, ILP and local search. We have come up with our own ASP formulation for SMTI variants after trying different formulations and considering elaboration tolerance, as the existing ASP formulations of the stable marriage problems used as benchmarks in the ASP competitions address SMT problem (a tractable variant of SM Irving (1994)).
Although Google-OR Tools provide a CP solver that takes as input (almost the same) ILP formulations of SMTI problems, we think it will be interesting to introduce CP formulations of these problems (e.g., in the spirit of Gent and Prosser (2002)) and experiment with some other CP solvers. Similarly, although Cmodels provides a SAT-based method to solve SMTI instances, it is hinted by our experiments with the SAT encodings of SMTI by Drummond et al. (2015) that it will be worthwhile to compare our results with different SAT encodings of SMTI (e.g., in the spirit of Gent et al. (2002)) and to extend SAT-E to solve optimization variants. These studies are part of our future work.
Regarding the experimental results for optimization variants, it is interesting to observe that the declarative methods (ASP, ILP, CP) are more promising compared to the local search algorithms as the problems get harder with more ties and incompleteness. It is also interesting to observe that the ASP approach using Clingo, and the ILP approach using Google-OR Tools MIP are significantly different from each other for Egalitarian SMTI and Sex-Equal SMTI: some problems cannot be solved by one approach in 2000 seconds, while they can be solved by the other approach in a few seconds. This may suggest a portfolio of ASP, CP, ILP solutions for hard SMTI problems.
We believe that comparing different (but closely related) methods to solve hard problems is valuable to better understand their strengths Cayli et al. (2008); Coban et al. (2008); Dovier et al. (2009); Erdem et al. (2020). Our study of the hard variants of SMTI problems contributes to this line of research, not only by providing models and implementations but also by providing benchmarks for future studies.
We would like to thank Ian Gent, David Manlove, Andrew Perrault and Patrick Prosser for useful discussions and sharing their software with us. We would also like to thank anonymous reviewers for their valuable comments.
Frontiers in Artificial Intelligence and Applications, Vol. 185, IOS Press. Cited by: §1.
Two-sided matching with indifferences: using heuristics to improve properties of stable matchings. Computational Economics, pp. . External Links: Cited by: §1, §5, §5.