In matching models, Helipad runs all matching groups through matchAccept
. Return True
to accept the match, and False
to reject the match, in which case the matched agents return to the pool.
WARNING: Be careful that you do not write a situation where all remaining agents have matched and matchAccept
returns False
for the only remaining pair. The model will hang in this case. To actively select matches rather than reject random ones, use matchSelect
.
Required Parameters
*agents — list[Agent]
The matched agents are passed as arguments to the function. If
model.order=='match-3'
, for example, the function will take 3 arguments. Use*agent
to get the agents as a list.
Expected Return Value — bool
True
to accept the match, False
to reject it and return the agents to the pool.
charwick
Mar 28, 2020 at 1:10This example ensures that two agents of the same breed do not match.