AWS HPC Blog

An agent-based simulation of Amazon’s inbound supply chain

An agent-based simulation of Amazon's inbound supply chain

Amazon has a complex inbound supply chain network for our retail operations in the United States, and we’re always seeking innovative ways to make it more efficient.

Recently, we embarked on an ambitious project: simulating our entire US inbound supply chain. To put this into perspective, this is the entire “first-mile” of distribution, tracking the movement of hundreds of millions of individual products through the network. This was a significant first step towards enhancing the network’s efficiency, and was made possible by using Simudyne’s Software Development Kit and the compute power of AWS.

In this post, we’ll walk you through the story of our supply chain, and how we came to pull of what we think is quite an amazing feat. The supply chain toolkit used to build this is available on AWS Marketplace, so if you’re reading this – and interested in supply chain simulation – you can just dive right in.

Amazon’s inbound network: a complex system

Amazon’s inbound network in the US is a multi-stage, complex, and dynamic system where goods flow from a myriad of suppliers to strategically-located cross-dock facilities (we call them IXDs), and ultimately to Fulfillment Centers.

Suppliers range from local startups to international conglomerates, each feeding into the diverse Amazon inventory. The IXDs are vital in this system, acting as high-efficiency transit hubs where products are sorted and prepped for their next leg to the Fulfillment Centers.

Fulfillment Centers are large facilities, outfitted with advanced technologies like artificial intelligence (AI) systems and robotics. Items are stored, cataloged, and eventually dispatched to customers from these locations. This segment of the supply chain exemplifies the need for balance in optimization – a blend of efficiency, cost management, and technological innovation.

Optimizing a network like this is challenging. We need to balance cost efficiency and customer satisfaction, align operations with environmental sustainability, ensure adaptability to future market shifts, and deal manage technological advancements.

There must also be an understanding of the interface between the micro aspects of fulfillment centers (i.e., what’s happening within individual centers/facilities) and the macro aspects of a supply chain network (i.e., phenomena that emerge when examining the web of relationships between facilities).

One way to approach this optimization problem is by building and executing computer simulations, or mathematical models that aim to mimic systems, like supply chain networks, so the simulations can be used to study how those systems work. Building a supply chain simulation that can represent this variety of scales needs an intricate understanding of the supply chain’s dynamics – from warehousing logistics to the last-mile delivery intricacies.

Solving for complexity: the power of agent-based models

Simudyne’s Agent-Based Modeling (ABM) technology and SDK turned out to be a game-changer in our optimization toolkit. This technology allows us to simulate the Amazon supply chain with high fidelity, with each agent representing a distinct component like a warehouse or delivery vehicle. By mimicking real-world behavior and decision-making processes, we can analyze and optimize various aspects of supply chains like topology, inventory placement, resource allocation, and so forth.

Simudyne’s SDK is designed to strike a balance between handling the multi-scale system representation problem, the effort needed to build and implement simulations, and the ability of simulations to take advantage of large-scale computing that can speed up the business decision-making process.

Key to this balance is Simudyne’s advanced approach to agent-based modeling, which leverages a graph-based approach designed for more accurate and efficient simulations. Unlike traditional agent-based modeling tools that might use graph representation primarily for data visualization, Simudyne’s method involves using the graph as the core computational structure.

In this setup, each agent, whether a facility, vehicle, or another entity, is a node with connections to other nodes, representing their interactions and relationships. This structure allows agents to make independent observations and decisions based on their interactions, leading to a more dynamic and realistic simulation of the real world.

Sumdyne’s SDK

Simudyne uses a Pregel-like framework for processing large-scale graphs. Pregel supports parallelized processing of massive graphs and graph computations by distributing the workload across multiple cores, for instance across large Amazon EC2 instances like the r6a.32xlarge, with 128 vCPUs. This technique is highly efficient for handling the complex, large-scale supply chain simulations that Amazon requires.

Simudyne’s Java-based SDK employs structures like Parallel Streams and Concurrent Lists that unlock additional intra-simulation parallelization potential. The SDK is designed for scalability from small-scale tests to large-scale production without needing significant code rewrites, ensuring that our simulation models are not only accurate, but flexible and adaptable.

Simudyne recently released a Supply Chain Toolkit that specifically enhances the SDK with specialized tools for modeling supply chain networks. The new toolkit includes some useful classes for representing the network:

Facility agent  – a class which users can extend to represent various types of facilities within a supply chain. This class includes essential functions for managing the flow of products, and users can add multiple LoadingBay classes for different types of docks.

TransportMessages – a class that facilitates the movement of inventory between facilities, with options for cargo to be represented either as Product class or as a string for memory efficiency.

LoadingBay – a class that represents loading docks in the simulation, with a transport queue and a specified capacity, allowing for various types of docks and custom priority handling.

For visualizing supply chain networks, the Simudyne SDK integrates with Python tools like Plotly, so we can create interactive maps to display facility information. We can customize this visualization to display additional data points and network connections.

Overall, the toolkit is designed to provide a comprehensive suite for simulating and optimizing supply chain networks, offering operational researchers and supply chain analysts a powerful tool for modeling complex dynamics and managing high-throughput scenarios.

Fig 1: Sample Dashboard Connecting Simudyne SDK to Custom Visualization Layer

Fig 1: Sample Dashboard Connecting Simudyne SDK to Custom Visualization Layer

Running supply chain simulations on AWS

Using the Simudyne SDK and the Supply Chain Toolkit, Amazon’s Worldwide Design Engineering team, Simudyne, and AWS’s Emerging Technologies & Workloads team worked together to build a simulation of Amazon’s US inbound supply chain on AWS.

We’ve shown the reference architecture in Figure 2. The simulation code connects to an Amazon Redshift data warehouse to pull relevant supply chain data that’s used in the simulations.

Typically, a full-scale simulation of the US inbound supply chain can be executed on a r6a.32xlarge EC2 instance, which not only has 128 vCPUs, but also comes with over 1 TiB of RAM. Agent-based simulations are often memory-intensive applications and more performant when the state of agents during simulations can be saved and operated in memory, making high-memory instances found on AWS very handy. On an r6a.32xlarge instance, three (3) simulation weeks of the full US inbound supply chain ran in about an hour.

Figure 2: AWS reference architecture used to run simulations of the Amazon US inbound supply chain.

Figure 2: AWS reference architecture used to run simulations of the Amazon US inbound supply chain.

Conclusion

Using Simudyne’s technology to simulate our supply chain has opened new avenues for us. We think It can provide insights into cost reduction, service improvement, environmental impact, and strategic adaptability.

This project is not just a testament to Amazon’s commitment to innovation but also an example for people exploring the frontiers of supply chain optimization. We’ll continue to refine our models and strategies because the potential for groundbreaking improvements in e-commerce logistics remains vast and exciting.

Now that we’ve successfully modeled our inbound supply chain network helping with the Inbound regionalization initiative as outlined in our CEO’s letter to shareholders, our focus is now shifting to simulating the outbound network – the critical journey of products from our Fulfillment Centers to customers. This new phase of modeling will let us explore and experiment with various strategies – including intermodal transport – within the simulated environment.

This allows us to refine and validate our strategies before we implement them in the real world. In our upcoming posts, we plan to share insights from our experience extending our simulations and using AI to further optimize the network, offering a glimpse into the cutting-edge methods driving supply chain efficiency.

Simudyne currently offers a 30-day free trial of its SDK, which you can find in AWS Marketplace.

Siva Veluchamy

Siva Veluchamy

Siva Veluchamy is a Sr. Research scientist for WWDE(Worldwide Design Engineering) at Amazon. Siva has several years of experience in solving complex real world optimization problems applying cutting edge technologies. He is specialized in interdisciplinary research space that includes simulation, mathematical optimization and artificial intelligence.

Ilan Gleiser

Ilan Gleiser

Ilan Gleiser is a Principal Emerging Technologies Specialist at AWS WWSO Advanced Computing team focusing on Circular Economy, Agent-Based Simulation and Climate Risk. He is an Expert Advisor of Digital Technologies for Circular Economy with United Nations Environmental Programme. Ilan’s background is in Quant Finance and Machine Learning.

Sam Bydlon

Sam Bydlon

Dr. Sam Bydlon is a Specialist Solutions Architect with the Advanced Compute, Emerging Technologies team at AWS. Sam received his Ph.D. in Geophysics from Stanford University in 2018 and has 12 years of experience developing and utilizing simulations in research science and financial services. In his spare time, Sam enjoys camping, waterfalls, and camping near waterfalls.

Jiyan Babaie-Harmon

Jiyan Babaie-Harmon

Jiyan Babaie-Harmon is a Quantitative Researcher at Simudyne focused on the development of computational models for understanding complex adaptive systems. Jiyan has been building agent-based models in Java and Python across a wide variety of applications and use cases that include finance, health & life sciences, operations research, and defense.

Justin Lyon

Justin Lyon

Justin Lyon is the CEO of Simudyne, a simulation technology company based in London. He is a leading expert in agent-based simulation and artificial intelligence. Justin has presented at Bloomberg, FT Innovate and TEDx, and has also appeared on CNBC and the BBC. His work has been featured in publications including the Wall Street Journal, Financial Times, Wired and The Banker.