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.

@FunctionalInterface public interface NeighborDetection
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 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 for
      allAgents - all agents in the swarm
      radius - detection radius/count
      Returns:
      list of neighboring agents
    • fullyConnected

      static NeighborDetection fullyConnected()
      All other agents are neighbors.
      Returns:
      fully connected strategy
    • random

      static NeighborDetection random()
      Random subset of agents as neighbors.
      Returns:
      random neighbor strategy
    • sequential

      static NeighborDetection sequential()
      First N agents in list order.
      Returns:
      sequential neighbor strategy
    • ring

      static NeighborDetection ring()
      Ring topology - only adjacent agents.
      Returns:
      ring neighbor strategy
    • byRole

      static NeighborDetection byRole()
      Role-based neighbor detection. Agents with same role are neighbors.
      Returns:
      role-based strategy