When Amazon announced it would purchase 100,000 custom electric delivery vehicles as part of The Climate Pledge, a team of scientists within the Amazon Logistics (AMZL) Research organization took on the challenge of determining the best strategy for deploying them. Based on sophisticated models that simulate Amazon’s shipments and external parameters like power availability in each city, the team is developing a plan to gradually electrify Amazon’s entire fleet.
This is just one of many projects the AMZL Research Science team is tackling related to last-mile delivery. Last mile, as the name implies, is the last leg of the journey of a product to a customer’s doorstep. The team develops models to predict shipments per route (SPR) and distribution, which is the average number of packages delivered by a single driver in a given city on a given day (weeks to years in the future). These models help to predict the number and the different sizes of vans the company should purchase to meet the predicted demands.
“With these complex models we develop, we have been influencing the company’s investment in vehicles, Delivery Service Partners, and their drivers,” says Rohit Malshe, a principal research scientist at Amazon.
How to forecast when everything is changing
There are multiple scientific challenges involved in developing these models given the dynamic nature of Amazon’s operations.
“One of these challenges is that our volume keeps growing. In general, as the volume grows, the shipments per route will also increase, but not linearly,” explains Abhilasha Katariya, a senior research scientist on the team. New delivery stations are frequently launched, leading to several changes in the geographical area that each station covers. Stations may incorporate different types of vehicles and modify their operation hours, which also impacts how much they can deliver. Additionally, road networks are subject to alterations as well, impacting driving time.
The team’s scientists must develop models that can handle the variability and complexity. To do that, they use a bottoms-up approach that starts at the zip code level. “This creates a foundation where any changes in the stations’ jurisdiction can be taken into consideration directly,” says Katariya.
Pure machine-learning approaches are not adequate because the team must frequently make predictions based on new scenarios, for which there is no training data available. To compensate for the lack of training data, the team develops models that combine machine learning and physics-based models that have an optimization component which helps to take into account new variables.
For example, if a large van is added to an Amazon station that previously only worked with small and medium vans, there is no training data to inform the model. “But because the core of the model uses analytical and optimization components, we can still predict the shipments per route for a larger van,” says Katariya.
“If you think about a machine learning model, typically interpolating is very easy. But, in our case, we typically want to extrapolate because we're always getting more volume,” says Natarajan Gautam, an Amazon Scholar and a professor at Texas A&M University. “Using historical data to extrapolate is generally not recommended in machine learning, because you haven’t seen those things in the past.”
This is where the physics-based model comes in handy, although a pure physics-based model also wouldn’t work, notes Gautam, because there are so many simplifying assumptions that need to be made to obtain an analytically tractable model. “We want to get the best of both worlds, in some sense. We all want something that adequately represents what is observed, but we also want to be able to extrapolate when not observed.”
Another strategy the team employs to deal with situations where the parameters are constantly changing is to run the same model over and over again to do a type of course correction. “Just run the model every month, so that all the parameters that are changing are learned by the model, and then you are always getting the latest and greatest picture you should expect. This way you have a good model that handles all types of situations, even the ones where no data exists,” says Malshe.
The science team works very closely with people on the ground, both in station and on the road, to perfect these models. They frequently visit the delivery stations and interview the drivers whenever an opportunity arrives. “We make visits to stations and do ride-alongs so that we stay connected with how the business is evolving,” says Katariya.
In one of these meetings, Gautam says, station employees said their results were different from what the models were predicting. “We went back to the drawing board, looked at the code and the data they were getting ,and took a deep dive to find what was causing the problem”.
They realized the station started delivering to a new zip code, but it didn’t perform the same way the previous station did. That explained the difference between what the model was observing and the real-life data. Having a close connection with operations allowed them to identify the problem and adjust their model.
Dealing with COVID-19 disruptions
For big decisions like vehicle purchases, the AMZL Research Science team forecasts on a 16-month horizon. However, when the team predicted the number of vans needed for 2020, their model didn’t consider the COVID-19 pandemic. “Suddenly there was so much more package demand that all our forecasts were basically incorrect,” says Malshe.
He says, when situations like these arise, the first thing the team does is to upgrade the forecasts to incorporate the additional volume. They also perform scenario analyses to check, for example, if the vehicles that had already been budgeted and procured would serve the purpose. Fortunately, in this case, because these decisions are made so far in advance, the team intentionally overbudgeted to account for uncertainties. “Luckily enough, the previous year, we had spent a lot of money on bigger vehicles, and they were able to absorb the additional package volume. So, when we ran these forecasts, we figured out we were in a good spot to be able to handle such changes,” says Malshe.
“Another risk mitigation lever we applied is to make sure there is enough storage space in the delivery stations,” says Malshe. “We made sure we looked into every possible parameter to optimize for vehicles and their placement in various cities, and their deployment to various Delivery Service Partner companies so that they are utilized to the best of our capabilities.”
‘Many challenges and interesting solutions’
The electrification of Amazon’s fleet presents its own set of challenges. Some of these include how to make sure batteries in the vehicles don’t run out of charge on the road; how to optimize electricity and power consumption; and how to account for extreme weather, long trips and hilly areas. “We will keep learning on all of these items as we go forward, and each year we will come up with more innovations to overcome any barriers,” says Malshe.
For Malshe, the diversity of the scientists working on the team – which includes people with various backgrounds, industries, educations, and skill sets – is what contributes to its success in tackling these unresolved challenges.
"We have people on our team who are extremely data savvy. We have team members who know SQL coding in depth and some are extremely good in Python coding. Other team members have expertise in areas like machine learning, optimization, pure modeling, Monte Carlo simulations and what not," says Malshe, who is himself a chemical engineer with experience in logistics.
“Usually two to three people are working on every project. It divides and conquers various tasks and ultimately gives everyone an opportunity to do valuable work,” he says.
In addition to the team’s range of expertise, Katariya says another team success factor is its ability to collaborate on a wide range of problems. “Each problem has a different challenge, some have a very simple mathematical solution, but are very heavy on the implementation side, and others may require more complex models from a mathematical perspective, but are easier to implement.”
And there are many more challenges to be tackled. In fact, Gautam says, some of his peers have yet to fully grasp the challenges involved in this field of research.
“A lot of people think of last mile as solving a vehicle routing problem. But we do a lot more than that,” he says. “There are so many challenges and interesting solutions that you just can’t take it off the shelf, you really have to invent as you go along. There are tremendous opportunities to do that here and the range of challenges we get to address is what makes being involved with this team so professionally rewarding.”