Enum Class SwarmBehavior
- All Implemented Interfaces:
Serializable,Comparable<SwarmBehavior>,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAggregation behavior.Diffusion behavior.Exploration behavior.Flocking behavior (boids style).Foraging behavior (ant colony style).Quorum sensing behavior.Task allocation behavior. -
Method Summary
Modifier and TypeMethodDescriptionGets behavior description.booleanChecks if this behavior requires neighbor detection.booleanChecks if this behavior uses pheromone signaling.static SwarmBehaviorReturns the enum constant of this class with the specified name.static SwarmBehavior[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
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
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
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
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
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
Diffusion behavior.Information spreads through local interactions. Each agent shares knowledge with neighbors, creating gradual consensus.
Best for: Distributed computation, averaging
-
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
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
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 nameNullPointerException- if the argument is null
-
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
-