Types
Define the types of the core: the targets of laws, the pairings and rules of matches, and the protocols.
AgentViewProtocol
Bases: Protocol
Agent as agent rules read it, such as AgentView of the agent stepper: its id, location, moves, and life.
alive
property
Whether the agent has not been removed.
group
property
Path of the group of the agent.
group_label
property
Label of the agent's group, the last part of its path.
id
property
Unique id of the agent.
location
property
Grid coordinates, network node, or position of the agent.
location_key
property
Location of the agent as a key, equal to the coordinates neighbor_cells gives for its cell or node.
agents_here(group=None)
Return the other agents of the agent's cell or node, of every group or of the group of a path.
Source code in src/skcomplex/core/components/types.py
83 84 | |
create(group=None, location=None, **values)
Create an agent of a group, by default the agent's own group at the agent's location.
Source code in src/skcomplex/core/components/types.py
109 110 | |
displacement_to(other)
Return the vector from the agent to another agent or a location, the shortest one on a torus.
Source code in src/skcomplex/core/components/types.py
86 87 | |
distance_to(other)
Return the distance to another agent or a location, the number of hops on a network.
Source code in src/skcomplex/core/components/types.py
89 90 | |
lags(state, window=None)
Return the past values of a state of the agent at the ends of the last steps, the last one last.
Source code in src/skcomplex/core/components/types.py
115 116 | |
move_to(location)
Move the agent to a cell, a node, or a position, or to a uniform point inside a polygon.
Source code in src/skcomplex/core/components/types.py
103 104 | |
neighbor_cells()
Return the coordinates of the cells or nodes around the agent's cell or node, hashable as location keys.
Source code in src/skcomplex/core/components/types.py
80 81 | |
neighbors(radius=None, layer=None, group=None)
Return the other agents in the neighbouring cells or nodes, of every group or of the group of a path.
Source code in src/skcomplex/core/components/types.py
92 93 94 95 96 97 98 | |
referenced(state)
Return the member of another group that a reference state of the agent names, or None.
Source code in src/skcomplex/core/components/types.py
112 113 | |
regions_here(layer)
Return the indices of the regions of a layer of the continuous space that contain the agent.
Source code in src/skcomplex/core/components/types.py
100 101 | |
remove()
Remove the agent from the system.
Source code in src/skcomplex/core/components/types.py
106 107 | |
SystemViewProtocol
Bases: Protocol
System as agent rules read it, such as SystemView of the agent stepper: its agents, storage, and randomness.
dimensions
property
Extent of the agent space per axis, cells of a lattice or lengths of a continuous space, None otherwise.
inputs
property
Values of the states of other partitions at the last synchronisation point, by dotted name.
parameters
property
Current values of every parameter by dotted name.
rng
property
Random number generator of the system.
round
property
Index of the current round of a repeated phase, 0 outside repeated phases.
storage
property
Mutable mapping private to the owner of the rule that persists across the steps of one run.
time
property
Time of the system, with the fraction of the step that the visits of a phase reached.
torus
property
Whether the agent space wraps around at its edges.
agents(name)
Return the agents of a group bound to a role of the owner, or of a group by path.
Source code in src/skcomplex/core/components/types.py
131 132 | |
composition(name, state)
Return the number of agents of a group, a role of the owner or a path, by value of a state.
Source code in src/skcomplex/core/components/types.py
194 195 | |
count(name)
Return the number of agents of a group, a role of the owner or a path.
Source code in src/skcomplex/core/components/types.py
169 170 | |
create(group, location=None, **values)
Create an agent of a group, a role of the owner or a path, at a location or by default a random place.
Source code in src/skcomplex/core/components/types.py
184 185 | |
deposit(name, cell, amount)
Add an amount to a field state, by path or as <role>.<state>, at a cell or node.
Source code in src/skcomplex/core/components/types.py
181 182 | |
field(name, cell)
Return the value of a field state, by path or as <role>.<state>, at a cell or node.
Source code in src/skcomplex/core/components/types.py
178 179 | |
groups(name)
Return the paths of the groups a role of the owner binds, or of a group by path.
Source code in src/skcomplex/core/components/types.py
142 143 | |
history(name, window=None)
Return the past values of a reporter, or of an observable at the end of every earlier step.
Source code in src/skcomplex/core/components/types.py
191 192 | |
observable(name)
Return the current value of an observable of the system, such as an aggregate of a group.
Source code in src/skcomplex/core/components/types.py
175 176 | |
occupancy(name)
Return the number of agents of a group, a role of the owner or a path, by the key of their location.
Source code in src/skcomplex/core/components/types.py
197 198 | |
parameter(name)
Return the current value of a parameter of the owner.
Source code in src/skcomplex/core/components/types.py
151 152 | |
random_empty_cell()
Return the coordinates of a random empty cell of the grid or network.
Source code in src/skcomplex/core/components/types.py
172 173 | |
region(layer, index)
Return the polygon of a region of a layer of the continuous space.
Source code in src/skcomplex/core/components/types.py
148 149 | |
regions(layer)
Return the number of regions of a layer of the continuous space.
Source code in src/skcomplex/core/components/types.py
145 146 | |
report(name, value)
Publish a value of the owner as the reporter <owner>.<name>.
Source code in src/skcomplex/core/components/types.py
200 201 | |
set_parameter(name, value)
Set a parameter of any group or interaction during the run, recorded in the trajectory.
Source code in src/skcomplex/core/components/types.py
158 159 | |