Technical Deep Dive
Three models — Deep Learning forecasting, dynamic pricing, and inventory optimization — working together to tell a retailer exactly what to do this week.
Most retailers make pricing and ordering decisions based on gut feeling. This app replaces intuition with an integrated AI pipeline that optimizes every decision simultaneously.
The System
Each module solves a different business problem. The Summary Dashboard combines all three into one actionable recommendation per product, per week.
The Technology
Each model is chosen for a specific reason — not just because it's popular, but because it's the right tool for the problem.
Module 1
Powered by PyTorch, the Temporal Fusion Transformer (TFT) is a state-of-the-art deep learning model for time series. Unlike traditional models, it can simultaneously ingest static metadata (product categories), known future inputs (planned price changes), and historical sales. Trained on 3 years of daily data per product, it captures the highly non-linear relationship between pricing strategies, seasonality, and consumer demand.
PyTorch · pytorch-forecasting · Deep LearningModule 2
This module uses a hybrid approach. SciPy's bounded scalar minimizer mathematically finds the theoretical profit-maximizing price in milliseconds, plotting a continuous baseline curve. Concurrently, the live price slider feeds user input directly into the cached TFT model to infer a highly accurate 1-point prediction. By visualizing both the AI's prediction and the theoretical benchmark together, users gain trust through transparency.
scipy.optimize · Hybrid Rendering · Real-time InferenceModule 3
The inventory problem is a discrete, multi-period decision with hard constraints. For the next 8 weeks, the solver decides: order or not, and how many? Constraints include: stock must never fall below the safety level, and there is a lead time between ordering and receiving. CP-SAT models this as a mixed-integer optimization problem. Crucially, it takes the AI-predicted demand directly from the pricing module to find the order combination that minimizes total cost.
OR-Tools CP-SAT · Multi-period planning · Integrated Data PipelineHow They Connect
The three models form a fully integrated pipeline — a change in price dynamically ripples through to the inventory plan.
When a user adjusts the price slider, the planned price is fed into the loaded Temporal Fusion Transformer (.ckpt) to dynamically infer the demand for the next 8 weeks based on historical context.
Simultaneously, a mathematical profit curve is generated to find the theoretical optimal price. This serves as a continuous benchmark against the AI's specific point prediction.
The dynamic 8-week demand forecast generated by the TFT model is passed directly into the inventory optimizer. The solver determines the cheapest order schedule that keeps stock within safe levels.
The Summary Dashboard fetches the user's selected price state for every product and processes the end-to-end pipeline in real time. It presents actionable insights: the demand forecast vs. last week, the recommended pricing strategy based on gap analysis, and the exact order quantity to place today.
Business Applications
Every decision this system makes replaces a manual process that currently takes hours — or doesn't happen at all. Here are six concrete applications.
Perishable products like milk, bread, and fresh produce have a shelf life of days. Overordering leads to waste and markdowns; underordering leads to empty shelves and lost sales. The AI demand forecast tells a store manager exactly how much to order each week, accounting for complex seasonal patterns and price changes. The inventory optimizer then calculates the precise order quantity that minimizes waste while avoiding stockouts.
Most small and mid-size grocery chains set prices once a quarter based on competitor surveys and gut feeling. The dynamic pricing module shows that even a $0.20 price adjustment on a high-velocity item like milk can shift weekly profit by hundreds of dollars. By simulating demand against a deep learning model in real time, the engine enables data-driven weekly price reviews that take minutes instead of days.
Orange juice demand spikes in December and January; bread demand rises in November. Without forecasting, buyers either overstock at peak (wasting capital on inventory) or understock (missing the seasonal opportunity). The 8-week planning horizon in the inventory optimizer gives buyers enough lead time to build up stock before the seasonal peak and run it down cleanly afterward.
A convenience store manager typically oversees hundreds of SKUs with limited time for analysis. The product-by-product tab structure of the Retail Decision Engine mirrors how a category manager thinks — one product at a time, with all the relevant data in one view. Scaling this system to cover 100 products would give a category manager a complete weekly decision brief without opening a spreadsheet.
Wholesalers and distributors place orders from multiple suppliers with different lead times and minimum order quantities. The inventory optimizer's 8-week planning horizon makes it possible to consolidate orders across products supplied by the same vendor — reducing the number of individual purchase orders, qualifying for volume discounts, and smoothing delivery schedules.
The real-time price slider and live profit curve make the relationship between price, demand, and profit viscerally clear — even to non-technical buyers. Many retail organizations struggle to get buyers to adopt AI because the models feel like black boxes. The Engine's interactive visualizations make the logic transparent, building trust and accelerating adoption across the buying team.
Why It Matters
Connecting three different AI models into a single coherent product requires understanding how each model's output becomes another model's input. Building this fully integrated pipeline is what separates a data scientist from a data product builder.
Deep Learning (TFT) for complex non-linear time series forecasting, SciPy for continuous optimization, and OR-Tools for discrete scheduling. Using the right tool for each problem — rather than forcing one tool to do everything — is a hallmark of experienced engineering.
The live price slider, hybrid charts, and plain-language Summary Dashboard are designed for a store manager, not a data scientist. Making complex AI outputs immediately actionable for non-technical decision-makers is a product management skill as much as an engineering one.
Hawaii's grocery and convenience retail market operates with thin margins, high transportation costs, and unique seasonal patterns. The combination of dynamic demand forecasting and inventory minimization addresses exactly the pressures that Hawaii retailers face.
Try It
Generate demo data, move the price slider, run the inventory optimizer — then check the Summary Dashboard for the integrated recommendation.
↗ Open Live App ← Back to Portfolio