Skip to main content

PositionedAgent

Trait PositionedAgent 

Source
pub trait PositionedAgent: Agent {
    type Position: Clone;

    // Required methods
    fn position(&self) -> &Self::Position;
    fn set_position(&mut self, position: Self::Position);
}
Expand description

Extension trait for agents that have a spatial position.

Implement this for agent types used with spatial models (grids, continuous spaces, graphs, etc.). The position type is determined by the space.

Required Associated Types§

Source

type Position: Clone

The position type (e.g. (usize, usize) for grids, ContinuousPos for continuous space).

Required Methods§

Source

fn position(&self) -> &Self::Position

Current position of the agent.

Source

fn set_position(&mut self, position: Self::Position)

Update the agent’s position.

Implementors§