Skip to content

optimize Amazon delivery truck routes with Prime features

Notifications You must be signed in to change notification settings

xPushpeshx/amazonPrime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšš Amazon Delivery Truck Scheduling

A Python project to simulate and optimize Amazon delivery truck routes.
It models delivery addresses, constructs routes, applies optimization heuristics, schedules multiple trucks, and handles dynamic deliveries (new orders each day).


๐Ÿ“Œ Features

  • Address & Route Modeling: Delivery points with coordinates, Prime flag, and depot handling.
  • Greedy Route Construction: Nearest-neighbor heuristic for quick route generation.
  • 2-opt Optimization: Improves routes by swapping path segments.
  • Multi-Truck Scheduling: Splits deliveries across multiple trucks.
  • Amazon Prime Constraint: Keeps Prime deliveries fixed.
  • Dynamic Simulation: Adds new deliveries each day and runs scheduling.

๐Ÿ“‚ Project Structure

amazon_truck_scheduling/
โ”‚
โ”œโ”€โ”€ amazon/             # Core package
โ”‚   โ”œโ”€โ”€ address.py      # Address class
โ”‚   โ”œโ”€โ”€ address_list.py # AddressList utilities
โ”‚   โ”œโ”€โ”€ route.py        # Route construction
โ”‚   โ”œโ”€โ”€ optimizer.py    # Route optimization (2-opt)
โ”‚   โ”œโ”€โ”€ scheduler.py    # Multi-truck scheduling
โ”‚   โ””โ”€โ”€ simulation.py   # Dynamic delivery simulation
โ”‚
โ”œโ”€โ”€ main.py             # Entry point (demo & tests)
โ”œโ”€โ”€ tests/              # Unit tests
โ”œโ”€โ”€ data/               # Sample input data
โ””โ”€โ”€ README.md           # Project overview

โ–ถ๏ธ Usage

1. Clone the project

git clone https://github.com/yourusername/amazon-truck-scheduling.git
cd amazon-truck-scheduling

2. Run the demo

python main.py

3. Run tests

pytest tests/

๐Ÿ“Š Example Output

--- Single Route (Greedy + 2-opt) ---
Greedy route: [Depot -> A1 -> A2 -> ... -> Depot]
Optimized route length: 72.1

--- Multi-Truck Scheduling ---
Truck 1 route: [Depot -> ...] | Length: 50.3
Truck 2 route: [Depot -> ...] | Length: 46.7

--- Simulation (Dynamic Deliveries) ---
Day 1 - Truck 1 route: [Depot -> ...] | Length: 40.2
Day 1 - Truck 2 route: [Depot -> ...] | Length: 42.8

๐Ÿ”ฎ Future Improvements

  • Genetic Algorithm-based optimization
  • Real-world datasets (OSM, Google Maps API)
  • Fuel/time cost modeling
  • Visualization of routes on a map

๐Ÿ“œ License

MIT License โ€“ free to use and modify.

About

optimize Amazon delivery truck routes with Prime features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages