Finds all stable matchings (if one exists) in the stable roommates problem with incomplete lists using the Prosser (2014) constraint encoding based on either given or randomly generated preferences.

1 |

`prefs` |
valuation matrix of dimension |

`nAgents` |
integer that gives the number of players in the market. |

`seed` |
integer setting the state for random number generation. |

`p.range` |
range of two intergers |

`sri`

returns a list with the following items.

`prefs` |
agents' preference list. |

`matching` |
edgelist of matched pairs, inculding the number of the match ( |

Thilo Klein

Gusfield, D.M. and R.W. Irving (1989). The Stable Marriage Problem: Structure and Algorithms, MIT Press.

Prosser, P. (2014). Stable Roommates and Constraint Programming. *Lecture Notes in Computer Science, CPAIOR 2014 Edition*.
Springer International Publishing, 8451: 15–28.

Irving, R.W. and S. Scott (2007). The stable fixtures problem: A many-to-many extension of stable roommates.
*Discrete Applied Mathematics*, 155: 2118–2129.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
## Roommate problem with 10 players, given preferences:
prefs <- matrix(rep(1:10, 10), 10, 10)
sri(prefs=prefs)
## Roommate problem with 10 players, random preferences:
sri(nAgents=10, seed=1)
## Roommate problem with no equilibrium matching:
sri(nAgents=10, seed=2)
## Roommate problem with 3 equilibria:
sri(nAgents=10, seed=3)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.