Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cpp_wrapper_ttc

Computes the top trading cycle algorithm


Description

This is the C++ wrapper for the top trading cycle algorithm. Users should not call this function directly, but instead use toptrading.

Usage

cpp_wrapper_ttc(pref)

Arguments

pref

is a matrix with the preference order of all individuals in the market. If there are n individuals, then this matrix will be of dimension n by n. The i,jth element refers to j's ith most favorite partner. Preference orders must be specified using C++ indexing (starting at 0).

Details

This function uses the top trading cycle algorithm to find a stable trade between agents, each with some indivisible good, and with preferences over the goods of other agents. Each agent is matched to one other agent, and matchings are not necessarily two-way. Agents may be matched with themselves.

Value

A vector of length n corresponding to the matchings being made, so that e.g. if the 4th element is 5 then agent 4 was matched to agent 6. This vector uses C++ indexing that starts at 0.


matchingR

Matching Algorithms in R and C++

v1.3.2
GPL (>= 2)
Authors
Jan Tilly, Nick Janetos
Initial release
2020-12-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.