Reference 〉Hook

matchSelect( Agent agent, list[Agent] pool, Helipad model, int stage )

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.

Required Parameters

  • 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 n in 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.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History