1. Introduction
In recent years, e-commerce has developed rapidly in China. This growth has led to a surge in logistics demand. Consequently, e-commerce companies now face greater pressure to reduce their carbon emissions. In the last-mile delivery scenario of e-commerce, traditional logistics face challenges in balancing efficiency improvements with carbon emission reductions, creating an urgent need to break through the constraints between fulfillment costs, capacity flexibility, and green compliance [
1,
2]. The two-echelon vehicle routing problem (2E-VRP) describes a specific distribution model. In this model, goods are first transported from a central warehouse to a satellite. They are then delivered from the satellite to the end customers [
3]. Although this delivery model has attracted attention, existing research is mostly based on fixed fleets and structured networks, making it difficult to adapt to the growing number of orders and the need for green transformation.
Occasional drivers refers to outsourcing tasks that would typically be performed by company employees to the general public on a voluntary basis. By leveraging the collective intelligence and power of the public, it optimizes the allocation of external resources and reduces company costs [
4]. Occasional drivers can enhance fulfillment capacity at a lower cost, offering strong flexibility and fast customer response times, and can combine with urban commuting routes to reduce the need for company vehicle fleets [
5,
6].
Meanwhile, the flexible supplementation of delivery capacity through crowdsourced logistics provides a novel pathway for the development of green logistics in e-commerce. The Green Vehicle Routing Problem (GVRP) refers to an environmentally friendly solution aimed at reducing energy consumption and pollution, taking into account factors such as vehicle type and speed [
7]. GVRP and 2E-VRP have both been extensively studied in theory and algorithms. However, research on integrating crowdsourced capacity into urban green logistics systems remains limited. Specifically, there is still a lack of a mature framework for coordinating proprietary and crowdsourced capacity in multi-agent collaborative optimization. To fill this gap, this study develops a green last-mile delivery routing optimization model that incorporates a crowdsourcing mode. The model aims to improve resource utilization efficiency and lower carbon emissions. It also provides theoretical and practical support for the green transition of e-commerce companies and delivery platforms.
To address the green two-stage vehicle routing problem in crowd-sourced logistics, this paper divides the problem into two stages: determining the allocation of customer points to transfer centers and solving the two-stage vehicle routing problem. In the first stage, the AP clustering method is used to assign customer points to transfer centers. In the second stage, a green two-stage mixed vehicle routing problem is solved. To address this issue, a collaborative Two-Echelon logistics and distribution model involving both specialized vehicles and occasional drivers is proposed, and a green Two-Echelon Vehicle Routing delivery model is constructed under this framework. For solving the second-stage problem, an improved whale optimization algorithm (Sparrow–Whale Optimization Algorithm, S-WOA) is proposed. This two-stage distribution system not only improves logistics efficiency but also helps reduce urban traffic congestion, improve air quality, and lower last-mile delivery costs.
In summary, the contributions of this research are as follows:
- (1)
For the urban logistics delivery optimization problem, this study systematically integrates occasional drivers into the two-echelon vehicle routing problem. To respond to this, carbon emissions are included as a key objective in the model, aiming to explore the practical effects of the hybrid delivery mode on reducing both urban logistics delivery costs and carbon emissions within the system.
- (2)
A mixed integer linear programming model is established for the two-stage vehicle routing problem, taking into account carbon emissions and the participation of occasional drivers.
- (3)
An improved whale optimization algorithm (S-WOA) is proposed to solve the two-stage vehicle routing problem considering carbon emissions and occasional drivers.
- (4)
A sensitivity analysis is conducted to explore the impact of different delivery modes and parameter variations on the two-stage vehicle routing problem, providing insights into the issue of carbon emissions and the involvement of occasional drivers in two-stage vehicle routing.
The remainder of this paper is organized as follows:
Section 2 discusses the relevant literature.
Section 3 provides a description of the two-stage vehicle routing problem considering carbon emissions and crowd-sourced drivers, along with the mixed integer linear programming model.
Section 4 describes the proposed S-WOA.
Section 5 presents the computational results. Finally,
Section 6 concludes the study and provides suggestions for future work.
4. Sparrow–Whale Optimization Algorithm
To solve the proposed bi-objective optimization model, this paper follows the common approach in most research in this field, using the weighted sum method to transform the bi-objective problem into a single-objective problem for solution. For the solution algorithm, a hybrid heuristic method, the Sparrow–Whale Optimization Algorithm (S-WOA), is designed by integrating the sparrow search mechanism [
39] with the whale optimization algorithm [
40,
41], aiming to enhance overall solution performance.
The selection and improvement of the algorithm are motivated by preliminary experimental comparisons. These comparisons show that the standard whale optimization algorithm demonstrates strong local search capability. However, it also reveals limitations in global exploration. Specifically, it tends to become trapped in local optima when solving the problem addressed in this study. To overcome this issue, this paper introduces the group division mechanism from the sparrow search algorithm. The purpose of this enhancement is to strengthen the algorithm’s global exploration ability during the early stages. This step also provides a higher-quality initial population for subsequent local fine-tuning searches.
4.1. Chromosome Encoding and Decoding
The chromosome encoding in this algorithm uses positive integer encoding. The encoding is divided into two stages for the problem being solved. In the first stage, trucks transport goods from the distribution center to satellites. The length of the chromosome in this stage is the total number of vehicles and satellites minus one. In the second stage, crowd-sourced vehicles or professional vehicles depart from the satellites to deliver orders to customer locations. The length of the chromosome in this stage is the sum of the number of crowd-sourced vehicles, professional vehicles, customer points at the satellite, and crowd-sourced destinations. Different chromosomes represent different delivery plans.
The decoding method in the second stage differs from that in the first stage. The second stage employs strong constraints, requiring that the travel distance of crowd-sourced vehicles must meet the detour distance; otherwise, no delivery will occur. Additionally, there is a strong constraint on professional vehicles, ensuring that the total weight of goods transported does not exceed the vehicle’s capacity. If the total weight exceeds this limit, no delivery will occur.
For example, in a problem with 2 satellites and 10 customer points, given a first-stage chromosome of {3, 1, 2} and second-stage chromosomes for satellite 1 and 2 as {1, 2, 3, 5, 4, 6, 9, 10, 8, 7, 11, 12} and {2, 1, 5, 3, 4, 10, 7, 6, 8, 9, 12, 11, respectively, the decoded delivery plan can be summarized as follows: Truck 2 delivers goods to both satellites. From Satellite 1, customers 1, 5, 7, 4, and 3 will be served in sequence; from Satellite 2, customers 10, 6, 2, 8, and 9 will be served in sequence.
A delivery route diagram is shown in
Figure 2.
4.2. Global Search Operation
The core design of the S-WOA is as follows: Inspired by the producer–follower–explorer model in the sparrow search algorithm, this approach divides the whale population individuals into different roles. Among them, most individuals are designated as “producers”, responsible for extensively exploring the solution space. The remaining individuals are assigned as “followers”, who leverage the information provided by the producers to further develop the search process. Additionally, 10–20% of the individuals are randomly selected as “explorers”, continuously monitoring environmental risks, and when necessary, guiding the population to escape local optima.
The position update formula for producers is as follows:
Here, represents the current iteration number, . denotes the value of the -th row of the -th chromosome at iteration . is the number of iterations. is a random number. and represent the alarm value and the safety threshold, respectively. is a random number following a normal distribution. represents a matrix filled entirely with ones.
The position update formula for followers is as follows:
Here, represents the best individual in the initial population. denotes the worst individual in the initial population. represents a random number between −1 and 1.
The update formula for discoverers is as follows:
Here, is a random number following the standard normal distribution (with a mean of 0 and a standard deviation of 1), is a random number, denotes the fitness of the current individual, represents the best fitness in the population, and denotes the worst fitness in the population.
After the population changes, in order to ensure normal decoding operations, an integer normalization process is applied to the chromosomes. The changed chromosomes are sorted, and the serial number corresponding to each position of the chromosome is recorded. Finally, these serial numbers are used to replace the corresponding positions in the chromosomes.
4.3. Algorithm Flow
The steps of Sparrow–Whale Optimization Algorithm (S-WOA) are as follows:
Step 1: Initialization. Initialize the vehicle-related parameters, including cargo capacity, fuel consumption per unit distance, cost per unit distance, and fixed vehicle usage costs, etc. Set the population size, algorithm parameters, and maximum number of iterations. Generate the initial population.
Step 2: Population Evaluation and Role Division. Evaluate the fitness of the initial population based on Equations (13)–(15) and rank the individuals accordingly. Select the individuals with better fitness as producers, according to the predefined producer ratio, and record , and the producer individuals.
Step 3: Record Current Status. Record the current population, best solution, best individual, worst solution, and worst individual.
Step 4: Iterative Optimization. Set the maximum number of iterations , and the current iteration number . Enter the loop structure:
Step 4.1: Parameter Generation. Randomly generate the warning value for the current iteration and the explorer ratio .
Step 4.2: Producer Update. Generate a random number and update the producer’s position according to Equation (36). The new individual is then normalized. If the new individual’s fitness is better than the original one, replace the original individual; otherwise, keep the original individual.
Step 4.3: Follower Update. Update the follower’s individual based on Equation (37), normalize the new position, and compare the fitness of the new and old individuals. Retain the individual with better fitness.
Step 4.4: Explorer Update. Randomly select a proportion of individuals to act as explorers. Update their positions according to Equation (38) and normalize their positions. Retain the better individuals.
Step 4.5: Local Search. Perform a local search operation on the updated population P2.
Step 4.6: Record Update. Re-identify and record the best solution, best individual, worst solution, and worst individual in the updated population.
Step 5: Termination Check. If , then ; set as the initial population for the next generation and return to Step 4.1. If the termination condition is met, proceed to Step 6.
Step 6: Output Results. Output the global best solution, and the algorithm ends.
The flowchart of the algorithm is shown in
Figure 3.
5. Experiments and Analysis
This section evaluates the performance of the improved S-WOA and the feasibility of the collaborative delivery model through extensive computational experiments. The dataset and the parameter settings of the S-WOA algorithm are described, and the experimental results are discussed.
5.1. Data and Parameter Settings
In the computational experiments, the dataset used in this study is an adaptive adjustment of the widely used two-level vehicle routing problem benchmark dataset in the industry. The original dataset contains six series from set1 to set6, and this study selects three series: set2, set3, and set5, totaling 18 instances, to cover different problem sizes. To systematically validate the performance of the improved algorithm in different scenarios, the selected instances are divided into three size levels: Scale I: (1 distribution center—2 or 4 transfer centers—50 customer points), Scale II: (1 distribution center—5 or 10 transfer centers—100 customer points), Scale III: (1 distribution center—10 transfer centers—200 customer points).
Regarding parameter settings, this study first determines the initial range of the parameters based on the relevant literature, and then further optimizes the range through trial and error to arrive at the optimal parameter combination. The specific parameter values are shown in
Table 3.
The remaining part of this section presents experiments conducted using the S-WOA and other heuristic algorithms at different scales, based on the parameters mentioned above. All algorithms in this paper were written in MATLAB R2020b, and all experiments were tested on a machine with 8 GB RAM and an Intel Core i5-8265U CPU, 1.80 GHz processor.
5.2. Algorithm Comparison and Analysis
In the testing experiments, this paper first obtains the customer point sets for each transfer center through AP clustering. The improved Whale Optimization Algorithm (S-WOA), Whale Optimization Algorithm (WOA), Grey Wolf Optimization Algorithm (GWO), Sparrow Search Algorithm (SSA), and Genetic Algorithm (GA) are then used to solve the two-level hybrid vehicle routing problem in the crowdsourcing mode. For each test case, the algorithms are run 30 times.
Table 4,
Table 5,
Table 6,
Table 7,
Table 8 and
Table 9 present the comparison results for all test cases, and
Figure 4,
Figure 5 and
Figure 6 show the numerical comparison results after running each algorithm 30 times.
Figure 7 show the algorithm iteration diagram for Example I, II, III. The comparison includes the best solution, the worst solution, the average of the 30 solutions, the standard deviation, and the average solution time over 30 runs. Here, ”best” represents the optimal solution, “worst” represents the worst solution, “ave” represents the average value, “SD” represents the standard deviation, and “time” represents the time.
In the comparative experiments on Dataset I, the proposed S-WOA comprehensively outperforms the WOA, SSA, GWO, and GA algorithms in terms of the best, worst, and average solutions. Specifically, the results of S-WOA are significantly better than those of all the compared algorithms, with relative improvements exceeding 18% over the baseline performance, and it demonstrates better stability in most cases. Although the solving time of S-WOA is slightly longer than that of WOA and GWO, it remains within an acceptable range overall.
In Dataset II, S-WOA continues to maintain a comprehensive leading position: its best, worst, and average solutions are all superior to those of the compared algorithms, with relative improvements exceeding 20%, while also exhibiting better stability in most instances. The solving time of S-WOA remains slightly higher than that of WOA and GWO, but compared to SSA and GA, the time performance is within a reasonable range.
In the experiments on Dataset III, S-WOA similarly performs the best across all solution quality metrics: its best, worst, and average solutions outperform all the compared algorithms, with relative improvements exceeding 23%, and it demonstrates good robustness. Consistent with the previous results, its running time is slightly longer than that of WOA and GWO, which is primarily due to the enhancement mechanisms introduced in the algorithm.
In summary, S-WOA consistently and significantly improves solution accuracy and stability across all three datasets. Although the computational time increases slightly, its notable advancements in core performance metrics make it a more competitive solution.
5.3. Mode Comparison Analysis
This study validates the superiority of the proposed collaborative two-echelon logistics and distribution model. This model involves both specialized vehicles and occasional drivers. Its performance is compared with a conventional two-echelon model that uses only specialized vehicles. To conduct this comparison, we solve the aforementioned 18 datasets. The corresponding results are provided in
Table 10. The iteration diagram for the representative test case is presented in
Figure 8, where C represents the two-echelon logistics and distribution model with collaboration between specialized vehicles and crowdsourced drivers, and S represents the two-echelon logistics and distribution model using only specialized vehicles.
The experimental results show that, for the same instance, compared to the traditional two-echelon logistics and distribution model with specialized vehicles, the two-echelon logistics and distribution model with collaboration between specialized vehicles and occasional drivers performs better in both vehicle path costs and carbon emission costs. This validates the comprehensive advantages of the hybrid delivery mode in terms of both economic and environmental benefits.
5.4. Instance Analysis
To objectively evaluate the performance of the improved Whale Optimization Algorithm in a real-world environment, a small-scale practical application case was introduced for testing. The algorithm was run 30 times, and the average value was taken as the test result. The case comes from a company in China, where the delivery process starts from a depot, with 3 satellite at the first- echelon and a total of 56 customer points at the second level. The test results are shown in
Table 11, and the algorithm iteration diagram is shown in
Figure 9.
Based on practical application cases, the two-echelon logistics and distribution model with collaboration between specialized vehicles and occasional drivers effectively reduces both operational and carbon emission costs. The model fully utilizes the flexibility of crowdsourced transportation capacity, not only reducing fleet vehicle route costs but also significantly cutting carbon emissions due to more efficient transportation routes.
5.5. Sensitivity Analysis
To make the proposed management recommendations more accurate and targeted, a sensitivity analysis was conducted on the crowdsourcing detour coefficient and crowdsourcing compensation coefficients used in the model. The dataset used is from the two-level vehicle routing dataset set5 series, specifically the dataset of 5 transfer centers and 100 customer points.
Table 12 demonstrates the impact of different crowdsourcing detour coefficients on the number of vehicles used, total costs, and carbon emission costs. “Ave” represents the average total cost after 10 runs, while “carbon” represents the average carbon emission cost after 10 runs.
Figure 10a,b show the number of vehicles and cost graphs under different crowdsourcing detour coefficients, with 5 scenarios generated for detour coefficients ranging from 1.1 to 1.5.
Table 13 shows the impact of different crowdsourcing compensation coefficients on the number of vehicles used, total costs, and carbon emission costs.
Figure 11a,b display the number of vehicles and cost graphs under different crowdsourcing compensation coefficients, with 5 scenarios generated for compensation factors ranging from 1.6 to 2. Here, T represents trucks, S specialized vehicles, and C represents crowdsourced vehicles.
Sensitivity analysis regarding the crowdsourcing detour coefficient is presented in
Table 12 and
Figure 10a,b. As the detour coefficient increases, the system tends to dispatch more occasional drivers while reducing the number of customer points served by specialized vehicles when solving the same dataset. This adjustment in scheduling strategy not only lowers the total system cost but also reduces carbon emission costs. The results indicate that appropriately increasing the detour coefficient can optimize route planning and vehicle resource allocation, thereby enhancing the overall performance of the two-tier vehicle delivery system.
Analysis of the crowdsourcing compensation coefficient is shown in
Table 13 and
Figure 11a,b. A rise in the compensation coefficient leads the system to assign more customer points to specialized vehicles, correspondingly decreasing reliance on occasional drivers. However, this shift in strategy results in an increase in both total operating costs and carbon emissions. Thus, from a holistic system optimization perspective, adopting a lower crowdsourcing compensation coefficient is more conducive to achieving synergy between cost and environmental objectives.
5.6. Management Insights
At the management practice level, based on the above experimental results and sensitivity analysis, this study offers the following recommendations for e-commerce logistics management:
- (1)
E-commerce platforms should deeply embed the collaboration between specialized vehicles and occasional drivers into their fulfillment infrastructure system, driving the evolution of delivery systems from single fleets to dynamic socialized capacity networks. The results of this study (as shown in
Table 8) indicate that this model can effectively integrate professional transportation capacity with distributed crowdsourcing resources. Platforms should establish a closed-loop mechanism for order allocation and vehicle dispatch. This system-level approach enables efficient collaboration between fleet vehicles and occasional drivers, thereby reducing overall operational costs and carbon emissions.
- (2)
Delivery platforms and e-commerce platforms should jointly establish a dynamic order allocation mechanism integrated with routing optimization capabilities, enabling real-time synchronization among vehicle route planning, online ordering systems, and delivery platforms. This study validates the potential of such a mechanism through simulations (
Figure 8). Within the platform’s decision logic, an optimization model should be developed to determine whether orders are assigned to specialized vehicles or occasional drivers. By incorporating real-time traffic conditions, capacity distribution, and cost structures, this approach achieves intelligent order assignment and synchronized route planning.
- (3)
Crowdsourced delivery platforms should develop differentiated detour management strategies and dynamic compensation mechanisms based on the spatial distribution of orders and delivery time requirements. Simulation results from this study (
Figure 9) show that rigid detour restrictions can limit crowdsourcing coverage. At the system level, interconnected rules between detour coefficients and compensation pricing should be modeled. This approach should prioritize efficiency in urban areas while appropriately relaxing detour restrictions in suburban and county regions to expand coverage. Additionally, compensation for occasional drivers should be dynamically adjusted based on regional order density, delivery difficulty, and temporal fluctuations, thereby balancing service quality with cost control.
- (4)
Establish a credit and incentive system for crowdsourced delivery capacity that integrates routing optimization and environmental objectives. Simulation analysis (
Figure 10) shows that reasonable incentives can guide more environmentally friendly and efficient delivery behaviors. Platforms should incorporate occasional delivery vehicles into a unified carbon footprint monitoring system, incorporating route compliance, delivery timeliness, and environmental performance into credit evaluations. Through systematic modeling, a reasonable compensation structure should be established to avoid service quality degradation and secondary delivery waste caused by insufficient incentives.
- (5)
Promote the joint establishment of a data collaboration platform by e-commerce enterprises, logistics service providers, and crowdsourcing platforms to integrate order, inventory, delivery capacity, and routing information. Based on the research and analysis, enable high-frequency interaction between route planning and fulfillment systems through system interfaces, supporting real-time dynamic route replanning and capacity rescheduling to systematically address order peaks and delivery capacity fluctuations.
- (6)
At the e-commerce platform level, establish a global decision support model to systematically model key decision variables including order allocation logic, compensation strategies, acceptance rate prediction, and route optimization. Comprehensive experimental analysis indicates that systematic modeling is key to success. The platform should develop a decision engine integrated with intelligent optimization algorithms to achieve smart scheduling and sustainable management of the hybrid capacity system, thereby supporting the realization of a green e-commerce logistics framework from the system architecture level.
6. Conclusions
In the current context of the deepening development of sustainability, green, and low-carbon concepts, the logistics delivery system is facing an urgent need for systemic upgrades. However, existing research has mainly focused on efficiency improvement and cost control. Relatively less attention has been given to carbon emissions. Therefore, this paper innovatively introduces an occasional driver model based on the two-echelon vehicle routing problem. It further investigates the green two-echelon hybrid vehicle routing problem under this occasional driver model. A mathematical model is constructed with the aim of reducing both vehicle routing costs and carbon emission costs. This explores new pathways for the green transformation of logistics systems from the perspective of sustainable transportation.
At the theoretical level, this study extends the traditional vehicle routing problem framework. It builds a hybrid delivery model that combines trucks, specialized vehicles, and occasional drivers. This deepens research on resource coordination and green scheduling strategies in e-commerce logistics management. The introduction of occasional drivers not only activates idle social transport capacity but also optimizes route structures. Consequently, it reduces unnecessary driving by specialized vehicles, thereby lowering overall system energy consumption and carbon emissions. This provides new theoretical support for advancing the greening of logistics systems.
In terms of methodology, this paper proposes an improved Whale Optimization Algorithm, referred to as S-WOA. The algorithm is tested through numerical experiments using three instances of different scales. It is compared with the WOA, SSA, GWO, and GA algorithms. The results show that S-WOA outperforms the other algorithms in both solution efficiency and solution quality. Thus, it offers a reliable tool for algorithmic research in sustainable logistics delivery.
Additionally, this paper analyzes the key factors affecting path costs and carbon emission costs under the occasional driver model. Three factors are considered: the delivery model, the occasional driver detour coefficient, and the occasional driver compensation coefficient. The study finds that the collaborative delivery mode significantly reduces total costs. It also reveals that coordinated management of detour flexibility and compensation multipliers is crucial for cost control. These findings offer direct implications for e-commerce platform management. Platforms should establish a dynamic correlation model that integrates detour constraints and compensation mechanisms. This framework should be embedded into the core decision-making logic for order allocation and route planning. Such an approach enables the simultaneous optimization of costs and CO2 emissions while maintaining service quality.
This study still has certain limitations. The basic assumptions made, such as “constant vehicle speed” and “occasional drivers can be immediately replenished”, are relatively idealized and fail to fully account for real-world constraints such as urban traffic congestion, regional disparities in supply capacity, and dynamic changes in road networks. Consequently, the model’s explanatory power and applicability in real-world scenarios are somewhat diminished. Specifically, uncertainties in travel time due to traffic congestion and shortages in supply capacity during peak hours are not sufficiently captured in the current model, which limits the practical relevance of the findings.
Future research could be expanded in the following directions: First, explore flexible scheduling mechanisms and real-time route planning methods under conditions of uncertain crowdsourced supply capacity. Second, develop collaborative delivery models that integrate real-time traffic prediction and dynamic route adjustment. Third, design robust optimization algorithms capable of handling demand fluctuations and unexpected disruptions. Research in these directions is expected to significantly enhance the stability and adaptability of crowdsourced logistics systems in complex real-world environments, thereby providing stronger theoretical support and practical pathways for the development of sustainable logistics systems.