This function checks if a given matching is stable for a particular set of
preferences. This stability check can be applied to both the stable marriage
problem and the college admission problem. The function requires preferences
to be specified in cardinal form. If necessary, the function
rankIndex can be used to turn ordinal preferences into cardinal
utilities.
is a matrix with cardinal utilities of the proposing
side of the market. If there are n proposers and m reviewers,
then this matrix will be of dimension m by n. The
i,jth element refers to the payoff that proposer j receives
from being matched to reviewer i.
reviewerUtils
is a matrix with cardinal utilities of the courted side
of the market. If there are n proposers and m reviewers, then
this matrix will be of dimension n by m. The i,jth
element refers to the payoff that reviewer j receives from being
matched to proposer i.
proposals
is a matrix that contains the number of the reviewer that a
given proposer is matched to: the first row contains the reviewer that is
matched to the first proposer, the second row contains the reviewer that is
matched to the second proposer, etc. The column dimension accommodates
proposers with multiple slots.
engagements
is a matrix that contains the number of the proposer that
a given reviewer is matched to. The column dimension accommodates reviewers
with multiple slots.