Examples

The following example models are presented in the Model Library.

To use these classes, they have to be imported as follows:

from agentpy.examples import WealthModel
class WealthModel(parameters=None, _run_id=None, **kwargs)[source]

Demonstration model of random wealth transfers.

See also

Notebook in the model library: Wealth transfer

Parameters

parameters (dict) –

  • agents (int): Number of agents.

  • steps (int, optional): Number of time-steps.

class SegregationModel(parameters=None, _run_id=None, **kwargs)[source]

Demonstration model of segregation dynamics.

See also

Notebook in the model library: Segregation

Parameters

parameters (dict) –

  • want_similar (float): Percentage of similar neighbors for agents to be happy

  • n_groups (int): Number of groups

  • density (float): Density of population

  • size (int): Height and length of the grid

  • steps (int, optional): Maximum number of steps