Modeling Stable Matching Problems with Answer Set Programming

  • Sofie De Clercq
  • Steven Schockaert
  • Martine De Cock
  • Ann Nowé
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8035)


The Stable Marriage Problem (SMP) is a well-known matching problem first introduced and solved by Gale and Shapley [7]. Several variants and extensions to this problem have since been investigated to cover a wider set of applications. Each time a new variant is considered, however, a new algorithm needs to be developed and implemented. As an alternative, in this paper we propose an encoding of the SMP using Answer Set Programming (ASP). Our encoding can easily be extended and adapted to the needs of specific applications. As an illustration we show how stable matchings can be found when individuals may designate unacceptable partners and ties between preferences are allowed. Subsequently, we show how our ASP based encoding naturally allows us to select specific stable matchings which are optimal according to a given criterion. Each time, we can rely on generic and efficient off-the-shelf answer set solvers to find (optimal) stable matchings.


Stable Matchings Aggregate Function Preference List Virtual Machine Migration Kidney Exchange 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baral, C.: Knowledge Representation, Reasoning, and Declarative Problem Solving. Cambridge University Press, New York (2003)zbMATHCrossRefGoogle Scholar
  2. 2.
    Brewka, G., Eiter, T., Truszczyński, M.: Answer set programming at a glance. Communications of the ACM 54(12), 92–103 (2011)CrossRefGoogle Scholar
  3. 3.
    Dell’Armi, T., Faber, W., Ielpa, G., Leone, N., Pfeifer, G.: Aggregate functions in disjunctive logic programming: Semantics, complexity, and implementation in DLV. In: Gottlob, G., Walsh, T. (eds.) IJCAI, pp. 847–852. M. Kaufmann (2003)Google Scholar
  4. 4.
    Dung, P.: An argumentation-theoretic foundation for logic programming. The Journal of Logic Programming 22(2), 151–177 (1995)MathSciNetzbMATHCrossRefGoogle Scholar
  5. 5.
    Eiter, T., Gottlob, G., Mannila, H.: Disjunctive datalog. ACM Transactions on Database Systems 22(3), 364–418 (1997)CrossRefGoogle Scholar
  6. 6.
    Erdem, E., Lifschitz, V.: Tight logic programs. Theory and Practice of Logic Programming 3, 499–518 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  7. 7.
    Gale, D., Shapley, L.: College admissions and the stability of marriage. The American Mathematical Monthly 69(1), 9–15 (1962)MathSciNetzbMATHCrossRefGoogle Scholar
  8. 8.
    Gale, D., Sotomayor, M.: Some remarks on the stable matching problem. Discr. Appl. Math. 11, 223–232 (1985)MathSciNetzbMATHCrossRefGoogle Scholar
  9. 9.
    Gelfond, M., Lifschitz, V.: The stable model semantics for logic programming. In: ICLP/SLP, pp. 1070–1080 (1988)Google Scholar
  10. 10.
    Gusfield, D.: Three fast algorithms for four problems in stable marriage. SIAM J. Comput. 16(1), 111–128 (1987)MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Irving, R.: Stable marriage and indifference. Discr. Appl. Math. 48(3), 261–272 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  12. 12.
    Irving, R.: The cycle roommates problem: a hard case of kidney exchange. Inf. Process. Lett. 103(1), 1–4 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Irving, R., Leather, P., Gusfield, D.: An efficient algorithm for the “optimal” stable marriage. J. ACM 34(3), 532–543 (1987)MathSciNetCrossRefGoogle Scholar
  14. 14.
    Iwama, K., Miyazaki, S.: A survey of the stable marriage problem and its variants. In: Proc. of ICKS 2008, pp. 131–136. IEEE Computer Society (2008)Google Scholar
  15. 15.
    Janhunen, T.: Representing normal programs with clauses. In: Proc. of the 16th European Conference on Artificial Intelligence, pp. 358–362. IOS Press (2004)Google Scholar
  16. 16.
    Kato, A.: Complexity of the sex-equal stable marriage problem. Japan Journal of Industrial and Applied Mathematics (JJIAM) 10, 1–19 (1993)zbMATHCrossRefGoogle Scholar
  17. 17.
    Manlove, D.: Stable marriage with ties and unacceptable partners. Tech. rep., University of Glasgow, Department of Computing Science (1999)Google Scholar
  18. 18.
    Manlove, D., Irving, R., Iwama, K., Miyazaki, S., Morita, Y.: Hard variants of stable marriage. Theoretical Computer Science 276(1-2), 261–279 (2002)MathSciNetzbMATHCrossRefGoogle Scholar
  19. 19.
    Marek, V., Nerode, A., Remmel, J.: A theory of nonmonotonic rule systems I. Ann. Math. Artif. Intell. 1, 241–273 (1990)zbMATHCrossRefGoogle Scholar
  20. 20.
    McDermid, E., Irving, R.: Sex-equal stable matchings: Complexity and exact algorithms. Algorithmica, 1–26 (2012)Google Scholar
  21. 21.
    Roth, A., Sömnez, T., Ünver, M.: Pairwise kidney exchange. J. Econ. Theory 125(2), 151–188 (2005)zbMATHCrossRefGoogle Scholar
  22. 22.
    Roth, A., Sotomayor, M.: Two-Sided Matching: A Study in Game-Theoretic Modeling and Analysis. Cambridge University Press (1990)Google Scholar
  23. 23.
    Xu, H., Li, B.: Egalitarian stable matching for VM migration in cloud computing. In: IEEE Computer Communication Workshop, pp. 631–636 (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Sofie De Clercq
    • 1
  • Steven Schockaert
    • 2
  • Martine De Cock
    • 1
  • Ann Nowé
    • 3
  1. 1.Dept. of Applied Math., CS & StatsGhent UniversityGhentBelgium
  2. 2.School of Computer Science & InformaticsCardiff UniversityCardiffUK
  3. 3.Computational Modeling LabVrije Universiteit BrusselBrusselsBelgium

Personalised recommendations