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/types.py
145 146 | |
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/types.py
163 164 | |
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/types.py
148 149 | |
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/types.py
151 152 | |
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/types.py
169 170 | |
move_to(location)
Move the agent to a cell, a node, or a position.
Source code in src/skcomplex/core/types.py
157 158 | |
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/types.py
142 143 | |
neighbors(radius=None, layer=None)
Return the other agents in the neighbouring cells or nodes, within a radius, or around it in a layer.
Source code in src/skcomplex/core/types.py
154 155 | |
referenced(state)
Return the member of another group that a reference state of the agent names, or None.
Source code in src/skcomplex/core/types.py
166 167 | |
remove()
Remove the agent from the model.
Source code in src/skcomplex/core/types.py
160 161 | |
AutomatonProtocol(space, neighborhood, rule, states)
Bases: Protocol
Cellular automaton the analysis reads by its methods, such as Automaton of the automata models.
Source code in src/skcomplex/core/types.py
62 63 64 65 66 67 68 69 | |
reads
property
Neighbourhood the rule reads.
size
property
Number of sites.
local_map()
Return the next value of every pattern of the cells the rule reads.
Source code in src/skcomplex/core/types.py
82 83 | |
run(configuration, steps)
Return the configurations of a number of steps.
Source code in src/skcomplex/core/types.py
88 89 | |
step(configuration)
Return the image of a configuration.
Source code in src/skcomplex/core/types.py
85 86 | |
table()
Return the site of every cell the rule reads at every site.
Source code in src/skcomplex/core/types.py
79 80 | |
LinearAutomatonProtocol
Bases: Protocol
Linear cellular automaton the analysis reads by its matrix and its Laurent polynomial.
laurent_polynomial()
Return the Sage Laurent polynomial of the automaton on Z^d.
Source code in src/skcomplex/core/types.py
99 100 | |
matrix()
Return the Sage matrix of the automaton on its space.
Source code in src/skcomplex/core/types.py
96 97 | |
ModelViewProtocol
Bases: Protocol
Model as agent rules read it, such as ModelView 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 model.
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 model, 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/types.py
185 186 | |
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/types.py
242 243 | |
count(name)
Return the number of agents of a group, a role of the owner or a path.
Source code in src/skcomplex/core/types.py
217 218 | |
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/types.py
232 233 | |
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/types.py
229 230 | |
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/types.py
226 227 | |
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/types.py
196 197 | |
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/types.py
239 240 | |
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/types.py
223 224 | |
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/types.py
245 246 | |
parameter(name)
Return the current value of a parameter of the owner.
Source code in src/skcomplex/core/types.py
199 200 | |
random_empty_cell()
Return the coordinates of a random empty cell of the grid or network.
Source code in src/skcomplex/core/types.py
220 221 | |
report(name, value)
Publish a value of the owner as the reporter <owner>.<name>.
Source code in src/skcomplex/core/types.py
248 249 | |
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/types.py
206 207 | |
SubshiftProtocol
Bases: Protocol
Subshift of finite type the analysis reads by its count of admissible configurations and its violations.
count(space)
Return the number of admissible configurations of a space.
Source code in src/skcomplex/core/types.py
107 108 | |
violations(configuration, space)
Return the sites at which a forbidden pattern appears.
Source code in src/skcomplex/core/types.py
110 111 | |