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).
💁♂️ Kaggle Notebook - Chạy thử trực tuyến
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 GPU và họ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.
- 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
- 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
- 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
- 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ợ
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- 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)
git clone https://github.com/khainam23/logistic.git
cd logisticmvn clean installDữ 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
mvn exec:java -Dexec.mainClass="org.logistic.Main"- Mở dự án trong IDE (IntelliJ IDEA, Eclipse, VS Code)
- Chạy file
src/main/java/org/logistic/Main.java
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;
}- SINGLE_FILE: Xử lý một file dữ liệu cụ thể
- DIRECTORY: Xử lý tất cả files trong thư mục
- RL: Chế độ Reinforcement Learning (tăng cường học)
- 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
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
- 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)
- Đạ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 | 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 |
- Population Initialization: SA tạo quần thể đa dạng
- Parallel Execution: 4 thuật toán chạy đồng thời
- Solution Sharing: Chia sẻ best solutions giữa các threads
- Result Aggregation: Tổng hợp và so sánh kết quả
- Solomon Instances: C1, C2, R1, R2, RC1, RC2
- Characteristics: 25-100 customers, time windows, capacity constraints
- Li & Lim Instances: LC1, LC2, LR1, LR2, LRC1, LRC2
- Characteristics: Pickup-delivery pairs, time windows, precedence constraints
- 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
- Liu-Tang-Yao Dataset: Specialized benchmark instances
- Wang-Chen Dataset: Advanced problem instances với rdp201, rdp202, etc.
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.
- Fork repository
- Tạo feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Mở Pull Request
- 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
- Mở Discussion hoặc Issue
- Mô tả use case và lợi ích
- Thảo luận implementation approach
- 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"
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.
- GitHub Repository: https://github.com/khainam23/logistic
- GitHub Issues: Report bugs & feature requests
- Discussions: Community discussions
- Kaggle Demo: Chạy thử trực tuyến
- 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