A dict
-like container class for creating, storing, and removing Primitive
objects, i.e. different types of agents. The instantiated object is stored in model.primitives
, where data on primitives can be accessed by name like a dict
, but should not be instantiated by user code.
Methods
Click a method name for more detailed documentation.
add( name, class, plural, … )
Registers an agent primitive. A primitive, like a breed, is a way of introducing heterogeneity into a model, but there are several differences.
- Breeds do not affect the order of stepping. All agents of a primitive are stepped before any agents of another (this order can be changed with the
priority
argument). - Breed is set as a property of the agent, which can be used with conditional logic in agent hooks. Building a primitive requires building a new agent class, which allows cleaner separation of logic where different types of agents behave in completely different ways.
- A use case of breeds would be different types of consumers. A use case of primitives would be consumers versus stores.
- Breeds do not affect the order of stepping. All agents of a primitive are stepped before any agents of another (this order can be changed with the
clear( )
Clears all added data from the container.
remove( name )
Removes a previously added primitive. See also
Primitives.add()
.
Static Properties
multi — bool
Whether the
dict
values should store a function, or a list of functions. This is a static property and should be changed only by subclassingfuncStore
.Initial value: False
Notes and Examples