Description Format Details Construction Fields Methods
This is a the abstract base class for matching market objects like MatchingMarketStochastic and MatchingMarketOptimal. This class is usually used for solving problems such as allocation, matching and mating of agents.
R6::R6Class object.
sub-matching problems only contains agentsets' data in a named list format (agentset_A, agentset_B).
1 | matching_problem <- MatchingMarket$new(agentset_A, agentset_B, slots_B, id_col_A, id_col_B, grouping_vars)
|
agentset_A
:: data.table::data.table()
A data.table contains agentset A data and relavant attributes. This is usually
the choosers (in one-sided matching).
agentset_B
:: data.table::data.table()
A data.table contains agentset B data and relavant attributes. This is usually
be the agents in the candidate pool.
id_col_A
:: character(1)
A character that indicates the id column of agentset_A
.
id_col_B
:: character(1)
A character that indicates the id column of agentset_B
.
slots_B
:: integer()
(NULL
)
A integer vector of length 1 or length equals to the number of rows in agentset_B
.
This is needed in many-to-one
matching. Such as workers to jobs.
grouping_vars
:: character()
(NULL
)
When this is provided matching can be done just between agents of the same group.
matching_problem
split_market()
(logical(1)
) -> ()
Create a list of list of data.tables. list({group_name} = list({sub_market_number} = list(agentset_A = data.table(), agentset_B = data.table())))
.
split_by_group(matching_problem = self$matching_problem, grouping_vars = self$matching_problem$grouping_vars)
(agentset_A = data.table::data.table(), agentset_B = data.table::data.table()
|logical()
, character()
, logical(1)
) -> [data.table::data.table()]
Create n-groups sub-matching problems.
split_by_n(matching_problem = self$matching_problem, n = NULL)
(agentset_A = data.table::data.table(), agentset_B = data.table::data.table()
| integer()
) -> list([data.table::data.table()])
Create n sub-matching problems. If n is not given, then n will be determine
based on self$max_market_size.
matching_score_A(matching_problem = self$matching_problem, idx_A, idx_B)
(list(agentset_A = data.table::data.table(), agentset_B = data.table::data.table())
|integer()
|integer()
) ->
integer()
of length idx_B
or matrix()
of length idx_A
* length idx_B
This is an abstract function meaning it needs to be implemented. Please see
the detail section for suggestion how this method should be implemented.
matching_score_B(matching_problem = self$matching_problem, idx_B, idx_A)
(list(agentset_A = data.table::data.table(), agentset_B = [data.table::data.table()])
|integer()
|integer()
) ->
integer()
of length idx_B
or matrix()
of length idx_A
* length idx_B
This is an abstract function meaning it needs to be implemented. Please see
the detail section for suggestion how this method should be implemented.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.