Learn R Programming

matchingR (version 1.0.1)

many2one: Compute the many-to-one matching

Description

This function returns the many-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

many2one(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 proposer

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 (if a proposer has two vacancies left it will be listed twice) single.reviewers is a vector that lists the ids of remaining single reviewers

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 = many2one(uFirms, uWorkers, slots=2)

Run the code above in your browser using DataLab