Interface NeighborDetection
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy for detecting neighbors in a swarm.
NeighborDetection determines which agents are considered "neighbors" of a given agent. This affects local interactions and information sharing in decentralized coordination.
Detection Strategies
- Distance-based - Neighbors within spatial radius
- Graph-based - Neighbors in communication graph
- Similarity-based - Neighbors with similar properties
- Random - Random subset of agents
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic NeighborDetectionbyRole()Role-based neighbor detection.List<com.tnsai.agents.Agent> findNeighbors(com.tnsai.agents.Agent agent, List<com.tnsai.agents.Agent> allAgents, int radius) Finds neighbors for the given agent.static NeighborDetectionAll other agents are neighbors.static NeighborDetectionrandom()Random subset of agents as neighbors.static NeighborDetectionring()Ring topology - only adjacent agents.static NeighborDetectionFirst N agents in list order.
-
Method Details
-
findNeighbors
List<com.tnsai.agents.Agent> findNeighbors(com.tnsai.agents.Agent agent, List<com.tnsai.agents.Agent> allAgents, int radius) Finds neighbors for the given agent.- Parameters:
agent- agent to find neighbors forallAgents- all agents in the swarmradius- detection radius/count- Returns:
- list of neighboring agents
-
fullyConnected
All other agents are neighbors.- Returns:
- fully connected strategy
-
random
Random subset of agents as neighbors.- Returns:
- random neighbor strategy
-
sequential
First N agents in list order.- Returns:
- sequential neighbor strategy
-
ring
Ring topology - only adjacent agents.- Returns:
- ring neighbor strategy
-
byRole
Role-based neighbor detection. Agents with same role are neighbors.- Returns:
- role-based strategy
-