Solution | Inventory Allocation Optimization with Grid Dynamics#
Overview#
Business case#
Managing inventory levels across multiple locations is a mission-critical task for retailers of perishable and seasonal goods. It represents a significant challenge for all organizations managing complex supply chains with impact on costs, customer attractiveness, and competitiveness.
Leveraging data and analytics offers supply chain managers the opportunity to rethink allocation strategies of inventories across warehouses and other locations to:
Minimize the order shipping costs by allocating to the most optimal locations and sourcing orders from there.
Reduce/avoid order splits (that is, sourcing one order from multiple locations).
Reduce/avoid expensive shipping options (for example international shipping due to local stockouts).
Reduce/avoid cross-warehouse inventory movements and backorders.
Improve customer experience by increasing availability and providing better order fulfillment SLAs.
With the Inventory Allocation Optimization Solution powered by Dataiku and Grid Dynamics, supply chain managers and their analytics teams take a jump start in determining the optimal allocation parameters for their inventories based on specific business objectives and constraints. With the comprehensive insights provided in the scalable Dataiku platform, supply chain managers quickly embark on a successful journey to streamline their end-to-end supply chain operations.
Note
Grid Dynamics developed this Solution in cooperation with Dataiku. Grid Dynamics is a leading provider of technology consulting, agile co-creation, data science, and supply chain optimization services. Grid Dynamics is a public Nasdaq-traded (NASDAQ:GDYN) company headquartered in San Ramon, California with offices in 13 countries worldwide. The company is known for delivering innovative solutions that combine AI and cloud-native technologies for Fortune 1000 clients. Grid Dynamics provides Professional services for integrating this Solution and developing custom analytics solutions on demand.
Caution
This solution is not available on Dataiku Cloud. Although you may try to create the project using the instructions below, Dataiku offers no support in this case.
Installation#
From the Design homepage of a Dataiku instance connected to the internet, click + Dataiku Solutions.
Search for and select Inventory Allocation Optimization.
If needed, change the folder into which the Solution will be installed, and click Install.
Follow the modal to either install the technical prerequisites below or request an admin to do it for you.
From the Design homepage of a Dataiku instance connected to the internet, click + New Project.
Select Dataiku Solutions.
Search for and select Inventory Allocation Optimization.
Follow the modal to either install the technical prerequisites below or request an admin to do it for you.
Note
Alternatively, download the Solution’s .zip project file, and import it to your Dataiku instance as a new project.
Technical requirements#
To leverage this Solution, you must meet the following requirements:
Have access to a Dataiku 11.2+ instance.
To benefit natively from the Solution’s Dataiku application, you need an SQL connection storing your data (see Data requirements). However, the Solution comes with demo data available on the filesystem-managed connection.
A Python 3.6 code environment named
sol_inventory-allocation-optimization
with the following required packages:
pandas==1.0.5
numpy==1.19.5
absl-py==1.4.0
ortools==9.4.1874
protobuf==3.19.6
python-dateutil==2.8.1
pytz==2020.5
PyYAML==6.0
six==1.16.0
Data requirements#
You can find the Solution’s full data model in the accompanying Solution wiki.
Dataset |
Description |
---|---|
supply_nodes (mandatory) |
Lists the present warehouses (aka supply nodes) and their respective capacity. |
supply (mandatory) |
Contains information about current product stock at different warehouses. Also contains information about the cost of procurement per product unit at different warehouses. |
demand_forecast (mandatory) |
Contains a list of demand for product sets per demand node (for example stores). |
shipping (mandatory) |
Indicates the shipping costs between warehouses and stores for an individual unit of product. |
demand_nodes (mandatory) |
Contains the list of demand nodes. |
product_procurement_baseline (optional) |
Contains information about the number of procured products at different warehouses. This data represents baseline numbers for procurement quantities. |
product_allocation_baseline (optional) |
Contains information about the number of different products shipped from a specific warehouse to a specific store. This data represents baseline product allocation. |
Workflow overview#
You can follow along with the Solution in the Dataiku gallery.

The project has the following high-level steps:
Input and preprocess supply, demand, and product data.
Optimize inventory allocation via mixed integer programming (MIP).
Calculate total procurement, shipping, and baseline costs.
Visualize applicable metrics for every stage of the supply chain involved in inventory allocation optimization.
Compare optimized results with the benchmark to assess optimization strategies.
Walkthrough#
Note
In addition to reading this document, it’s recommended to read the wiki of the project before beginning to get a deeper technical understanding of how this Solution was created and more detailed explanations of Solution-specific vocabulary.
Plan inventory distribution across warehouses - optimized for procurement and shipping costs#
To determine the optimal level of inventories on hand, and their distribution across warehouses, you must first have sufficient data on:
your supply nodes (a.k.a. warehouses)
the supply of your products
forecasted demand of products within stores
store information
shipping costs.
This information corresponds to the required datasets detailed in the previous Data requirements section. You can connect this information to this Solution via the Dataiku application. To begin, you will need to create a new instance of the Inventory Allocation Optimization Dataiku application. You can do this by selecting the Dataiku application from your instance home, and clicking Create App Instance. You can create several application instances if you want to determine optimization strategies based on different data or different parameters.
Once you have created a new instance, you can walk through the steps of the application to connect your data and align it to the defined data model shipped with this Solution. The changes made to these first steps of the Dataiku application will impact and update the inputs and preprocess_zone Flow zones so that the Flow can adjust to your input data.
If you have the optional datasets (product_procurement_baseline and product_allocation_baseline), you can identify these datasets from the Dataiku application. Doing so will trigger the activation of the product_procurement_benchmark_calculation, product_shipping_benchmark_calculation, and cost_benchmark_calculation Flow zones. We’ll go into more detail about the impact of these zones in the next section of the article.

Once you’ve connected your data, and the full Flow has been rebuilt with your data and adjusted needs, you can continue to the final section of the Dataiku application to configure parameters for optimization settings. Specifically, it’s here that you can set your relative MIP gap. This serves as a hard constraint that you can’t violate while the Solution searches for an optimized inventory allocation strategy that minimizes costs) and identify if we’re using product sets in our demand forecast. We can tell the Dataiku App to Optimize and Solve with our selected values via the “Run Now” button. This will run the optimization Flow zone’s python recipe, which converts our input data into an optimization objective and constraints. The library used to optimize is specifically developed by Grid Dynamics. The processes need some time to finish optimizing but once it’s complete, the solution will also rebuild the dashboard_zone Flow zone so that all datasets used for visualization are updated. Once this is all complete, we can go directly to the Dataiku Dashboards provided to visualize our results.
Compare optimized plans with a baseline or historical plan#
Having provided the optional product_procurement_baseline and product_allocation_baseline datasets when setting up the Dataiku application, the solution will analyze our optimized plan against a Baseline Historical Plan. This is done by joining the product_procurement_baseline dataset to a cleaned version of the supply dataset within the product_procurement_benchmark_calculation Flow zone. From this joined dataset, we’re then able to calculate the total procurement cost from the baseline. In parallel, the product_shipping_benchmark_calculation Flow zone joins our product_allocation_baseline data to shipping data and calculates the total shipping cost from the baseline. The outputs of these two Flow zones are stacked and grouped cost_benchmark_calculation by the Flow zone so that a final dataset baseline_objective_cost contains the overall baseline cost for inventory allocation plan represented in our baseline data.

With the baseline identified, the dashboard_zone Flow zone joins the baseline costs to the costs of an optimized plan and creates visualizations comparing the two. The Benchmark Dashboard contains all comparative visualizations and metrics.
This single page dashboard shows the most important metrics related to the total cost, procurement costs, procurement quantities, shipping costs, and shipping quantities for both plans. You can use the filter on the left side for the metrics and charts by specific warehouses.
At the top of the page, there is a comparison of the total optimized cost vs. baseline cost. Moving down the page, you’ll find a more detailed and comprehensive cost-by-cost comparison that makes up the total cost differences. Each individual cost/quantity section has a vertical stacked bar plot comparing the corresponding metric and a pivot table providing an in-depth overview of the average enhancement for the given metric per warehouse.
Through this dashboard, you’re able to validate whether the output of optimization is actually better than the current inventory allocation plan. Over time, you could use it to analyze the success of ongoing inventory allocation optimization strategies.
Visualize warehouse utilization, product stocks, and distribution costs#
In addition to the optional Benchmark Dashboard, this Solution comes with a prebuilt Results Dashboard, which will be fully built independent of the optional benchmark datasets. This dashboard contains visualizations and metrics based on data analyzing the optimized inventory allocation plan.
It’s broken down into three distinct pages: Warehouse, Shipping, and Procurement. The pre-built dashboards provided with this Solution can be a powerful tool for the supply chain manager to gain real-time insights and visualize key performance indicators (KPIs) crucial for managing their supply chain operations.
Starting first with the Warehouse page, you’re provided a comparison of the capacity of your warehouses (a.k.a. supply nodes) before and after optimization. It specifically monitors the number of distinct products and warehouses, as well as the total quantity of products that need to be kept on hand in the warehouse.
You can filter all charts and metrics by warehouse and/or Product ID. Use of these visualizations can help you better understand how the capacity of your warehouses is being used and make decisions on how to best distribute your products across warehouses to ensure they’re available to meet demand.

Having better understood how to optimize supply, it’s now relevant to see how the optimization plan impacts shipping. The Shipping page provides information about shipping costs per store and per warehouse by visualizing total shipping costs, average shipping costs, and total order count.
Once again, filters on the left enable filtering by warehouse or store. Looking at these visualizations can help you identify where the highest shipping costs are being incurred so that you can quantify the impact of a new inventory allocation plan on a significant cost of your supply chain.

Finally, the Procurement page visualizes procurement costs per warehouse and products. Here you can see where most procurement is happening and the most popular products. The filters on this page allow you to adjust the data based on the warehouses and products. This information can help supply chain managers to better plan the procurement of products for different warehouses, as well as product allocation.

Based on the visualizations provided in the dashboard, you could go back to the Dataiku application and make adjustments to the MIP gap parameters to further adjust the optimization and identify the best parameter/result combination for your needs.
Use outputs to support downstream decisions#
Beyond the dashboards provided with the Solution, two results datasets for download are also generated in the final step of the Dataiku application. The first dataset, product_allocation, provides a list of quantities needed for specific products to be shipped from a warehouse (supply node) to the store (demand node).
The product_procurement_list output dataset provides a list of certain quantities needed to procure in a warehouse (supply node). The dashboard visualizes the aggregated form of this data. It also provides this data in a direct CSV format, as it’s useful for a supply chain manager to understand what products they must procure and where they need to be shipped.
You could connect these CSV outputs to other decision-supporting tools, such as inventory replenishment tools. This can help ensure that the outputs of analysis and optimization are making a meaningful impact on your end-to-end supply chain operations. Furthermore, you can automate this entire Solution using the pre-built scenarios to refresh the input data, rerun the optimization, and send the results to the downstream optimization systems.


Reproducing these processes with minimal effort for your data with Grid Dynamics#
The intent of this project is to help supply chain management teams understand how they can use Dataiku to optimize stock levels across locations, improve fulfillment SLAs, and minimize order shipping costs.
By creating a singular Solution that can benefit and influence the decisions of a variety of teams in a single organization, you can design smarter and more holistic strategies to minimize shipping costs, reduce order splits, avoid expensive shipping options, reduce cross-warehouse inventory movements, and improve customer experience.
We’ve provided several suggestions on how you can optimize your inventory allocation plans, but ultimately the “best” approach will depend on your specific needs and your data.
To customize this Solution to your needs, get in touch with Grid Dynamics supply chain and data science experts. In addition to customizing this Solution, Grid Dynamics is a leading provider of technology consulting with services for supply chain consulting, analytics, AI strategy consulting, and engineering.