GoRules Version 2 is here - redesigned, now with managed cloud.GoRules Version 2 is here!
Watch the launch videoWatchLast-Mile Delivery Assignment
Automated system that matches packages with delivery personnel by priority, weight, skills, location, and time to optimize efficiency.
Solution
This intelligent delivery assignment system streamlines the last-mile logistics process by automatically matching packages with the most suitable delivery personnel. The system evaluates multiple key factors including package priority (express vs standard), package attributes (weight, fragility, signature requirements), and delivery personnel qualifications (certifications, equipment, vehicle type).
The matching algorithm calculates scores based on proximity to delivery location, remaining vehicle capacity, service level agreement deadlines, and specialized handling requirements. For time-sensitive deliveries, the system prioritizes delivery personnel with express certification. When packages require signatures, only equipped personnel are considered. The system either automatically assigns packages that meet threshold requirements or flags exceptions for manual review with suggested actions, ensuring optimal resource utilization while maintaining service quality standards.
How it works
The decision graph processes package assignments through several key evaluation steps:
- Input Processing: Receives package details (ID, priority, weight, dimensions, signature requirements) and delivery personnel information (skills, location, capacity, equipment).
- Match Score Calculation: Evaluates package-personnel compatibility based on priority level, weight handling capabilities, and special skill requirements.
- Proximity Analysis: Calculates a distance score based on how close the delivery person is to the package location.
- Capacity Verification: Confirms the delivery person has sufficient remaining capacity for the package.
- SLA Compliance Check: Assesses if the delivery deadline can be met based on current time and delivery person availability.
- Final Score Computation: Combines all factors into a comprehensive score for assignment decision-making.
- Assignment Decision: Automatically assigns packages with scores above threshold or routes to manual review with actionable recommendations.
Where teams use it
- Last-mile delivery operations
- Urban courier services
- E-commerce fulfillment centers
- Food delivery platforms
- Retail store delivery services
- Same-day delivery providers
- Package redistribution networks
- On-demand delivery applications
Inside the decision model
Last-Mile Delivery Assignment ships as a JDM decision graph with 6 nodes, 1 decision table and 6 rules. Download it, load it into GoRules, and run it as-is on Zen Engine.
Request
inputTwo objects arrive together: a package with priority, weight, needsSignature, distanceFromDeliveryPerson, and deliveryDeadline, and a deliveryPerson with skills, remainingCapacity, and collectSignatureEquipped. The whole graph scores this one candidate pairing rather than searching a pool.
Sample requestJSON
{
"package": {
"id": "PKG-12345",
"priority": "express",
"weight": 22.5,
"dimensions": {
"length": 45,
"width": 30,
"height": 25
},
"fragile": false,
"needsSignature": true,
"distanceFromDeliveryPerson": 5.2,
"deliveryDeadline": "2025-03-19T16:00:00Z",
"deliveryZone": "downtown",
"specialInstructions": "Leave with doorman if recipient unavailable"
},
"deliveryPerson": {
"id": "DP-789",
"name": "Alex Johnson",
"skills": [
"express_certified",
"heavy_lifting",
"collectSignature"
],
"currentLocation": {
"latitude": 40.7128,
"longitude": -74.006
},
"remainingCapacity": 50,
"remainingDeliveries": 8,
"vehicleType": "van",
"collectSignatureEquipped": true,
"currentZone": "downtown",
"shiftEndsAt": "2025-03-19T20:00:00Z"
}
}Calculate Match Score
tableCompatibility scoring works through requirement-skill pairings with a first hit policy, so the strongest match rows sit on top. An 'express' package over 20kg paired with a courier whose skills contain 'heavy_lifting' scores 10 with priorityLevel 'high', express with 'express_certified' scores 8, standard fragile freight matched to 'fragile_handling' scores 7, standard over 15kg with 'heavy_lifting' scores 5, a needsSignature package with a collectSignatureEquipped courier scores 4, and the catch-all grants a baseline 2 with 'low'.
Ordering rows by the difficulty of the requirement is the practical logic: express-plus-heavy is the hardest package to place, so finding a fully qualified courier is worth the most points. Skill flags like signature equipment and heavy-lifting map directly to real courier constraints, where handing a signature-required parcel to an unequipped driver produces a failed delivery attempt, and the point values themselves are tuning choices for the 15-point assignment bar downstream.
| Package Requirements | Package Attributes | Delivery Person Qualifications | Match ScorematchScore | Priority LevelpriorityLevel |
|---|---|---|---|---|
| package.priority == 'express' | package.weight > 20 | contains(deliveryPerson.skills, 'heavy_lifting') | 10 | 'high' |
| package.priority == 'express' | - | contains(deliveryPerson.skills, 'express_certified') | 8 | 'high' |
| package.priority == 'standard' | package.fragile == true | contains(deliveryPerson.skills, 'fragile_handling') | 7 | 'medium' |
| package.priority == 'standard' | package.weight > 15 | contains(deliveryPerson.skills, 'heavy_lifting') | 5 | 'medium' |
| package.needsSignature == true | - | deliveryPerson.collectSignatureEquipped == true | 4 | 'medium' |
| - | - | - | 2 | 'low' |
Calculate Final Score
expressionScore assembly happens in one pass: distanceScore is 10 - min([round(package.distanceFromDeliveryPerson / 2), 8]), so proximity decays with distance but never goes below 2; capacityFactor pays 5 only when deliveryPerson.remainingCapacity covers package.weight; and slaFactor doubles from 3 to 6 when the deliveryDeadline is under 7200 seconds away, boosting urgent packages. These add to matchScore as totalScore, and recommendedAssignment becomes true at 15 or more, the single boolean the switch routes on.
10 - min([round(package.distanceFromDeliveryPerson / 2), 8])deliveryPerson.remainingCapacity >= package.weight ? 5 : 0date(package.deliveryDeadline) - date('now') < 7200 ? 6 : 3matchScore + $.distanceScore + $.capacityFactor + $.slaFactor$.totalScore >= 15Determine Assignment
switchAssignment forks on recommendedAssignment == true: qualifying pairings flow to automatic assignment while the default branch sends everything else to manual review. Keeping the threshold decision in the expression and only the routing here means the 15-point bar can be tuned without touching the branch structure.
Create Assignment Require Manual ReviewCreate Assignment
expressionSuccessful matches get an assignmentStatus of 'assigned' plus an assignmentDetails record tying deliveryPerson.id to package.id with the achieved assignmentScore. The estimatedArrival adds package.distanceFromDeliveryPerson * 180 seconds to the current time, effectively assuming three minutes per kilometer, which gives dispatch a concrete ETA to publish rather than just a match confirmation.
'assigned'{ 'deliveryPersonId': deliveryPerson.id, 'packageId': package.id, 'estimatedArrival': date('now') + (package.distanceFromDeliveryPerson * 180), 'assignmentScore': totalScore }'Package successfully assigned to delivery person'Require Manual Review
expressionRejected pairings are parked with assignmentStatus 'pending' and a reason, 'Score too low for automatic assignment' when totalScore is under 15. The suggestedActions list, try a different delivery person, wait for a closer one, or escalate to the dispatch manager, turns the rejection into a queue item a dispatcher can act on instead of a dead end.
'pending'totalScore < 15 ? 'Score too low for automatic assignment' : 'Unknown issue'['Try different delivery person', 'Wait for closer delivery person', 'Escalate to dispatch manager']'Package requires manual review for assignment'Other Logistics templates
View all templatesShipping Carrier Selector
Rule-based system that selects optimal carriers by analyzing package details, service level needs, and cost factors to streamline shipping decisions.
LogisticsDelivery Route Optimizer
Smart logistics system that evaluates capacity, traffic, time windows, and distance to determine the most efficient delivery routes for maximum efficiency.
LogisticsWarehouse Storage Location
Maximizes warehouse efficiency by strategically placing products based on turnover rates, picking frequency, and product characteristics.
Make this template
your own.
Load Last-Mile Delivery Assignment into GoRules, adjust the rules to your policy, and ship it behind your own API.