Task Allocation¶
Assigning tasks to robots.
Problem¶
When a task needs execution, which robot should handle it?
New Task: Pick from R5, deliver to S1
Available Robots:
R1: Idle at N10 (close to R5)
R2: Idle at N50 (far from R5)
R3: Busy (1 task queued)
Which robot gets the task?
Allocation Policies¶
Nearest Idle¶
Assign to closest available robot:
Algorithm:
- Find all idle robots
- Calculate distance to task origin
- Select robot with shortest distance
Example:
Task at R5 (position N20)
R1 at N22: distance = 3m ← Selected
R2 at N50: distance = 30m
R3: Busy (skip)
Pros:
- Minimizes travel time
- Simple to implement
- Fast decisions
Cons:
- May create unbalanced utilization
- Doesn't consider future tasks
Least Busy¶
Assign to robot with fewest pending tasks:
Algorithm:
- Count queued tasks per robot
- Select robot with lowest count
- Tie-breaker: nearest
Example:
Pros:
- Balances workload
- Better for high-volume scenarios
Cons:
- May assign distant robots
- More travel overall
Round Robin¶
Cycle through robots in order:
Algorithm:
- Track last assigned robot
- Assign to next robot in sequence
- Skip busy robots
Example:
Pros:
- Perfect balance over time
- Predictable
Cons:
- Ignores distance
- Ignores current state
Due Time Priority¶
Assign based on task urgency:
Algorithm:
- Score = distance + urgency_weight × time_to_due
- Select robot minimizing score
Example:
Task: Due in 60s
R1: 10m away, score = 10 + 2×60 = 130
R2: 30m away, score = 30 + 2×60 = 150
R1 selected (lower score)
Comparison¶
Metrics Impact¶
| Policy | Travel | Balance | Throughput |
|---|---|---|---|
| Nearest Idle | Low | Medium | High |
| Least Busy | Medium | High | Medium |
| Round Robin | High | Perfect | Low |
| Due Time | Variable | Medium | High |
Best For¶
| Policy | Best When |
|---|---|
| Nearest Idle | Speed matters most |
| Least Busy | Fleet utilization matters |
| Round Robin | Simple fairness needed |
| Due Time | Orders have SLAs |
Visual Comparison¶
Nearest Idle¶
Least Busy¶
Dynamic Allocation¶
Real-Time Reassignment¶
Tasks can be reassigned if:
- Better robot becomes available
- Original robot delayed
- Priority changes
policies:
task_allocation:
type: nearest_idle
allow_reassignment: true
reassignment_threshold_s: 30.0
Preemption¶
Higher priority tasks can bump lower priority:
Multi-Factor Allocation¶
Weighted Scoring¶
Combine multiple factors:
policies:
task_allocation:
type: weighted
distance_weight: 1.0
queue_weight: 0.5
battery_weight: 0.3
Score calculation:
score = distance × distance_weight
+ queue_length × queue_weight
+ (100 - battery_pct) × battery_weight
Lower score wins.
Configuration Examples¶
Speed-Focused¶
Balance-Focused¶
SLA-Focused¶
Performance Testing¶
Compare Policies¶
waremax compare scenario.yaml \
--param policies.task_allocation=nearest_idle \
--param policies.task_allocation=least_busy \
--param policies.task_allocation=round_robin
Key Metrics to Watch¶
| Metric | Description |
|---|---|
| avg_travel_time | Lower is better for nearest |
| utilization_stddev | Lower is better for balanced |
| throughput | Tasks per hour |
| late_tasks | Missed due times |