Skip to main content

Module interaction

Module interaction 

Source
Expand description

Space interaction API - add, remove, move, and query agents in space.

This module provides the ergonomic helper functions that mirror Julia Agents.jl’s model_accessing_API.jl and space_interaction_API.jl:

These functions operate on StandardModel and require the agent type to implement PositionedAgent and the space to implement SpaceInteraction.

Enums§

InteractionError
Errors that can occur during space interaction operations.

Traits§

PositionedAgent
Extension trait for agents that have a spatial position.
SpaceInteraction
Trait that spaces implement to support agent lifecycle and neighbor queries.

Functions§

add_agent
Add a positioned agent to both the store and the space.
add_agent_random
Add an agent to the model at a random position in the space.
all_ids
Get a vector of all agent IDs in the model.
move_agent
Move an agent to a new position in the space.
nearby_agents
Query agent references near a position, using the space’s distance metric.
nearby_agents_except
Query agent references near a position, excluding a specific agent.
nearby_ids
Query agent IDs near a position, using the space’s distance metric.
nearby_ids_except
Query agent IDs near a position, excluding a specific agent.
random_agent
Pick a random agent reference from the model.
random_id
Pick a random agent ID from the model.
remove_agent
Remove a positioned agent from both the store and the space.
validate_space_index
Validate that every positioned agent in the store is present exactly once in the spatial index at its stored position.