In a matching model, this hook allows random matching to be overridden and matches to be made with custom logic. The function receives one agent, and must then select its partners from a pool.
agent — Agent
The first agent of the match.
pool — list[Agent]
A list of unmatched agents from which the matched agents must be selected.
model — Helipad
The model object.
stage — int
The current stage of the model.
Expected Return Value — Agent|list[Agent]
A list of agents to match to the initial agent. The dimension of this list must be one less than the match number (i.e. the
model.order=='match-n'). If the order is
'match-2', the function may return a single
Agent object rather than a list. Note also that all returned agents must be in the
pool list, otherwise a
ValueError will be raised.