galeShapley.validate | R Documentation |
This function parses and validates the arguments that are passed on to the Gale-Shapley Algorithm. In particular, it checks if user-defined preference orders are complete and returns an error otherwise. If user-defined orderings are given in terms of R indices (starting at 1), then these are transformed into C++ indices (starting at zero).
galeShapley.validate( proposerUtils = NULL, reviewerUtils = NULL, proposerPref = NULL, reviewerPref = NULL )
proposerUtils |
is a matrix with cardinal utilities of the proposing
side of the market. If there are |
reviewerUtils |
is a matrix with cardinal utilities of the courted side
of the market. If there are |
proposerPref |
is a matrix with the preference order of the proposing
side of the market (only required when |
reviewerPref |
is a matrix with the preference order of the courted side
of the market (only required when |
a list containing proposerUtils
, reviewerUtils
,
proposerPref
(reviewerPref
are not required after they are
translated into reviewerUtils
).
# market size nmen <- 5 nwomen <- 4 # generate cardinal utilities uM <- matrix(runif(nmen * nwomen), nrow = nwomen, ncol = nmen) uW <- matrix(runif(nwomen * nmen), nrow = nmen, ncol = nwomen) # turn cardinal utilities into ordinal preferences prefM <- sortIndex(uM) prefW <- sortIndex(uW) # validate cardinal preferences preferences <- galeShapley.validate(uM, uW) preferences # validate ordinal preferences preferences <- galeShapley.validate(proposerPref = prefM, reviewerPref = prefW) preferences # validate ordinal preferences when these are in R style indexing # (instead of C++ style indexing) preferences <- galeShapley.validate(proposerPref = prefM + 1, reviewerPref = prefW + 1) preferences # validate preferences when proposer-side is cardinal and reviewer-side is ordinal preferences <- galeShapley.validate(proposerUtils = uM, reviewerPref = prefW) preferences
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.