Reference 〉 Class

Patch( )

A patch is a spatially and numerically fixed agent primitive that forms the grid on which other agents move in a spatial model.

Patches inherit all methods from baseAgent, except those pertaining to motion, orientation, reproduction, and death; these will raise a RuntimeError. They can, for example, own stocks of goods and trade them. Patches will also have cardinal-direction properties returning the adjacent patch depending on the patchgrid geometry:

  • Rectangular: patch.up, patch.down, patch.left, and patch.right
  • Polar: patch.clockwise, patch.counterclockwise, patch.inward, and patch.outward

These properties return a Patch object unless the patch abuts the map edge in that direction and wrapping is disabled.

Patches are registered automatically when a spatial model is initialized, and should not be instantiated manually.

Object Properties

  • position tuple(int, int)

    The position of the patch in the patchgrid.

  • neighbors list[Patch]

    A list of adjacent patches, depending on the patchgrid geometry. Corner-adjacent patches will be included depending on the value of the corners parameter of model.spatial(). A patch is connected to its neighbors via a 'spatial' network.

    Initial value: []

  • agentsOn list[Agent]

    A list of agents whose current position is on the patch.

    Initial value: []

Static Properties

  • fixed bool

    For patches, indicates that they cannot reproduce or die.

    Initial value: True

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.