rsd {matchingMarkets} | R Documentation |
Random serial dictatorship mechanism
Description
Implements the random serial dictatorship algorithm algorithm for a fair division of indivisible objects among individuals. The mechanism takes individuals' prioirty order as an input or alternatively draws a random permutation of the agents form the uniform distribution. Individuals are then successively assigned an object in that order (so the first agent in the ordering gets the first pick and so on).
Usage
rsd(
nIndividuals = ncol(prefs),
nObjects = nrow(prefs),
prefs,
priority,
seed = NULL,
nSlots = rep(1, nObjects)
)
Arguments
nIndividuals |
integer indicating the number of individuals in the matching problem. Defaults to ncol(prefs). |
nObjects |
integer indication the number of objects in the matching problem. Defaults to nrow(prefs). |
prefs |
matrix of dimension |
priority |
(Optional) vector of length |
seed |
(Optional) integer setting the state for random number generation. Defaults to seed = 123. |
nSlots |
(Optional) vector of length |
Value
rsd
returns a data frame containing the final matching of individuals (ind) to objects (obj).
Author(s)
Thilo Klein, Alexander Sauer
Examples
## Generate preference-matrix
prefs <- matrix(c(1,2,3,
3,1,2,
1,3,2),
byrow = FALSE, ncol = 3)
priority <- c(1,2,3)
nSlots <- c(1,1,1)
rsd(prefs = prefs, priority = priority, nSlots = nSlots)