Enum Class SwarmBehavior

java.lang.Object
java.lang.Enum<SwarmBehavior>
com.tnsai.coordination.groups.swarm.SwarmBehavior
All Implemented Interfaces:
Serializable, Comparable<SwarmBehavior>, Constable

public enum SwarmBehavior extends Enum<SwarmBehavior>
Defines the collective behavior patterns for a Swarm.

SwarmBehavior determines how agents interact and coordinate without central control.

Behavior Types

  • EXPLORATION - Spread out, discover, share via pheromones
  • FORAGING - Search for resources, recruit when found
  • FLOCKING - Move together, maintain cohesion
  • AGGREGATION - Gather at high-quality locations
  • TASK_ALLOCATION - Self-assign based on thresholds
  • Enum Constant Details

    • EXPLORATION

      public static final SwarmBehavior EXPLORATION
      Exploration behavior.

      Agents spread out to cover maximum area, avoiding already-visited locations. When interesting areas are found, pheromones are deposited to attract others.

      Best for: Information gathering, search problems

    • FORAGING

      public static final SwarmBehavior FORAGING
      Foraging behavior (ant colony style).

      Agents search randomly until resources are found. Returning agents leave pheromone trails that recruit additional foragers.

      Best for: Resource collection, optimization

    • FLOCKING

      public static final SwarmBehavior FLOCKING
      Flocking behavior (boids style).

      Agents follow three rules:

      • Separation - Avoid crowding neighbors
      • Alignment - Steer towards average heading
      • Cohesion - Move towards average position

      Best for: Coordinated movement, formation

    • AGGREGATION

      public static final SwarmBehavior AGGREGATION
      Aggregation behavior.

      Agents are attracted to locations with high pheromone concentration or neighbor density. Creates clusters around quality solutions.

      Best for: Consensus building, clustering

    • TASK_ALLOCATION

      public static final SwarmBehavior TASK_ALLOCATION
      Task allocation behavior.

      Agents have internal thresholds for task types. Tasks are taken when stimulus exceeds threshold. Thresholds adapt based on success/failure.

      Best for: Division of labor, load balancing

    • DIFFUSION

      public static final SwarmBehavior DIFFUSION
      Diffusion behavior.

      Information spreads through local interactions. Each agent shares knowledge with neighbors, creating gradual consensus.

      Best for: Distributed computation, averaging

    • QUORUM_SENSING

      public static final SwarmBehavior QUORUM_SENSING
      Quorum sensing behavior.

      Agents monitor local density. Actions are triggered only when sufficient neighbors agree. Prevents premature commitment.

      Best for: Collective decision making

  • Method Details

    • values

      public static SwarmBehavior[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SwarmBehavior valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDescription

      public String getDescription()
      Gets behavior description.
      Returns:
      description
    • usesPheromones

      public boolean usesPheromones()
      Checks if this behavior uses pheromone signaling.
      Returns:
      true if uses pheromones
    • requiresNeighbors

      public boolean requiresNeighbors()
      Checks if this behavior requires neighbor detection.
      Returns:
      true if requires neighbors