Smart Delivery Assignment through Machine Learning and the Hungarian Algorithm
Highlights
- Machine learning techniques combined with the Hungarian optimization algorithm improved task assignment tasks for smart delivery transport systems.
- Linear and polynomial regression can be used to create a cost matrix, leading to an improvement up to 11.59% in solving the task assignment problem for smart delivery transport systems.
- Improved task assignment effectiveness in smart delivery transport systems can result in better use of available resources, faster delivery times, and better service for customers.
- In logistics, the use of machine learning and optimization algorithms in smart delivery transport systems can help to build more sustainable and environmentally friendly transportation systems.
Abstract
:1. Introduction
1.1. Related Work
1.2. Main Contribution
- We build a dataset from the MAX Delivery company, headquartered in Barcelona, Spain. The dataset comprises 7707 order records. Each record contains details regarding the time and coordinates of delivery personnel assigned to specific customer orders.
- We use the Haversine formula to accurately compute the distances between delivery people and customer orders. This is essential for generating an assignment matrix to solve the optimization problem related to order allocation.
- We propose two different supervised machine learning methods to estimate delivery time and distance to each customer for each delivery person. This is crucial, as the dataset only contains specific data points for completed deliveries and creating the assignment matrix requires calculating potential delivery times for all delivery person–customer combinations.
- We use the Hungarian algorithm with the cost matrices obtained from the Haversine calculations, as well as the linear and polynomial regression methods. The Hungarian optimization algorithm solves the task assignment problem, which optimally assigns delivery people to customer orders. The algorithm efficiently determines the best possible assignments by considering the costs associated with each assignment and guarantees an optimal solution for this task.
- Finally, we compare the effectiveness of the Haversine calculations, linear regression, and polynomial regression techniques after applying the Hungarian optimization algorithm to solve the task assignment problem.
1.3. Outline
2. Materials and Methods
2.1. Data Acquisition
2.2. Haversine Formula for Estimating Cost Matrix
2.3. ML Algorithms to Determine the Cost Matrix
2.3.1. Linear Regression
Algorithm 1 Gradient descent for solving linear regression [25,26,27] |
|
2.3.2. Polynomial Regression
Algorithm 2 Gradient descent for polynomial regression [27,28,29] |
|
2.4. Hungarian Algorithm
3. Results
3.1. Regression Results
3.2. Task Assignment Problem Results
4. Discussion
- During the implementation of regression algorithms, it can be seen that polynomial regression exceeds linear regression in distance and time estimation tasks. Considering the RMSE, the polynomial regression reaches errors of 4.5 m and 7.7 s, while the linear regression of only 20.3 m and 11 s. However, when applying regression methods together with the Hungarian algorithm it can be noted that the results are similar for all methods. However, linear regression in this case obtains better results, obtaining a total distance traveled from 34,957.74 km and the lowest standard deviation of 3.23 km. This indicates that even though polynomial regression presents less error during training, this does not necessarily imply better functioning when applying it when solving delivery assignment problems.
- The complexity of managing several orders for the automatic assignment of the delivery personnel is one of the inherent inefficiencies of the delivery process. To address this difficulty, it is necessary to consider different scenarios. For example, it should be considered in some way that different orders can be assigned to different distributors, and that the possibility of making an optimal delivery for a customer does not necessarily mean that the entire set of deliveries can be done optimally. Fortunately, optimal assignment algorithms such as the proposed Hungarian algorithm combined with machine learning methods can reduce cost functions to solve optimization problems optimally.
- In this work, we consider Max Delivery, a company headquartered in Barcelona, Spain, which delivers orders to customers within this country. This implies a limited scope to this region for the distances of the orders. However, the distances of orders within this country can be considerably high. For example, if the client is far from the starting point (restaurant), the delivery may need to travel very far to reach the client. From the point of view of developing an application, an economic compensation method for the delivery man, who could make several deliveries within the time it takes to make a distant delivery, should be considered. Another way to improve this process is to try to apply areas by zones to ensure that distributors do not have to travel too far from their home or work zone without receiving additional compensation.
- It is important to mention that consideration for future jobs can be provided as delivery companies prioritize security and packages during transport through several measures. These include comprehensive training programs for personnel, strict background verification, regular vehicle maintenance, and the use of advanced monitoring systems to monitor packages in real time. Secure delivery locations can be considered in the cost function to avoid damage and reduce robberies as well as cost to the nearby systems or security establishments in case of incidents.
- The delivery industry faces important ethical and environmental challenges, including transport carbon emissions, excessive waste, concerns about labor practices, data privacy problems, and community impacts such as traffic congestion and noise pollution. To address these challenges, in future works it would be possible to consider those parameters within the cost functions to be reduced for the assignment of deliveries. Additionally, it is important to consider that delivery companies might adopt sustainable practices such as the use of electric vehicles and recyclable containers. It is important to implement solid data protection measures to prevent vehicles with their orders from interceptions in the event that a cybersecurity problem is suffered in applications.
- Future work could consider issues related to customer satisfaction and behavior, as these directly affect purchases that are distributed via delivery. Late or damaged deliveries can lead to frustration and dissatisfaction, making the optimization of delivery processes to guarantee precision, speed, and reliability essential. Future work could investigate ways to estimate customer satisfaction based on the implementation of a system that generates efficient routes. In addition, flexible delivery options such as scheduled deliveries can be provided to improve customer satisfaction and optimize the allocation algorithm in a scheduled manner.
- Changes in technology and consumer behavior can have a deep impact on the delivery industry. The automatic assignment system could learn or adapt to these changes automatically. In this context, machine learning algorithms such as reinforcement learning could be analyzed in the future to evaluate their possible benefits to solving delivery problems adaptively in the time domain.
- In future works, the following considerations must be taken in order to predict and address possible delays in IA delivery. It is important to analyze large amounts of data from various sources, including historical delivery data, traffic patterns, weather forecasts, and road conditions. In this way, possible real-time delays can be forecast in order to dynamically adapt the delivery routes using AI algorithms together with optimization.
- The selection of monitoring technology for delivery and tracking of packages can significantly affect the cost function to be optimized by the task allocation algorithm. For example, bar scanning, radio frequency identification (RFID), and global positioning system (GPS) can offer real-time monitoring with different advantages and limitations. In future works, the strengths and weaknesses of the use of each of these technologies or the fusion of their information could be evaluated to consider them for application in an optimization algorithm for task assignment such as the one in this work.
- In future works, we will evaluate the use of an Open-Source Routing Machine (OSRM), which is a high-performance routing engine for various transportation tasks such as driving. This source of information could be very interesting in future works, as it can help to improve the cost matrix used to solve the task assignment problem. We will evaluate and compare the use of OSRM with the performance of the proposed approach.
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A
Ref. | Problem | Methodology Description | Disadvantages | Results |
---|---|---|---|---|
[13] | Food delivery service improved with Q-learning and DDQN using rule-based policy. | Emulated food delivery service was modeled using a Markov decision process. Q-learning and DDQN were employed to maximize revenue derived from served requests within a limited number of couriers over a period of time. | Limited scope of the state space, focusing on courier and order location information without incorporating additional relevant attributes, limiting generalizability to larger-scale operations. | DDQN algorithm collects more reward compared to other algorithms. |
[14] | Scheduling problem in crowdsourced delivery platforms. | Machine learning method that combines simulation optimization for off-line training and a neural network. Real-world data provided by a crowdsourced delivery platform were used. | Complex implementation with difficult data requirements, scalability challenges and use of personal data. | Solution quality within 0.2%–1.9% of a bespoke sample average approximation method, while being several orders of magnitude faster regarding online solution generation. |
[19] | Two-echelon vehicle routing for emergency mask delivery during COVID-19. | A hybrid machine learning and heuristic optimization method was proposed to address the delivery of medical masks problem. Deep learning combined with heuristics optimization was used to predict regional delivery demand. | Not considering vehicle refueling or recharging, problematic for electric vehicles in short- and medium-distance delivery. | The average weighted delivery time was reduced up to 61%. |
[18] | Enhancing on-time performance in last-mile delivery services. | A data-driven framework to model delivery performance and optimize order assignments to drivers. Total delivery time was decomposed into uncertain service time at customer locations and predictable travel time. A prediction model for delivery tour length was then developed. | Lacks discussion on potential limitations of implementing data-driven optimization strategies in last-mile delivery services. | Advantages of data-driven order assignment models integrated with delivery tour prediction over classical vehicle routing problems. Method Average mean square error (MSE): LASSO (0.314), Ridge regression (0.317), SVR (0.295), Random forest (0.304). |
Ref. | Problem | Methodology Description | Disadvantages | Results |
---|---|---|---|---|
[5] | Optimization under uncertainty in the context of last-mile delivery and third-party logistics, concentrated on solving the variable cost and size bin packing. | Metaheuristic algorithms were used to optimize decision-making in logistics, and machine learning enhanced decisions by learning from data patterns, making predictions, and offering recommendations in logistics operations. | Limited discussion on the scalability and generalizability of the proposed machine learning optimization approach. | Progressive Hedging and Machine Learning approaches generate closely aligned first-stage solutions with minor variations in their outcomes. |
[9] | Impact of the limited available resources in the meal delivery. | Implemented a Markov decision process and employed deep reinforcement learning with eight Deep Q-Networks (DQN) algorithms. | Exclusion of different characteristics of couriers, such as varying delivery speeds or behaviors, which may impact the real-world applicability. | Increasing the number of couriers in a delivery system results in higher rewards and fewer rejected orders. |
[10] | Mixed-integer programming formulation for drone vehicle routing (VRPD) by assigning clients to drone-truck pairs. | An ant colony optimization (ACO) algorithm was developed. | Do not delve deeply into the real-world implementation challenges and regulatory hurdles of integrating drones into existing delivery systems. | The ACO algorithm outperformed classic VRP by achieving cost savings of more than 30% for large instances. |
[12] | Enhance customer satisfaction | Employed the LSTM to predict future levels of customer satisfaction. | Do not address scalability challenges, implementation barriers, or real-world case studies to demonstrate the effectiveness of the proposed approach. | A smart contract was designed to provide compensation and/or refunds to customers when their satisfaction with the delivery services was low. |
[15] | Assigning food orders to delivery vehicles to minimizes delivery time. | The algorithm FOODMATCH was designed to tackle vehicle assignment by treating it as a minimum weight perfect matching problem on a bipartite graph. | The generalizability of the findings to other regions or platforms may be limited. | Achieving a 30% reduction in delivery time. |
Ref. | Problem | Methodology Description | Disadvantages | Results |
---|---|---|---|---|
[20] | Optimize recharging, delivering, and repositioning task assignments for electric vehicles. | Modeled as a multi-agent multi-task dynamic dispatching problem using a Markov Decision Process. | Lack of comparative analysis with existing methods could limit the assessment of the novelty and effectiveness. | Total revenue up by 33.2%; Task allocation repositioning raised total revenue by 50.0%; Re-estimated state value function boosted total revenue by 2.8%. |
[21] | Income guarantees for delivery agents, minimize costs and ensure customer satisfaction. | The WORK4FOOD algorithm was designed and implemented, utilizing minimum weight bipartite matching and Gaussian process regression to assess the demand-supply dynamics. | Do not address the potential challenges or barriers to implementing WORK4FOOD in existing food delivery platforms. | Reduced platform costs by up to 25% compared to solutions like FOODMATCH and FAIRFOODY, achieving a balance between cost, delivery times, and fairness. |
[16] | Delivery assignment based on order-to-vehicle, order batching, and vehicle movements. | Papping the vehicle assignment problem to minimum weight perfect matching. Best-first search utilized to construct a subgraph likely to contain the minimum matching. | Limited discussion on the environmental impact of increased food delivery services and vehicle usage. | Reduced food delivery time, waiting time at restaurants, and increased orders delivered per kilometer. |
[17] | Efficient allocation of orders to drivers and route planning. | Modified Kuhn-Hungarian (Munkres) algorithm for orders-drivers matching. Machine learning to predict order batching. Plus, rule-based route planning for viable routes for drivers. | Lack of realistic constraints for the online food delivery problem, such as the uncertainty of travel time and dynamic arrival of orders. | Satisfying performance of the classification model on real datasets and effectiveness of the proposed algorithm for solving the OFDP. |
References
- Farooq, Q.; Fu, P.; Hao, Y.; Jonathan, T.; Zhang, Y. A review of management and importance of e-commerce implementation in service delivery of private express enterprises of China. Sage Open 2019, 9, 2158244018824194. [Google Scholar] [CrossRef]
- Fadda, E.; Perboli, G.; Tadei, R. Customized multi-period stochastic assignment problem for social engagement and opportunistic IoT. Comput. Oper. Res. 2018, 93, 41–50. [Google Scholar] [CrossRef]
- Fadda, E.; Perboli, G.; Tadei, R. A progressive hedging method for the optimization of social engagement and opportunistic IoT problems. Eur. J. Oper. Res. 2019, 277, 643–652. [Google Scholar] [CrossRef]
- Giuffrida, N.; Fajardo-Calderin, J.; Masegosa, A.D.; Werner, F.; Steudter, M.; Pilla, F. Optimization and machine learning applied to last-mile logistics: A review. Sustainability 2022, 14, 5329. [Google Scholar] [CrossRef]
- Bruni, M.E.; Fadda, E.; Fedorov, S.; Perboli, G. A machine learning optimization approach for last-mile delivery and third-party logistics. Comput. Oper. Res. 2023, 157, 106262. [Google Scholar] [CrossRef]
- Reis, J.; Amorim, M.; Cohen, Y.; Rodrigues, M. Artificial intelligence in service delivery systems: A systematic literature review. In Trends and Innovations in Information Systems and Technologies: Volume 1; Springer: Cham, Switzerland, 2020; pp. 222–233. [Google Scholar]
- Gursoy, D.; Chi, O.H.; Lu, L.; Nunkoo, R. Consumers acceptance of artificially intelligent (AI) device use in service delivery. Int. J. Inf. Manag. 2019, 49, 157–169. [Google Scholar] [CrossRef]
- Adak, A.; Pradhan, B.; Shukla, N.; Alamri, A. Unboxing deep learning model of food delivery service reviews using explainable artificial intelligence (XAI) technique. Foods 2022, 11, 2019. [Google Scholar] [CrossRef]
- Jahanshahi, H.; Bozanta, A.; Cevik, M.; Kavuk, E.M.; Tosun, A.; Sonuc, S.B.; Kosucu, B.; Başar, A. A deep reinforcement learning approach for the meal delivery problem. Knowl.-Based Syst. 2022, 243, 108489. [Google Scholar] [CrossRef]
- Huang, S.H.; Huang, Y.H.; Blazquez, C.A.; Chen, C.Y. Solving the vehicle routing problem with drone for delivery services using an ant colony optimization algorithm. Adv. Eng. Inform. 2022, 51, 101536. [Google Scholar] [CrossRef]
- Asih, A.M.S.; Sopha, B.M.; Kriptaniadewa, G. Comparison study of metaheuristics: Empirical application of delivery problems. Int. J. Eng. Bus. Manag. 2017, 9, 1847979017743603. [Google Scholar] [CrossRef]
- Tian, Z.; Zhong, R.Y.; Vatankhah Barenji, A.; Wang, Y.; Li, Z.; Rong, Y. A blockchain-based evaluation approach for customer delivery satisfaction in sustainable urban logistics. Int. J. Prod. Res. 2021, 59, 2229–2249. [Google Scholar] [CrossRef]
- Bozanta, A.; Cevik, M.; Kavaklioglu, C.; Kavuk, E.M.; Tosun, A.; Sonuc, S.B.; Duranel, A.; Basar, A. Courier routing and assignment for food delivery service using reinforcement learning. Comput. Ind. Eng. 2022, 164, 107871. [Google Scholar] [CrossRef]
- Behrendt, A.; Savelsbergh, M.; Wang, H. A prescriptive machine learning method for courier scheduling on crowdsourced delivery platforms. Transp. Sci. 2023, 57, 889–907. [Google Scholar] [CrossRef]
- Joshi, M.; Singh, A.; Ranu, S.; Bagchi, A.; Karia, P.; Kala, P. Batching and matching for food delivery in dynamic road networks. In Proceedings of the 2021 IEEE 37th International Conference on Data Engineering (ICDE), Chania, Greece, 19–22 April 2021; pp. 2099–2104. [Google Scholar]
- Joshi, M.; Singh, A.; Ranu, S.; Bagchi, A.; Karia, P.; Kala, P. FoodMatch: Batching and matching for food delivery in dynamic road networks. ACM Trans. Spat. Algorithms Syst. (TSAS) 2022, 8, 1–25. [Google Scholar] [CrossRef]
- Wang, X.; Wang, L.; Wang, S.; Yu, Y.; Chen, J.f.; Zheng, J. Solving online food delivery problem via an effective hybrid algorithm with intelligent batching strategy. In International Conference on Intelligent Computing; Springer: Cham, Switzerland, 2021; pp. 340–354. [Google Scholar]
- Liu, S.; He, L.; Shen, Z.J.M. Data-driven order assignment for last mile delivery. SSRN Electron. J. 2018, 9, 1–44. [Google Scholar] [CrossRef]
- Chen, X.; Yan, H.F.; Zheng, Y.J.; Karatas, M. Integration of machine learning prediction and heuristic optimization for mask delivery in COVID-19. Swarm Evol. Comput. 2023, 76, 101208. [Google Scholar] [CrossRef] [PubMed]
- Wang, N.; Guo, J. Multi-task dispatch of shared autonomous electric vehicles for Mobility-on-Demand services–combination of deep reinforcement learning and combinatorial optimization method. Heliyon 2022, 8, e11319. [Google Scholar] [CrossRef] [PubMed]
- Nair, A.; Yadav, R.; Gupta, A.; Chakraborty, A.; Ranu, S.; Bagchi, A. Gigs with guarantees: Achieving fair wage for food delivery workers. arXiv 2022, arXiv:2205.03530. [Google Scholar]
- Robusto, C.C. The cosine-haversine formula. Am. Math. Mon. 1957, 64, 38–40. [Google Scholar] [CrossRef]
- Basyir, M.; Nasir, M.; Suryati, S.; Mellyssa, W. Determination of nearest emergency service office using haversine formula based on android platform. EMITTER Int. J. Eng. Technol. 2017, 5, 270–278. [Google Scholar] [CrossRef]
- Ashraf, S.; Saleem, S.; Ahmed, T.; Aslam, Z.; Shuaeeb, M. Iris and Foot based Sustainable Biometric Identification Approach. In Proceedings of the 2020 International Conference on Software, Telecommunications and Computer Networks (SoftCOM), Split, Croatia, 17–19 September 2020; pp. 1–6. [Google Scholar] [CrossRef]
- Maulud, D.; Abdulazeez, A.M. A review on linear regression comprehensive in machine learning. J. Appl. Sci. Technol. Trends 2020, 1, 140–147. [Google Scholar] [CrossRef]
- Hope, T.M. Linear regression. In Machine Learning; Elsevier: Amsterdam, The Netherlands, 2020; pp. 67–81. [Google Scholar]
- James, G.; Witten, D.; Hastie, T.; Tibshirani, R. An Introduction to Statistical Learning; Springer: New York, NY, USA, 2013; Volume 112. [Google Scholar]
- Heiberger, R.M.; Neuwirth, E.; Heiberger, R.M.; Neuwirth, E. Polynomial regression. In R Through Excel: A Spreadsheet Interface for Statistics, Data Analysis, and Graphics; Springer: New York, NY, USA, 2009; pp. 269–284. [Google Scholar]
- Ostertagová, E. Modelling using Polynomial Regression. Procedia Eng. 2012, 48, 500–506. [Google Scholar] [CrossRef]
- Shah, K.; Reddy, P.; Vairamuthu, S. Improvement in Hungarian algorithm for assignment problem. In Artificial Intelligence and Evolutionary Algorithms in Engineering Systems: Proceedings of ICAEES 2014, Volume 1; Springer: New Delhi, India, 2015; pp. 1–8. [Google Scholar]
- Sanseverino, E.R.; Ngoc, T.N.; Cardinale, M.; Vigni, V.L.; Musso, D.; Romano, P.; Viola, F. Dynamic programming and Munkres algorithm for optimal photovoltaic arrays reconfiguration. Sol. Energy 2015, 122, 347–358. [Google Scholar] [CrossRef]
MSE | RMSE | |
---|---|---|
Distance estimation- linear regression | 6.9 m2 | 20.3 m |
Distance estimation- polynomial regression | 2.6 m2 | 4.5 m |
Time estimation- linear regression | 120.9 s2 | 11.0 s |
Time estimation- polynomial regression | 59.6 s2 | 7.7 s |
Method | Average (km) | Standard Deviation (km) | Summation of Total Distance (km) |
---|---|---|---|
Hungarian | 4.55 | ±3.24 | 34,956.84 |
Linear regression + Hungarian | 4.55 | ±3.23 | 34,957.74 |
Polynomial regression + Hungarian | 4.62 | ±4.49 | 35,526.26 |
Average (min) | Standard Deviation (min) | Summation of Total Time (min) | |
---|---|---|---|
Linear Regression + Hungarian | 19.24 | ±9.12 | 147,891.23 |
Polynomial Regression + Hungarian | 17.01 | ±5.25 | 130,747.82 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Vásconez, J.P.; Schotborgh, E.; Vásconez, I.N.; Moya, V.; Pilco, A.; Menéndez, O.; Guamán-Rivera, R.; Guevara, L. Smart Delivery Assignment through Machine Learning and the Hungarian Algorithm. Smart Cities 2024, 7, 1109-1125. https://doi.org/10.3390/smartcities7030047
Vásconez JP, Schotborgh E, Vásconez IN, Moya V, Pilco A, Menéndez O, Guamán-Rivera R, Guevara L. Smart Delivery Assignment through Machine Learning and the Hungarian Algorithm. Smart Cities. 2024; 7(3):1109-1125. https://doi.org/10.3390/smartcities7030047
Chicago/Turabian StyleVásconez, Juan Pablo, Elias Schotborgh, Ingrid Nicole Vásconez, Viviana Moya, Andrea Pilco, Oswaldo Menéndez, Robert Guamán-Rivera, and Leonardo Guevara. 2024. "Smart Delivery Assignment through Machine Learning and the Hungarian Algorithm" Smart Cities 7, no. 3: 1109-1125. https://doi.org/10.3390/smartcities7030047
APA StyleVásconez, J. P., Schotborgh, E., Vásconez, I. N., Moya, V., Pilco, A., Menéndez, O., Guamán-Rivera, R., & Guevara, L. (2024). Smart Delivery Assignment through Machine Learning and the Hungarian Algorithm. Smart Cities, 7(3), 1109-1125. https://doi.org/10.3390/smartcities7030047