Sustainable Operations of Last Mile Logistics Based on Machine Learning Processes

: The last-mile logistics is regarded as one of the least efﬁcient, most expensive, and polluting part of the entire supply chain and has a signiﬁcant impact and consequences on sustainable delivery operations. The leading business model in e-commerce called Attended Home Delivery is the most expensive and demanding when a short delivery window is mutually agreed upon with the customer, decreasing possible optimizing ﬂexibility. On the other hand, last-mile logistics is changing as decisions should be made in real time. This paper is focused on the proposed solution of sustainability opportunities in Attended Home Delivery, where we use a new approach to achieve more sustainable deliveries with machine learning forecasts based on real-time data, different dynamic route planning algorithms, tracking logistics events, ﬂeet capacities and other relevant data. The developed model proposes to inﬂuence customers to choose a more sustainable delivery time window with important sustainability beneﬁts based on machine learning to predict accurate time windows with real-time data inﬂuence. At the same time, better utilization of vehicles, less congestion, and fewer failures at home delivery are achieved. More sustainable routes are selected in the preplanning process due to predicted trafﬁc or other circumstances. Increasing time slots from 2 to 4 h makes it possible to improve travel distance by about 5.5% and decrease cost by 11% if we assume that only 20% of customers agree to larger time slots.


Challenges of Last Mile Logistics
Online shopping is growing fast, providing customers with fast delivery to their home door, avoiding traveling to shop and carrying items to the home. The online store has 24 h opening, and delivery can be the best time for the customer. On the other side, all benefits for the customer impose different challenges to achieve optimized and efficient logistics where the sustainable side effect must also be considered.
Several negative effects on environmental and social dimensions of sustainability are represented by greenhouse gas emissions (e.g., CO 2 and others), traffic congestion, accidents, noise, and direct consequences on human health and urban life quality [1].
World economic forum [2] predicts that urban last-mile delivery emissions will increase by 30% by 2030 globally in the top 100 cities. Emissions could reach 25 million tons of CO 2 annually by 2030, and traffic congestion is expected to rise by over 21%, meaning 11 min longer for each passenger's daily commute. Last-mile logistics (LML) is becoming one of the most expensive and complex segments of logistics [3]. It has a significant impact and consequences on sustainable operations [4], where real-time data can affect, for example, the energy efficiency of scheduled transport in the LML [5]. With increasing customer demands for punctuality, traffic problems, constant changes in delivery methods, and real-time decisions, the requirements of sustainable operation are becoming an even greater challenge [6].

Attended Home Delivery with Time Window and Time Slot
Attended Home Delivery (AHD) is now the leading business model in e-commerce as the most challenging part of last-mile logistics. A time window (TW) is an interval during which an activity can or must occur. Within the logistics sector, it means the period during which a shipment is delivered or picked up. A time slot (TS) is a time assigned on a schedule or agenda when something can happen or is planned to happen, especially when it is one of possible several times. The time window is usually composed of many time slots. Time windows vary depending on the activity being performed, while time slots are of fixed length. Usually, a time window consists of several time slots.
In (AHD) customers typically interact with an online booking system about delivery TWs possibilities for their shopping [13]. If a retailer can provide narrow time slots when customers agree to be at home is a great advantage as he can better adjust their schedule.
Most e-commerce AHD business approaches are taking the increasing customer expectations for faster and narrower TW delivery as a given. When trying to make last-mile delivery more sustainable, the retailers focus on improving sustainability in different aspects, e.g., using no-emissions vehicles, improving the routing, and similar with clear improving limitations. However, the most challenging part, the time window/time slots are not adequately addressed.
The first step in the fulfillment process for attended home deliveries in e-commerce is delivery window offer and confirmation. The customer closes the basket on the retailer's website and reveals the delivery location. Selection of possible TWs is offered to the customer, and when the customer chooses his most convenient TW is confirmed by the retailer immediately. The retailer must provide a wide selection of relatively narrow delivery TWs to ensure customer satisfaction and minimize undeliverable orders. Customers arrive dynamically; the location of future customer requests and the delivery size are unknown, so offering a specific TW to a customer in a static way may not be feasible or accurate enough.
For each customer, a valid delivery schedule must be constructed depending on delivery location, locations, and capacity of existing orders, considering different constraints like size and weight of the shopping freight. Providing the input data for the offering feasible time slots process requires communication across several services, and many database queries require a significant amount of time. There is even less time to solve the actual optimization problem [14].
Creating delivery window sets for customers is challenging, as the offer to the requesting customer must be made immediately and almost in real-time, so using complex optimization algorithms is not possible [15].
Another issue is confirming customer choice in the order acceptance phase, as simultaneous customer interactions may unavoidably create invalid offers with possibly longer customer waiting times [16]. Web performance analytics show that even 100-millisecond delays can impact customer engagement and online revenue [17].

Machine Learning Forecast
Creating or computing a feasible offer in real-time, notwithstanding that reaching the "absolute optimum" is a problem that is otherwise not computable in polynomial time (NP-hard problem). An exact algorithm should find all permutations and combinations of routes and compare each to extract possible TW. Therefore, another possible way is to use a machine learning forecast to develop a "near optimal" solution. Mitchell [18] covers the field of machine learning, the study of algorithms that allow computer programs to improve through experience and automatically infer general laws from specific data. Later interpreted as [19], Machine learning is an essential component of the growing field of data science. Using statistical methods, algorithms are trained to make classifications or predictions and to uncover critical insights in data mining projects [20]. Different learning algorithms and methods could be used for predictive analysis. Supervised learning methods are suitable with the dedicated training of a model on historical data and then application to predict the target variable [21]. The goal in the modeling phase is to obtain information about the behavior to be expected from the historical data with different data mining approaches to obtain the meaning variables [22].
The design of efficient last-mile delivery prediction Machine learning methods has been proposed to solve combinatorial optimization problems [23]; continuous learning is needed for the model to stay fresh to reflect the changing input data patterns. Necessary mechanisms for automatically retraining the models with new data are critical to deploying machine learning models, primarily to address the LML problem [24].
Different models for machine learning, simulation, and optimization for sustainable transportation systems could be used [25]. Majumdar et al. [26] showed that ML using Long Short-Term Memory networks is a powerful method for predicting the evolution of vehicle speed and congestion over short timescales on real-world road networks. Improving such predictions allow better management of smart transport systems, improving travel times and reducing transport-generated pollution within the urban environment. Shang et al. [27] explain that machine learning methods are the most effective solution for dynamic and non-linear traffic problems with the ability to approximate any degree of complexity of traffic flow and gain knowledge from training data without a predefined model structure with good robustness. Florio [28] presents a machine-learning framework for a datadriven method for designing high-quality last-mile routes pre-classified by domain experts (e.g., drivers) concerning their quality.
The concept of retraining ML models in real time and using a feedback loop to refine them as it happens is used in different real-time predictions [29]. To keep the model up to date, new real-time data has to be incorporated, and the model has to be retrained [21].

Predicting Time Slots with ML
Dynamic TWs slotting lets the retailer control the offered time slots per arriving customer by reducing the delivery capacity in the selected time slot. Lang et al. [30] argued that solution approaches must quickly compare the immediate reward from accepting an order to the opportunity cost; for predicting the delivery success, [31] trained several machine learning models based on historical order delivery data supplied by retailer website applications. The order delivery data consists of order-level attributes like the product category, attempt time to delivery, delivery speed, expected delivery date, delay, order value, and payment type [32].

Sustainability in AHD
In the e-commerce AHD business models, customers expect limited delivery times to suit their schedules. To respond to that expectations, more and more individualized delivery options are offered regarding fast delivery in narrow TWs, hardly affecting the delivery's sustainability.
Some retail companies claim that almost 80% of customers indicated that they consider sustainability for their purchases [33]. Of consumers, 86% are willing to delay deliveries and sacrifice time and money for sustainability, and 50% said that their decision to make sustainable purchases is directly related to concern for the planet [34]. At the same time, many customers are becoming more environmentally conscious, as argued by [35]. Retailers use the advantage of increasing the environmental awareness of customers by asserting the benefit of online shopping for the environment [6].
Boyer et al. [12] as well as Olson et al. [10], researched the effects of greater customer density and delivery window length in a given region. The travel distance is more than twice longer in 1 h TW compared to no window time restriction, facilitating greater delivery efficiency. The total number of kilometers per day is calculated to analyze the impact of changing the width of the TWs. If time slots are increased from 2 to 4 h, the improvement is 55%, and from 2 to 6 h, the improvement is about 68%. The reason is that narrow time slot limits solution space for delivery planning [1]. Some research concludes that if customers agree to a longer delivery window, the CO 2 emissions generated by the delivery fulfillment decrease considerably, thus leading to a more environmentally sustainable delivery [6,33,35]. In that way, encouraging customers to accept longer delivery windows could reduce the delivery's environmental impact.
Ignat and Chankov [36] proved that sharing information about all sustainability pillars (economic, environmental, and social) leads customers to choose a more sustainable delivery. Once made customers aware of the effect of these issues, customers are willing to contribute by creating economic and convenient sacrifices in the name of saving the planet's sustainability.
Social media's influence is also significant, as 52% of consumers indicate that social media influences shopping frequency at sustainable retailers. Facebook was the most popular for ages 45 and older, and Instagram for ages 18-44. Nearly a third of the TikTok votes (28%) were from ages 18-29 [34]. With customer knowledge, he chose to do something for sustainable delivery instead of a suitable delivery time to his schedule. The sustainability impact could also be presented on social media and used for public relations and branding since the public perception of green transportation and sustainable business operations is gaining increasing attention.

Gap, Aim, and Objective
Concerning the literature and practice, the most challenging part of last mile logistics-TW is not adequately addressed. Existing studies also show lacking potential for integrating real-time data into the decision-making process. As customers in AHD can place their orders any time around the clock with any possible location for delivery with significantly different sizes and weights of freight is very challenging to calculate the feasible time slots while the customer is waiting for the offer since all decisions must be made in real-Processes 2022, 10, 2524 5 of 16 time. As last-mile delivery efficiency depends on multiple factors, such as consumer density, depo capacity and location, shipment size fragmentation, homogeneity, TWs, and congestions, the only solution is to make a good machine learning prediction for new incomers what they would wish to order and where and when the delivery should be executed. Primarily the core of last-mile logistics optimization is identified in cost optimization and not environmental impact optimization.
Sustainable AHD Framework is the name of a new model to improve sustainability in AHD for large retailer companies as well as for logistics service providers is being developed based on real-time data and machine learning. At the start, we try to optimize the AHD delivery process in the traditional way to improve routing with better algorithms, choosing a more appropriate fleet with better efficiency and better environmental footprint, and other known solutions. The main improvement is, however, on TW optimization based on more sustainable operations that also result in lower costs. Therefore, the main novelty is optimizing the environmental impact of ADH. Consequently, cost savings can be achieved, and sustainable operations attract new customers. The shift toward sustainability as the priority of business operations in selecting TW instead of focusing primarily on cost optimization is an integral part of the novel approach.
In our simulations of AHD deliveries carried out for developed model validation, it was found that offering TW or time slots to customers is a critical stage to finding feasible TW and simultaneously achieving better sustainability goals. To find workable delivery time slots, all delivery constraints should be applied to machine learning, which also contains the retailer's business policy, as all subsequent decisions depend on it. When we try to implement narrower time slots to create a feasible TW, such as 1 h, all indicators for more economically and sustainable deliveries deteriorate.
In this article, the impact of a more sustainable AHD Framework is researched based on a machine learning forecast where different sustainable delivery slots are predicted. To obtain accurate prediction results, historical data from track and trace systems at execution delivery time are used to train the appropriate model. A permanent retraining model is proposed with actual data about traffic loads, weather, fleet capabilities, and delivery capacities, and special region features are added, including actual execution tracking where every logistics event is monitored for every delivery. The rest of the paper is organized as follows. Section 2 describes Model conceptualization with an innovative approach to improving LML sustainability in AHD. In Section 3, we describe the validation of the model through a real-life experiment. A Discussion section and Conclusion follow this.

Attended Home Delivery
For AHD delivery, the process is started in the depot where the vehicle is loaded, in most cases, for the predefined area where the delivery will be conducted. Area for delivery could be statically predefined like ZIP code or defined in the prediction process by the density of delivery locations. Figure 1 represents the Area, a Depot, and their mutual dependence.
The area where to deliver is defined by: The shape of the Area; • Stop density (delivery locations by region); • Average distance between stops and; • Max capacity to be served.
• Average distance between stops and; • Max capacity to be served. When we look at the timeline represented in Figure 2 for the delivery route, we see that first is loading time, then driving to the delivery Area after driving to the first delivery location, and then spending servicing time for parking, finding the customer, and handover the delivery. Service time may last longer than driving from one delivery location to another. To successfully execute deliveries, exact preparation processes for all activities must be calculated. In the first phase of our model prediction based on AHD data, the transport capacity of the vehicle can be calculated for each area and TW. As a result of the prediction, feasible time slots for each arriving customer are calculated and offered to the customer. The customer chooses one of the time slots and then approves it in our model. Time slots are open until capacity for delivery is available. In the second step, optimized planning of routes and all delivery events is performed and finished before loading the deliveries on vehicles. The third phase is the delivery execution after the vehicle is loaded and the handover of deliveries is performed. It means that by these three steps, we allow and offer the calculation of vehicle transport capacity to the customer based on AHD.

Management of Offered Time Slots to the Customer with Sustainability Evaluation
In the developed model, we are explaining our approach to improving the costliest part of AHD, narrow TW, when the customer expects the delivery at home. The classical solution for available time slots is statical with a fixed capacity for deliveries based on available resources, regardless of real-life circumstances.
Dynamical time slot management in real-time sustainable influence is introduced to show the customer the possibility of choosing more sustainable and feasible time slots for delivery and reducing sustainable impacts with the customer's consent.
Our approach combines feasibility, opportunity cost, and the sustainability aspect of delivery. From the results of forecasts and real-time data on incoming requirements, it is known which TWs are better for delivery even with sustainability variables of the appropriate fleet, full vehicle load, delivery area specifics, traffic jams when delivery is prepared in the depot, and similar.  When we look at the timeline represented in Figure 2 for the delivery route, we see that first is loading time, then driving to the delivery Area after driving to the first delivery location, and then spending servicing time for parking, finding the customer, and handover the delivery. Service time may last longer than driving from one delivery location to another.
Processes 2022, 10, x FOR PEER REVIEW 6 of 17 • Average distance between stops and; • Max capacity to be served. When we look at the timeline represented in Figure 2 for the delivery route, we see that first is loading time, then driving to the delivery Area after driving to the first delivery location, and then spending servicing time for parking, finding the customer, and handover the delivery. Service time may last longer than driving from one delivery location to another. To successfully execute deliveries, exact preparation processes for all activities must be calculated. In the first phase of our model prediction based on AHD data, the transport capacity of the vehicle can be calculated for each area and TW. As a result of the prediction, feasible time slots for each arriving customer are calculated and offered to the customer. The customer chooses one of the time slots and then approves it in our model. Time slots are open until capacity for delivery is available. In the second step, optimized planning of routes and all delivery events is performed and finished before loading the deliveries on vehicles. The third phase is the delivery execution after the vehicle is loaded and the handover of deliveries is performed. It means that by these three steps, we allow and offer the calculation of vehicle transport capacity to the customer based on AHD.

Management of Offered Time Slots to the Customer with Sustainability Evaluation
In the developed model, we are explaining our approach to improving the costliest part of AHD, narrow TW, when the customer expects the delivery at home. The classical solution for available time slots is statical with a fixed capacity for deliveries based on available resources, regardless of real-life circumstances.
Dynamical time slot management in real-time sustainable influence is introduced to show the customer the possibility of choosing more sustainable and feasible time slots for delivery and reducing sustainable impacts with the customer's consent.
Our approach combines feasibility, opportunity cost, and the sustainability aspect of delivery. From the results of forecasts and real-time data on incoming requirements, it is known which TWs are better for delivery even with sustainability variables of the appropriate fleet, full vehicle load, delivery area specifics, traffic jams when delivery is prepared in the depot, and similar.  To successfully execute deliveries, exact preparation processes for all activities must be calculated. In the first phase of our model prediction based on AHD data, the transport capacity of the vehicle can be calculated for each area and TW. As a result of the prediction, feasible time slots for each arriving customer are calculated and offered to the customer. The customer chooses one of the time slots and then approves it in our model. Time slots are open until capacity for delivery is available. In the second step, optimized planning of routes and all delivery events is performed and finished before loading the deliveries on vehicles. The third phase is the delivery execution after the vehicle is loaded and the handover of deliveries is performed. It means that by these three steps, we allow and offer the calculation of vehicle transport capacity to the customer based on AHD.

Management of Offered Time Slots to the Customer with Sustainability Evaluation
In the developed model, we are explaining our approach to improving the costliest part of AHD, narrow TW, when the customer expects the delivery at home. The classical solution for available time slots is statical with a fixed capacity for deliveries based on available resources, regardless of real-life circumstances.
Dynamical time slot management in real-time sustainable influence is introduced to show the customer the possibility of choosing more sustainable and feasible time slots for delivery and reducing sustainable impacts with the customer's consent.
Our approach combines feasibility, opportunity cost, and the sustainability aspect of delivery. From the results of forecasts and real-time data on incoming requirements, it is known which TWs are better for delivery even with sustainability variables of the appropriate fleet, full vehicle load, delivery area specifics, traffic jams when delivery is prepared in the depot, and similar.

Proposed Prediction of Accurate Delivery TSs with Sustainability Preference
The requests for delivery in AHD are constantly coming into the system; decisions must be made in real-time so that retailers can offer personalized time slots for each incoming customer. We used Machine Learning to enable capacity estimation to ensure fast response and scalability on simultaneous customer interactions based on historical data from previous deliveries to achieve our goal. The machine learning training process is continuously run to allow interference with real data from the next steps in the delivery process and other external data. In our framework, we use delivery prediction analysis methods of supervised learning for model creation.
To keep the model up to date, new real-time data must be incorporated, and the model must be retrained. Constant model retraining with real-time exceptions is used to adapt to the new reality and to refine the results.
In addition to obtaining fast results, fast algorithms for calculating distances are used, and historical driving speeds in the area are used to calculate the delivery schedule and add additional sustainability issues such as real-time traffic or weather conditions.
We are determining the input variables based on standard LML activities for the machine learning model to learn patterns and dependencies between these variables and the delivery time, as the target represents in Figure 3. For the exact delivery location, a professional geolocating platform is used, and external data from different sources are used for delivery prediction.
A set of variables based on standard LML activities is used: The first step in our AHD Prediction is Data preparation, as shown in the first yellow box in Figure 3. The source of data to fill the above-mentioned variables are different resources from historical data, an e-commerce platform with customer orders, and additional delivery data to weather, traffic, and execution track and trace systems and must be prepared for use in the machine learning system. Data cleaning Includes basic operations such as removing noise or outliers and mapping missing or unknown values. In advance of data preparation, a strategy for dealing with missing data fields is prepared by considering information about the time sequence of the retrieved data.
After Data Preparation (next yellow box in Figure 3), Machine Learning Algorithms are used to create a prediction for an available time slot for each customer order. Machine learning algorithms are developed with machine learning techniques, and we know how accurately the predicted values are from the learning phase of algorithms where testing data with the known outcome are used. The training of the ML algorithms is performed based on the processed data from the past "Historical Data," as shown on the left side in Figure 3.
As input to AHD Prediction, customer orders with additional logistic data, such as The training of the ML algorithms is performed based on the processed data from the past "Historical Data," as shown on the left side in Figure 3.
As input to AHD Prediction, customer orders with additional logistic data, such as the size and weight of packages, are used. Data sources are from input variables, tracking system of the logistics service provider, external weather systems that provide weather data for the time of delivery, external traffic systems providing traffic loads and mapping services to take advantage of real-life data for minimizing route duration, reduce the reliance on expert heuristics, and exploit similarities between instance characteristics.
Our ML algorithms estimate travel time from the depot to each delivery location for each area. The time slot is calculated with the maximum capacity of available vehicles with their available cargo size and weight. Variations of our algorithms could be run in a parallel mode, so the best ones are selected. Machine learning model patterns and dependencies between variables are learned to obtain delivery TWs as the target.
Prediction of available time slots with sustainable evaluation because of Machine learning Algorithms is presented to the customer shown in Figure 3 as "Prediction." Customers choose one of the given time slots delivered as a green box named "Customer Choice." It is possible to select a set of feasible time slots with the influence of retailers' business rules with some benefits for the customer to encourage the Customer to choose more sustainable TS. In the following "TS acceptance" step, the time slot is approved in case the data could be changed in the customer's decision time for his TS and TS is no longer available. Roving process, the capacity for delivery in the area with that slot influence the data preparation with accepted TS, as shown with a blue arrow in Figure 3.
The validation of our Model is described in the next section.

Model Validation Process
Our Sustainable AHD Model uses available data for all three delivery phases: prediction, optimized planning, and execution. The prediction phase relates to the planning and execution delivery phase to increase or lower delivery capacity divided by areas and time slots. On the other hand, with more excellent reliability, we avoid late or not possible deliveries, which could be a problem for retailers. With the help of customers selecting broader and/or not-so-busy time slots, sustainable delivery results are possible. In our testing environment, we simulate customer cooperation based on declared sustainability sensibility and the fact that some customers choose larger, like 6 h time slots based on retailers' historical data.
In the Prediction phase, the first delivery areas are calculated depending on delivery similarity parameters such as average delivery distances between customers, average vehicle speed, and similarities. The delivery capacity forecast is made some time in advance for each area. It is not very easy to predict how many customers will show up in one place, so a static solution is to close the area for time slots where the delivery capacity is exceeded. If we use the back loop of customer accurate tome order data in prediction, we can change the time slot windows size or move some capacity from one area to another. With the help of the next arriving customers, we can ease the time slot limitation and provide a possible solution for the next customers' requests.
The optimized planning phase depends on time slot acceptance in the prediction phase. If capacity data are not correctly updated, all deliveries cannot be planned to fulfill all customer requests. In the planning phase, a complete vehicle should be loaded and, after all scheduled deliveries are executed, returned to the depot when the next loading begins. Planning is also essential to obtain real-time data from the next execution phase if some delay is expected and will also influence delivery capacity. Our model's real-time data loop is integrated and continuously used to make and modify optimized planning decisions. Using this concept, the sustainable benefit of fewer vehicles is needed, and better routing planning is achieved. The last and most important customer is the execution phase, where the customer expects the promised delivery in an agreed time slot. Almost all retailers in e-commerce use third-party logistics providers with their fleet and personnel for the execution phase, where everything about deliveries, routing, and TW should be known in advance. The driver and possible delivery assistant use our model track and trace application. All delivery events are monitored and managed in real time with precise exception handling. All exceptions range by severity as closed road, heavy traffic, vehicle accident, bad weather, in the range up to customer not at home or unhappy with delivered goods. All those events are important for the prediction phase as some mean capacity reduction or closing next time slots.

Time Efficiency and Benefits of Model Applications
As an example, what happens when time slots are used? We consider all services and delivery times to be the same. In Figure 4, the vehicle has a capacity for 22 deliveries and is fully loaded in the depot. Then the vehicle is first driven to the delivery area, and the handover for each delivery begins. A possible capacity limitation is the time spent on each delivery in the area. So only 13 deliveries can be made in this time window. Other deliveries must be made in the next TW, or the vehicle must move to the next area. If there is a need for 22 deliveries in the area, another vehicle must be used, or 9 deliveries must reduce the available capacity for that slot.
When TS is narrowing, some deliveries are costly while the vehicle is not loaded enough, or we need many vehicles. If there is predicted congestion on the road, the delivery efficiency worsens again.  The shorter the delivery time slot, the higher the delivery price and the increased environmental externalities. For obvious reasons, the longer the time interval, the greater the flexibility in vehicle routing and the better the environmental sustainability.
It can be argued that more improved calculations and optimization of deliveries can help achieve better performance on sustainable issues; much more could be done if the customers consider the sustainability impact when making their decisions. As we make an offer in real-time, the problem needs to be addressed at the source, namely a potential change in customer behavior regarding sustainability issues that shows the customer option of choosing from a selection of more sustainable TWs.

Acceptance Phase of Chosen Time Slot
In prediction time sustainability related dimension of offered available TSs can be calculated. With a proper explanation to the customer, the retailer could agree that TS is wider, delivery is not executed in congestion times with dense traffic or when the congestions are in the customer delivery region, etc. The next suggestion could be that if the customer would not be at home at the agreed TS, the alternative delivery location is chosen, like a neighbor door, store, or other location close to the customer to fulfill booked TS. The shorter the delivery time slot, the higher the delivery price and the increased environmental externalities. For obvious reasons, the longer the time interval, the greater the flexibility in vehicle routing and the better the environmental sustainability.
It can be argued that more improved calculations and optimization of deliveries can help achieve better performance on sustainable issues; much more could be done if the customers consider the sustainability impact when making their decisions. As we make an offer in real-time, the problem needs to be addressed at the source, namely a potential change in customer behavior regarding sustainability issues that shows the customer option of choosing from a selection of more sustainable TWs.

Acceptance Phase of Chosen Time Slot
In prediction time sustainability related dimension of offered available TSs can be calculated. With a proper explanation to the customer, the retailer could agree that TS is wider, delivery is not executed in congestion times with dense traffic or when the congestions are in the customer delivery region, etc. The next suggestion could be that if the customer would not be at home at the agreed TS, the alternative delivery location is chosen, like a neighbor door, store, or other location close to the customer to fulfill booked TS.
When a new customer is closing his shopping basket, the new business model shows the customer feasible time slots when delivery is possible; after choosing the slot in the order acceptance procedure, we confirm the customer's choice. That step is needed, especially when several customers choose the time slots simultaneously, as shown in Figure 5. In the acceptance phase, we are using predictions to recalculate the feasibility of delivery for each customer delivery request to find semi-exact routes for capacity management for delivery resources. Quick filtering criteria will be run first, such as routes that match the desired delivery TW, routes that still have sufficient capacity in total and per time slot, temperature regime restrictions, etc. By inserting the order into the route, a preliminary dispatch time of the vehicle from the depot is calculated. In this phase, all other data from the next phase of optimized route planning and execution are considered, and the capacity can also be reduced for sustainable reasons.

Sustainable AHD Framework
Our work is focused on a decision support system as a Sustainable AHD framework for prediction, optimized planning, and execution that can be used to improve performance in all dimensions of sustainability in AHD as the most inefficient and demanding last mile case. The delivery process is performed in three steps:  In the acceptance phase, we are using predictions to recalculate the feasibility of delivery for each customer delivery request to find semi-exact routes for capacity management for delivery resources. Quick filtering criteria will be run first, such as routes that match the desired delivery TW, routes that still have sufficient capacity in total and per time slot, temperature regime restrictions, etc. By inserting the order into the route, a preliminary dispatch time of the vehicle from the depot is calculated. In this phase, all other data from the next phase of optimized route planning and execution are considered, and the capacity can also be reduced for sustainable reasons.

Sustainable AHD Framework
Our work is focused on a decision support system as a Sustainable AHD framework for prediction, optimized planning, and execution that can be used to improve performance in all dimensions of sustainability in AHD as the most inefficient and demanding last mile case. The delivery process is performed in three steps:

1.
First, the prediction of feasible time slots for delivery in real-time; 2.
Second, the optimized planning in cut-off time before loading the vehicles with deliveries; 3.
Third, the delivery execution.
In all three steps, additional data influences the delivery plan, so a backward loop is necessary to adapt the real-life conditions. Figure 6 shows real-time data dependencies in the Sustainable AHD Framework.
"Prediction" as a starting phase (shown on the left side of Figure 6) is essential for the subsequent phases where prediction output data is used in "Optimized Planning," and the result of planning is used for exact-driven "Execution" for loading the vehicle, routing instructions and handover the deliveries to customers. On the other side, some events in the "Execution" phase can be delayed or were not carried out. Those events could include traffic loads, weather, fleet capabilities, delivery capacities, special area features, and execution tracking using low-emissions vehicles, as shown in Figure 6 at the bottom. In the "Execution" phase, we can obtain the information that one bridge will be closed for the next 24 h, so that information should immediately influence "Prediction" and "Optimized planning," as shown with blue arrows in Figure 6. Similarly, when information in "Optimized Planning" about the planned vehicle is out of order and cannot be replaced by influence on "Prediction".
Predictions included sustainability related to dimension and obtaining real-time data from all available resources, allowing fast response to actual life events and the opportunity to find better and more sustainable delivery, including with the help of customers.
Optimized Planning is performed before the cut-off time before loading the deliveries on vehicles. Final routes are prepared considering no broken constraints, the actual traffic, weather, pickup and delivery TWs, capacities, temperature regime, and other sustainabilityrelated indicators and data coming from execution time. Moreover, in this phase, the model uses some predictions over congestion, travel time in the area, weather conditions, and similar.
The delivery Execution enroute is monitored via a track and trace system handling all events affecting the transport and handover during the execution. Last-mile delivery tracking can be defined as a system allowing monitoring of the executing delivery process. At every step of delivery, all logistic events are recorded based on tracking standards. In AHD, all events are sequenced from loading, driving, finding the customer, unloading, and handover, typically executed repetitively. For track and trace, special applications are used by delivery personnel where the dimensions of the event are tracked. First, the business step behind the event is to define the context, information on the action performed on delivery items, location, and event time. All exceptions are also tracked, and the controlling system is informed, so real-time tracking enables communications between all stakeholders in LML, including the customer.
The empirical results from the real-world data confirmed the importance of the proper prediction and optimized planning traditionally adopted in vehicle routings, such as total travel time, TW performance, and routing consistency.
The proposed model novelty is to create a sustainable-driven AHD framework that will improve fast time slots offering, including sustainable data from various resources to obtain a better perspective on what delivery means for retailers and customers not only in terms of feasibility but also from a sustainability perspective. The impact on a more sustainable ADH framework is researched based on different machine learning forecasts. Different, more or less sustainable delivery slots are predicted since the quantity of data is too complex for optimization based on manual data processing. To obtain accurate prediction results, historical data from track and trace systems at execution delivery time are used to train the appropriate model. A permanent retraining model is proposed with actual data about traffic loads, weather, fleet capabilities, and delivery capacities; special area features are added, including execution tracking, where every logistics event is monitored for every delivery. The sustainable AHD Framework combines all mostly different solutions to obtain better results in all three pillars of sustainability. The full power of artificial intelligence is used to manage the whole AHD delivery process from prediction to optimized planning and execution phase to achieve the following objectives: 1. Predicting accurate, sustainable TWs alternatives for attended home delivery in realtime; 2. Improve the machine learning predictions with real-time data for offering TS, optimized planning and execution phase of AHD delivery; 3. To influence the customer to choose a more sustainable way for AHD and use all other sustainable improvements.
The text continues here.

Discussion
AHD as the most expensive and demanding business model in e-commerce is also very questionable in terms of sustainability requirements. Customer wishes for the desired narrow delivery time result in less flexibility and consequently less scope for sustainable improvements.
The general recommendations for actions to improve sustainable operations in AHD emerged from the present study. Predicting more accurate alternatives for AHD based on machine learning enhanced with a real-time data feedback loop from different resources increases sustainability. With real-time data knowledge, it can be influenced customers to choose more sustainable TW for delivery. For example, 86% of the people in the mentioned research were willing to wait longer for delivery once they understood that a fast delivery or shorter time slot might have negative environmental impacts [34]. The conclusion is that participants are willing to wait longer, pay more, or choose a less convenient location to achieve a more sustainable delivery. With the help of customers, more sustainable decision and a valid delivery schedule are constructed with better utilization of vehicles avoiding congestion in the customer area and more exact delivery.
When the AHD delivery processes are connecting with real data in a reverse loop, many obstacles in delivery can be predicted and avoided. One of the most critical issues is synchronization with the depot, as all delivery events are very time connected. If the The sustainable AHD Framework combines all mostly different solutions to obtain better results in all three pillars of sustainability. The full power of artificial intelligence is used to manage the whole AHD delivery process from prediction to optimized planning and execution phase to achieve the following objectives:

1.
Predicting accurate, sustainable TWs alternatives for attended home delivery in real-time; 2.
Improve the machine learning predictions with real-time data for offering TS, optimized planning and execution phase of AHD delivery; 3.
To influence the customer to choose a more sustainable way for AHD and use all other sustainable improvements.

Discussion
AHD as the most expensive and demanding business model in e-commerce is also very questionable in terms of sustainability requirements. Customer wishes for the desired narrow delivery time result in less flexibility and consequently less scope for sustainable improvements.
The general recommendations for actions to improve sustainable operations in AHD emerged from the present study. Predicting more accurate alternatives for AHD based on machine learning enhanced with a real-time data feedback loop from different resources increases sustainability. With real-time data knowledge, it can be influenced customers to choose more sustainable TW for delivery. For example, 86% of the people in the mentioned research were willing to wait longer for delivery once they understood that a fast delivery or shorter time slot might have negative environmental impacts [34]. The conclusion is that participants are willing to wait longer, pay more, or choose a less convenient location to achieve a more sustainable delivery. With the help of customers, more sustainable decision and a valid delivery schedule are constructed with better utilization of vehicles avoiding congestion in the customer area and more exact delivery.
When the AHD delivery processes are connecting with real data in a reverse loop, many obstacles in delivery can be predicted and avoided. One of the most critical issues is synchronization with the depot, as all delivery events are very time connected. If the vehicle is not loaded at a predicted time in the time slot world, everything will be late, maybe also loading.
As time slot delivery is very demanding and has a vast sustainability impact, all retailers should be concerned about less harmful deliveries. The most important thing for the customer in the AHD world is that the retailer delivers the order in a mutually agreed time slot. If the feasibility is miscalculated or time slotting delivery is not working correctly, the customer will abandon the retailer. Many deliveries could not be redirected or later collected (e.g., freshly prepared food medicals, items that need additional service, precious items). Another challenge is that the customer is not at home when the handover should be done. Most such events occur in real time, so the supporting system must respond flexibly. With our Sustainable AHD Framework, where real-time influencing loops supported by ML are used, we can avoid most such scenarios. Still, the most critical issue is that the system can learn from a similar situation to react better next time.
On the other hand, in our system, real-time data from different sources is always used. It is also possible to manually add important (missing) data like unique events (e.g., football match next evening, road works for three days, a massive sale like Black Friday).
Prediction models assume that patterns learned from the training data will provide an appropriate basis for forecasts of future development. In the real world, many changes can happen on selected variables like a road in construction, so relationships between features learned in advance no longer apply. For retraining, data from the planning and execution process in the developed model for AHD can be used with all external resources.
It is not easy to calculate feasible delivery routes when the customer expects to receive an offer of delivery times if the proper tools are not used. Many real-time computing attempts with fixed algorithms have been made, but the solutions are not scalable. ML prediction with real-time data influence has, of course, some limitations. The most visible is if formal learning is not successful and inadequate reaction to different events is executed.
In addition, it is essential to consider all other circumstances relevant to delivery. Traffic takes place in an everyday world where various constraints affect delivery times, and it has been proven that ML can significantly improve outcomes [37]. There are also some limitations in identifying all possible situations, as many different events affect delivery times. Another issue is real-time data, which can affect forecasts and how they are presented.
There is also a chance that the customers do not want to contribute to more sustainable decisions about the time interval. However, according to customer trends, it can be speculated that the share of green customers will increase [38]. Consequently, the percentage of doses not interested in more sustainable operations will eventually be significantly lower or even irrelevant. Customers who make purchases online stop going to the stores. This also reduces the pollution that they would bring otherwise. Since e-commerce is increasing fast, distribution optimization should be the core of future process improvements.
It is evaluated that increasing time slots from 2 to 4 h makes possible improvement of travel distance by about 55% [1]. Suppose we assume that only 20 percent of customers agree to larger time slots. In that case, the costs decrease by 11% in real situations when other circumstances must be considered, such as traffic congestion or some other events that have a significant impact on delivery times where the prediction result shows that delivery capacity, in such a situation, is much lower and also increasing the vehicle fleet or adding more other resources is not a feasible solution.
As the costliest part of the whole supply chain with a meaningful, sustainable impact, AHD could be improved with awareness and action from all stakeholders, retailers, logistics providers, and customers. For retailers with sustainable business rules, 3PL is taking into account sustainable indicators [39]. The trend of development and the basis of business models requires considering sustainable indicators that place suppliers of logistics services at a certain level of quality, thereby affecting their desirability among all stakeholders in supply chains.

Conclusions
The proposed framework can improve predictions using real-time data from the planning and execution phase of delivery and other sources and offer personalized, accurate, sustainable TWs alternatives for AHD in real-time.
With proposed knowledge about offered time slots when the customer chooses the suitable delivery time for his schedule, the sustainability impact could also be presented to the customers to impact their decision on time slot selection based on the sustainability impact of delivery. As other researchers argued that sharing information about sustainability impacts leads to customers being more likely to choose a more sustainable delivery, we are sure that LML-related companies can impact their decision. It is expected that many customers will consider choosing a better one from the environmental sustainability perspective. When customers are aware of the ecological impact of LML and AHD challenge challenges and potential improvements, they will be more willing to contribute to the reduction of externalities. Therefore, the most significant reduction of environmental impacts is likely to be achieved in AHD. This is our contribution to building a more sustainable LML using artificial intelligence to encourage the cooperation of all stakeholders in achieving this goal. This paper's framework contributes to understanding AHD's sustainable improvements by identifying the significant impacts of real-time decisions and explaining their interrelationships. The possibilities of continuous machine learning with the influence of real-time data contribute to developing a more coherent body of knowledge and provide information to customers who are becoming increasingly environmentally aware. The findings of this work suggest that further research is needed in various areas to improve all sustainable aspects of AHD logistics.
As AHD sustainability has many dimensions, other issues should also be inserted in the Sustainable AHD framework, many from social and Environmental pillars as more sustainable packaging of goods, joining orders in one delivery, combinations of different depots, delivery safety, and working conditions.
There are additional possibilities to improve the performance of the proposed Framework further. The complexity of AHD, which considers real-time data and decisions with economic, social, and environmental sustainability factors, is unlikely that our solution will cover all the challenges. First, there are new sources of data that we are not using yet as connected vehicles network that is used for autonomous driving CAV), where real-time data are interchanged with other vehicles, infrastructure, and data in the cloud. Moreover, the prediction algorithms could be improved to be more accurate. Social media could be better informed with real-time data about sustainable customer decisions about AHD, showing the environmental, economic, and social benefits. Due to very topical issues related to fuel economy, efficiency, and optimizing transportation, and especially LML, we expect that many researchers will contribute to the proposed framework in light of the new green deal and contribution to following 17 UN sustainable development goals. Required knowledge of future to be logistic experts will definitely contribute to the transformation of digitally supported and sustainability-oriented education in logistics that will be more related to the Green deal as well as consistent with the idea of EU taxonomy.