Skip to content

khainam23/logistic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚚 Logistic Optimization Algorithms with Parallel Processing

Nghiên cứu và triển khai các thuật toán tối ưu hóa song song trong lĩnh vực logistics, tập trung vào giải quyết bài toán Vehicle Routing Problem with Time Windows (VRPTW) và Pickup and Delivery Problem with Time Windows (PDPTW).

Java Maven License

🌟 Demo & Mẫu chạy thử

💁‍♂️ Kaggle Notebook - Chạy thử trực tuyến


📌 Giới thiệu

Dự án này triển khai một hệ thống tối ưu hóa logistics tiên tiến với khả năng xử lý song song (parallel processing), tăng tốc GPUhọc tăng cường (Reinforcement Learning). Hệ thống giải quyết các bài toán phức tạp trong logistics như:

  • VRPTW (Vehicle Routing Problem with Time Windows)
  • PDPTW (Pickup and Delivery Problem with Time Windows)
  • VRPSPDTW (Vehicle Routing Problem with Simultaneous Pickup and Delivery and Time Windows)

Sử dụng 4 thuật toán meta-heuristic tiên tiến chạy song song kết hợp với Reinforcement Learning để tìm ra giải pháp tối ưu nhất.


🎯 Tính năng chính

🚀 Xử lý song song (Parallel Processing)

  • Multi-threading: Chạy đồng thời 4 thuật toán tối ưu hóa
  • GPU Acceleration: Tự động phát hiện và sử dụng GPU khi có sẵn
  • Performance Monitoring: Theo dõi hiệu suất thời gian thực
  • Progress Tracking: Thanh tiến trình cho từng thuật toán

🧠 Thuật toán tối ưu hóa

  • SHO (Spotted Hyena Optimizer)
  • ACO (Ant Colony Optimization)
  • GWO (Grey Wolf Optimizer)
  • WOA (Whale Optimization Algorithm)
  • SA (Simulated Annealing) - Tạo quần thể ban đầu
  • RL (Reinforcement Learning) - Học tăng cường

📊 Xuất dữ liệu & Báo cáo

  • Excel Export: Xuất kết quả chi tiết ra file Excel
  • CSV Export: Xuất dữ liệu định dạng CSV
  • TXT Export: Xuất báo cáo dạng text
  • Performance Reports: Báo cáo hiệu suất và so sánh thuật toán
  • Real-time Monitoring: Theo dõi tiến trình thực thi
  • Configurable Fitness: Chiến lược fitness có thể cấu hình

🧠 Công nghệ & Thư viện

  • Java 17: Ngôn ngữ lập trình chính
  • Maven: Quản lý dependencies và build
  • Apache POI: Xuất dữ liệu Excel
  • ProgressBar: Hiển thị tiến trình
  • OpenCSV: Xuất dữ liệu CSV
  • Lombok: Giảm boilerplate code
  • Apache Commons Lang: Utilities hỗ trợ

📁 Cấu trúc dự án

logistic/
├── pseudo/                  # Tài liệu thuật toán (pseudocode)
│   ├── AlgorithmComparison.md
│   ├── AntColonyOptimization.md
│   ├── GreyWolfOptimizer.md
│   ├── SimulatedAnnealing.md
│   ├── SpottedHyenaOptimizer.md
│   └── WhaleOptimizationAlgorithm.md
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── org/
│   │   │       └── logistic/
│   │   │           ├── Main.java           # Entry point chính
│   │   │           ├── algorithm/          # Thuật toán tối ưu hóa
│   │   │           │   ├── aco/           # Ant Colony Optimization
│   │   │           │   ├── gwo/           # Grey Wolf Optimizer
│   │   │           │   ├── sa/            # Simulated Annealing
│   │   │           │   ├── sho/           # Spotted Hyena Optimizer
│   │   │           │   └── woa/           # Whale Optimization Algorithm
│   │   │           ├── parallel/          # 🚀 Xử lý song song
│   │   │           ├── model/             # Data models
│   │   │           ├── data/              # Data processing
│   │   │           └── util/              # Utilities
│   │   └── resources/
│   │       └── data/                      # Test datasets
│   │           ├── vrptw/                 # VRPTW problems
│   │           │   ├── src/              # Problem instances
│   │           │   └── solution/         # Known solutions
│   │           ├── pdptw/                 # PDPTW problems
│   │           │   ├── src/
│   │           │   └── solution/
│   │           ├── vrptw_vrpspdtw/        # VRPTW & VRPSPDTW combined
│   │           ├── Liu_Tang_Yao/          # Liu-Tang-Yao benchmark
│   │           │   ├── src/
│   │           │   └── solution/
│   │           └── Wang_Chen/             # Wang-Chen benchmark
│   │               ├── src/
│   │               └── solution/
│   └── test/                # Unit tests
│       └── java/
├── exports/                 # Output files (Excel, CSV)
├── pom.xml                  # Maven configuration
├── CODE_OF_CONDUCT.md      # Code of conduct
└── README.md               # Project documentation

🚀 Hướng dẫn cài đặt & chạy

📋 Yêu cầu hệ thống

  • Java 17 hoặc cao hơn
  • Maven 3.8+
  • RAM: Tối thiểu 4GB (khuyến nghị 8GB+)
  • CPU: Multi-core (để tận dụng parallel processing)
  • GPU: Tùy chọn (CUDA-compatible để tăng tốc)

1️⃣ Clone dự án

git clone https://github.com/khainam23/logistic.git
cd logistic

2️⃣ Cài đặt dependencies

mvn clean install

3️⃣ Dữ liệu test

Dữ liệu mẫu đã được tích hợp sẵn trong src/main/resources/data/:

  • VRPTW: Solomon benchmark instances (C101, C102, ...)
  • PDPTW: Li & Lim benchmark instances
  • VRPTW_VRPSPDTW: Combined dataset với các instances CDP, RCDP, RDP
  • Liu_Tang_Yao: Liu-Tang-Yao benchmark dataset
  • Wang_Chen: Wang-Chen benchmark dataset

4️⃣ Chạy ứng dụng

Sử dụng Maven:

mvn exec:java -Dexec.mainClass="org.logistic.Main"

Hoặc từ IDE:

  • Mở dự án trong IDE (IntelliJ IDEA, Eclipse, VS Code)
  • Chạy file src/main/java/org/logistic/Main.java

5️⃣ Cấu hình tùy chọn

Trong file Main.java, bạn có thể điều chỉnh:

private static class ConfigParams {
    RunMode runMode = RunMode.SINGLE_FILE;           // SINGLE_FILE, DIRECTORY, hoặc RL
    String dataLocation = "data/Wang_Chen/src/rdp201.txt"; // File dữ liệu
    String dataSolution = "data/Wang_Chen/solution/rdp201.txt"; // File solution
    String srcDirectory = "data/Wang_Chen/src";      // Thư mục chứa dữ liệu
    String solutionDirectory = "data/Wang_Chen/solution"; // Thư mục chứa solution
    ExportType exportType = ExportType.EXCEL;        // NONE, EXCEL, CSV, TXT, ALL
    int iterations = 30;                             // Số lần chạy lặp
    boolean parallelEnabled = true;                  // Bật/tắt chế độ song song
    int epoch = 1;                                   // Số vòng chạy cho RL
    ReadDataFromFile.ProblemType problemType = ReadDataFromFile.ProblemType.VRPSPDTW_WANG_CHEN;
}

🎮 Cách sử dụng

🔧 Chế độ chạy

  1. SINGLE_FILE: Xử lý một file dữ liệu cụ thể
  2. DIRECTORY: Xử lý tất cả files trong thư mục
  3. RL: Chế độ Reinforcement Learning (tăng cường học)

📊 Kết quả đầu ra

  • Console: Hiển thị tiến trình và kết quả real-time
  • Excel: File chi tiết trong thư mục exports/
  • Performance Report: Báo cáo hiệu suất các thuật toán

🚀 Parallel Processing

Hệ thống tự động:

  • Phát hiện số CPU cores
  • Tối ưu hóa số threads
  • Phân bổ tài nguyên GPU (nếu có)
  • Chạy 4 thuật toán đồng thời

📈 Hiệu suất & Benchmark

⚡ Tốc độ xử lý

  • Single-thread: ~30-60 giây/instance
  • Multi-thread: ~8-15 giây/instance (4 cores)
  • GPU acceleration: Tăng tốc 2-3x (tùy GPU)

🎯 Chất lượng giải pháp

  • Đạt được 95-98% chất lượng so với best-known solutions
  • Convergence nhanh nhờ parallel exploration
  • Robust với nhiều loại problem instances

🔬 Thuật toán & Phương pháp

🧬 Meta-heuristic Algorithms

Thuật toán Mô tả Đặc điểm
SHO Spotted Hyena Optimizer Mô phỏng hành vi săn mồi của linh cẩu đốm
ACO Ant Colony Optimization Dựa trên hành vi tìm đường của đàn kiến
GWO Grey Wolf Optimizer Mô phỏng cấu trúc xã hội và săn mồi của sói xám
WOA Whale Optimization Algorithm Dựa trên hành vi săn mồi bong bóng của cá voi

🔄 Parallel Processing Strategy

  1. Population Initialization: SA tạo quần thể đa dạng
  2. Parallel Execution: 4 thuật toán chạy đồng thời
  3. Solution Sharing: Chia sẻ best solutions giữa các threads
  4. Result Aggregation: Tổng hợp và so sánh kết quả

📊 Datasets & Benchmarks

🚛 VRPTW (Vehicle Routing Problem with Time Windows)

  • Solomon Instances: C1, C2, R1, R2, RC1, RC2
  • Characteristics: 25-100 customers, time windows, capacity constraints

📦 PDPTW (Pickup and Delivery Problem with Time Windows)

  • Li & Lim Instances: LC1, LC2, LR1, LR2, LRC1, LRC2
  • Characteristics: Pickup-delivery pairs, time windows, precedence constraints

🔄 VRPTW & VRPSPDTW Combined

  • CDP Instances: cdp101-cdp208 (Clustered instances)
  • RCDP Instances: rcdp101-rcdp5007 (Random clustered instances)
  • RDP Instances: rdp101-rdp211 (Random instances)
  • Characteristics: Mixed pickup-delivery with time windows

📚 Additional Benchmarks

  • Liu-Tang-Yao Dataset: Specialized benchmark instances
  • Wang-Chen Dataset: Advanced problem instances với rdp201, rdp202, etc.

📖 Tài liệu thuật toán

Dự án bao gồm tài liệu chi tiết về các thuật toán trong thư mục pseudo/:

  • AlgorithmComparison.md: So sánh hiệu suất các thuật toán
  • AntColonyOptimization.md: Chi tiết thuật toán ACO
  • GreyWolfOptimizer.md: Chi tiết thuật toán GWO
  • SimulatedAnnealing.md: Chi tiết thuật toán SA
  • SpottedHyenaOptimizer.md: Chi tiết thuật toán SHO
  • WhaleOptimizationAlgorithm.md: Chi tiết thuật toán WOA

Các tài liệu này bao gồm pseudocode, giải thích chi tiết và ví dụ minh họa.


🛠️ Phát triển & Đóng góp

🤝 Cách đóng góp

  1. Fork repository
  2. Tạo feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Mở Pull Request

🐛 Báo lỗi

  • Sử dụng GitHub Issues
  • Mô tả chi tiết lỗi và cách tái tạo
  • Đính kèm logs và system info

💡 Đề xuất tính năng

  • Mở Discussion hoặc Issue
  • Mô tả use case và lợi ích
  • Thảo luận implementation approach

📚 Tài liệu tham khảo

📖 Papers & Research

  • Solomon, M. M. (1987). "Algorithms for the vehicle routing and scheduling problems with time window constraints"
  • Li, H., & Lim, A. (2001). "A metaheuristic for the pickup and delivery problem with time windows"
  • Dhiman, G., & Kumar, V. (2017). "Spotted hyena optimizer: a novel bio-inspired based metaheuristic technique"

🔗 Useful Links


📄 License

Dự án này được phân phối dưới giấy phép MIT. Xem file LICENSE để biết thêm chi tiết.


📬 Liên hệ & Hỗ trợ


🌟 Acknowledgments

  • Cảm ơn cộng đồng nghiên cứu Operations Research
  • Solomon & Li-Lim benchmark datasets
  • Open source libraries và frameworks được sử dụng
  • Contributors và testers

⭐ Nếu dự án hữu ích, hãy cho chúng tôi một star! ⭐

Made with ❤️ by Logistics Research Team

About

Dự án về nghiên cứu các thuật toán áp dụng cho lĩnh vực logistic

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages