Learn R Programming

matchingR (version 1.0.1)

one2many: Compute the one-to-many matching

Description

This function returns the one-to-many matching. The function needs some description of individuals preferences as inputs. That can be in the form of cardinal utilities or preference orders (or both). It is computationally most efficient to provide cardinal utilities for the proposers proposerUtils and cardinal utilities for the reviewers reviewerUtils.

Usage

one2many(proposerUtils = NULL, reviewerUtils = NULL, proposerPref = NULL,
  reviewerPref = NULL, slots = 1)

Arguments

proposerUtils
is a matrix with cardinal utilities of the proposing side of the market
reviewerUtils
is a matrix with cardinal utilities of the courted side of the market
proposerPref
is a matrix with the preference order of the proposing side of the market (only required when proposerUtils is not provided)
reviewerPref
is a matrix with the preference order of the courted side of the market (only required when reviewerUtils is not provided)
slots
is the number of slots per reviewer

Value

  • A list with the successful proposals and engagements: proposals is a vector whose nth element contains the id of the reviewer that proposer n is matched to. engagements is a vector whose nth element contains the id of the proposer that reviewer n is matched to. single.proposers is a vector that lists the ids of remaining single proposers single.reviewers is a vector that lists the ids of remaining single reviewers (if a reviewer has two vacancies left it will be listed twice)

Examples

Run this code
nfirms = 10
nworkers = 25
uFirms = matrix(runif(nfirms*nworkers), nrow=nfirms, ncol=nworkers)
uWorkers = matrix(runif(nfirms*nworkers), nrow=nworkers, ncol=nfirms)
results = one2many(uWorkers, uFirms, slots=2)

Run the code above in your browser using DataLab