Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mr-spaw/swarmOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Swarm Algorithm

SWARMBENCH-30 (DTAR-Lite) Submission

This repository contains our submission for the Swavlamban Innovathon 2025 – Development of Distributed Swarm Algorithm, evaluated using the SWARMBENCH-30 (DTAR-Lite) benchmark.

Our solution implements a fully decentralized, single-file swarm agent for dynamic task allocation under lossy radio communication, without any central controller, shared memory, or synchronization primitives.


1. Problem Overview

SWARMBENCH-30 simulates a constrained multi-agent maritime environment with:

  • Dynamically appearing spatial tasks
  • Hard deadlines and service times
  • Heterogeneous task values
  • Multiple mobile agents with speed limits
  • Lossy, bandwidth-limited broadcast communication

Key Constraints

  • Deterministic execution (fixed seeds)
  • CPU-only, single-threaded
  • All-to-all broadcast with packet loss
  • ≥95% stable task ownership within 60s
  • Penalization for deadline violations or non-convergence

Scoring Function

score = 0.6 × value_ratio − 0.2 × norm_distance − 0.2 × norm_bytes

2. Algorithm Summary

We implement a distributed auction-based task allocation algorithm with the following properties:

  • No central planner or coordinator
  • Local task evaluation by each agent
  • Global consensus via repeated claim broadcasts
  • Conservative feasibility filtering to avoid penalties
  • Capability-aware commitment for constrained tasks (S7)
  • Lightweight leader heartbeat for fault detection only (S6)

Task allocation emerges from peer-to-peer interaction, not centralized decisions.


3. Agent Architecture

Each agent executes identical logic and maintains only local state plus information learned from peer messages.

Core State

  • Agent ID and maximum speed
  • Fixed capability (thermal, lift1, sea3)
  • Local task bundle (my_tasks)
  • Global bid table learned from peers (world_bids)
  • Current executing task
  • Completed task history

Communication Model

  • Broadcast-only messages

  • No acknowledgments or retries

  • Two message types:

    • claim → task ownership
    • role → leader heartbeat (S6)
  • Messages are sent only on state change to minimize bandwidth


4. Functional Breakdown (Code-Mapped)

Distance Utility

dist(ax, ay, bx, by) Computes Euclidean distance. Used for bidding, reachability, and navigation.


Capability Gate (S7)

can_perform_task(task)

  • Enforces hard capability constraints
  • Tasks requiring a capability are invisible to non-matching agents
  • Prevents invalid bidding at the source

Deadline Feasibility

task_is_reachable(task, t, x, y)

Ensures a task can be completed safely before its deadline:

travel_time = distance / speed
total_time  = travel_time + service_time
reachable   = total_time < 0.93 × (deadline − current_time)

The 7% safety margin prevents deadline violations caused by motion discretization and communication delays.


Bid Computation (Core Logic)

calculate_task_bid(...)

Each feasible task is scored using a multiplicative utility model:

bid =
value_component
× distance_component
× urgency_component
× capability_multiplier
× load_factor
× spatial_factor
× sequence_factor

Key design choices:

  • Exponential value preference (high-value dominance)
  • Inverse distance penalty (fuel efficiency)
  • Exponential urgency near deadlines
  • Strong capability prioritization (S7)
  • Load balancing to avoid over-commitment
  • Spatial bias to reduce global travel
  • Task chaining to prevent zig-zag motion

Infeasible tasks return a large negative bid.


Bundle Construction

build_task_bundle(...)

CBBA-inspired, two-phase selection:

  1. Capability tasks first (S7)

    • Select highest-priority matching task
    • Lock agent (cap_mode) until completion
  2. Normal tasks

    • Select up to 1–2 tasks
    • Skip tasks dominated by other agents’ bids

Small bundles improve convergence speed and deadline safety.


Distributed Consensus

update_from_messages(...)

  • Processes incoming claim messages
  • Updates global bid table
  • Drops tasks when clearly outbid
  • Tracks leader heartbeats (S6)

Consensus emerges via repeated broadcasts under lossy conditions.


Leader Failure Detection (S6)

handle_leader_election(...)

  • Leader sends heartbeat every 0.5s
  • Followers timeout after 1.0s
  • Any agent may self-promote
  • Higher term always wins

The leader does not assign tasks — task allocation remains decentralized.


Target Selection

select_target_task(...)

  • Chooses which owned task to execute next

  • Priority:

    1. Capability tasks
    2. Highest bid value
  • Executes only tasks still owned by consensus


Navigation Control

navigate_to_target(...)

  • Velocity vector toward target
  • Stop threshold at 3.5 m (prevents oscillation)
  • Linear deceleration within 20 m (smooth arrival)

Improves distance efficiency without affecting value completion.


Outgoing Communication

create_messages(...)

  • Leader heartbeats at fixed rate
  • Claim broadcasts only when bundle changes

Keeps bandwidth well below scenario limits.


Main Control Loop

step(t, dt, self_state, tasks_visible, inbox)

Executed at 10 Hz with strict ordering:

  1. Detect task completion
  2. Process incoming messages
  3. Handle leader election
  4. Cleanup stale data
  5. Build task bundle
  6. Select target
  7. Compute motion
  8. Generate messages

Returns:

{"vx": vx, "vy": vy}, messages

5. Performance Summary

Scenario Result
S1–S6 Full value, zero penalties
S6 Instant leader recovery
S7 13 / 14 capability tasks
Packet Loss Stable up to 20%
Convergence ~59s (within gate)

Average Score (S1–S7): 0.5664


6. Algorithmic References (Conceptual)

  • CBBA — Distributed auction & bundle consensus principles Choi et al., IEEE Transactions on Robotics, 2009

  • Raft — Heartbeat-based failure detection concept Ongaro & Ousterhout, USENIX ATC, 2014

These works inspired design choices; no direct implementations are used.


7. How to Run

Run all scenarios:

python run_all.py --team teams/nerdos_agent.py

8. Key Properties

  • Fully deterministic
  • Single-file agent
  • No external dependencies
  • No central coordination
  • Designed explicitly for SWARMBENCH-30 constraints

About

A fully decentralized swarm algorithm for dynamic task allocation under lossy communication. Agents coordinate via distributed bidding and peer messaging, without any central controller, supporting heterogeneous capabilities, deadline safety, and fault tolerance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages