Reference 〉Function

Helipad.nUpdater( int val, str prim, Helipad model, bool force = False )

Creates and/or destroys agents to get a population number. This function is used as a setter function for agent population parameters, and also at the beginning of a model to create the initial agent set.

WARNING: This is an internal function. Its use in user code is not recommended or supported, and its signature can change in future updates without warning. Use one of the suggested functions above instead, if applicable.

Parameters

  • val int, required

    A new population number. If the current population is less than val, the function creates the difference. If the current population is less than val, the function destroys agents, maintaining the current proportion between breeds, until the population equals val.

  • prim str, required

    The primitive whose agents to create or destroy

  • model Helipad, required

    The model object. Redundant strictly speaking, but necessary to use the function as a slider callback. See the callback argument of model.addParameter().

  • force bool, optional

    Ordinarily nupdater will return the current parameter value of model.param('num_{prim}') in the event that model.hasModel==False. This is used during the initial agent instantiation to force the creation of agents before hasModel is yet set to True.

    Default value: False

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