Menu

How to use PyMatch?

Assaf Romm

Data representation

Preferences: a preference for an agent is a list containing all acceptable agents on the other side according to their preferability. For example, [3,0,1] means agent 3 is most preferred, agent 0 is less preferred, agent 1 is the least preferred acceptable agent, and other agents (agent 2, and maybe others) are unacceptable.
In many-to-one models preferences are assumed to be responsive, and are represented currently as preferences over single agents on the other side in the same way that preferences over individuals are represented.

Preferences profiles for all agents on one side of the market are just list of preferences, that is, list of lists.

Markets are represented as list containing two elements, where each element represents the preferences profiles of one side of the market. In one-to-one markets we refer to first elements as men's preferences and the second as women's preferences. In many-to-one markets we treat the first element as doctors' preferences, and the second as hospitals' preferences.

Quotas: quotas are just lists of non-negative integers, one for each hospital.

Matchings: A matching is list containing two elements. The first is men's (doctors') matchings, which is a list of agents from the other side, or -1 to indicate no match. In one-to-one markets the second elements is women's matchings. In many-to-one matchings the second is hospitals' matchings. Each hospital has a (possibly empty) list of doctors matched to it. The two elements of matchings must be consistent for them to be meaningful.

Creating random markets

random_uniform(NM, NW) - creates a market using random uniform preferences.

random_blocky(NM, NW, W_blocks, M_block) - creates a market using block correlated random preferences.

random_correlated(NM, NW, beta_1, beta_2) - creates a random correlated market

random_AKL_correlated(NM, NW, alpha_1, alpha_2) - creates a random correlated market a la Ashlagi, Kanoria and Leshno (2013).

Algorithms

mosm(market) - men optimal stable matching

wosm(market) - women optimal stable matching

dosm(market, quota) - doctor optimal stable matching (many-to-one market)

hosm(market, quota) - hospital optimal stable matching (many-to-one market)


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.