Modelling Customer Trajectories with Reinforcement Learning for Practical Retail Insights

Ken Ming Lee, Paul Barde, Maxime C. Cohen, Derek NowrouzezahraiarXiv 2026

TL;DR

This paper introduces an agent-based framework that uses Maximum Entropy Reinforcement Learning (MaxEnt RL) to simulate realistic customer movements within retail stores. Unlike traditional shortest-path heuristics, the RL approach captures the natural stochasticity and bounded rationality of human shoppers. When applied to store layout optimization, the RL-generated trajectories accurately predict shelf traffic and impulse purchase rates, yielding product placement decisions that match the profitability of those derived from real-world tracking data.

What Problem Does This Paper Address?

Brick-and-mortar retailers rely heavily on store layout optimization to maximize profit, primarily by placing high-margin impulse items in high-traffic areas. To do this effectively, they need to know how customers navigate the store.

While tracking real-world customer trajectories (via cameras or sensors) provides accurate data, it is prohibitively expensive and logistically challenging for most retailers. Consequently, researchers and practitioners turn to cheap mathematical heuristics like the Travelling Salesman Problem (TSP) or Probabilistic Nearest Neighbour (PNN) to simulate customer paths. However, real humans are not perfectly efficient algorithms; they deviate from the shortest paths by an average of 28%. This accuracy gap leads to poor layout evaluations and suboptimal product placement.

Methods

The authors bridge this gap by framing customer trajectory prediction as a Maximum Entropy Reinforcement Learning (MaxEnt RL) problem.

Instead of just maximizing a reward (e.g., finding the fastest route to items on a shopping list), a MaxEnt RL agent optimizes for a trade-off between reward and policy entropy (randomness). This formulation naturally models "bounded rationality"—the human tendency to take diverse, slightly sub-optimal, or exploratory paths.

Key components of their implementation include:

  • Environment: A 2D gridworld representation of a real convenience store built using the Gymnasium Minigrid framework, where each cell represents a 50×50 cm space.
  • Agent Design: The customer agent is trained using Proximal Policy Optimization (PPO) with a convolutional neural network backbone.
  • Conditioning: To simulate diverse shopping trips, the agent is conditioned on a specific target basket (items to buy), a checkout location, and an optional timestep budget (how long they intend to stay).
  • Reward Function: Agents are rewarded for successfully collecting the items in their basket, using the correct checkout, and adhering to their time budget, alongside an exploration bonus for visiting unique states.
Figure 1: Various representations of the retail store. (a) Grid-based representation for RL training. (b) Overlay of customer trajectories on the RL environment, illustrating spatial alignment with the physical store. (c-d) Top-down and first-person views of the 3D digital twin constructed from the same discretized representation.

Datasets

The framework was trained and validated using a unique, real-world dataset:

  • In-Store Trajectory Data: Collected from a local convenience store between September 2023 and February 2024. The raw data consisted of 3D joint coordinates captured at 5 Hz via overhead camera arrays, mapped to corresponding checkout baskets.
  • Preprocessed Data: After filtering out incomplete data and discretizing paths to the gridworld, 3,054 ground-truth human trajectories remained for evaluation.
  • Product Assortment: The study focused on the top 61 best-selling products (representing ~51% of total sales), categorized into 11 distinct departments (e.g., Soft Drinks, Bakery, Cold Food).

Key Insights and Ideas

  • The Failure of Shortest Paths: Traditional heuristics like TSP assume global optimization, which completely misses how humans actually behave. For instance, if a customer wants to buy an item, TSP will always send them through the single shortest corridor. If an impulse item is placed in an alternative parallel corridor, TSP assumes it receives zero traffic, which is false in reality.
  • The "Infinite Impulse" Bug: Because heuristics completely miss out-of-the-way shelves, calculating impulse rates using their trajectories results in dividing by zero (purchases recorded in real data divided by zero predicted shelf visits). MaxEnt RL solves this by ensuring agents occasionally explore these quieter paths, matching human behavior.
Trajectory heatmaps showing that only RL successfully recovers the alternative path taken by humans.

Key Results

The authors evaluated the simulated trajectories across three distinct use cases:

  1. Trajectory Similarity: RL-generated paths aligned far better with real human trajectories than the baselines. On average heatmap distributions, RL achieved a Jensen-Shannon Divergence (JSD) of 0.415, outperforming PNN (0.580) and TSP (0.657).
  2. Traffic & Impulse Estimation: RL accurately preserved the relative ordering of product impulsivity. For example, it correctly identified Soft Drinks as highly impulsive, whereas TSP and PNN failed to compute rates due to zero-visit pathing errors.
  3. Layout Optimization Profitability: The ultimate test involved repositioning an impulse product to maximize profit.
  4. The layout informed by ground-truth human data yielded an expected profit gain of $0.162 per customer.
  5. The RL-informed layout perfectly replicated this decision, achieving the exact same $0.162 gain.
  6. The TSP and PNN layouts chose suboptimal locations, yielding significantly lower gains ($0.090 and $0.050, respectively).

Limitations and Future Work

While highly effective, the authors note a few limitations and areas for future development:

  • Computational Overhead: Unlike heuristics which can be computed instantly on-the-fly, training the RL agent is computationally expensive.
  • Layout Rigidity: Currently, the RL agent must be retrained from scratch if the physical structure of the store changes. The authors suggest domain randomization (training on randomized store layouts) as a future path to create a zero-shot generalizable policy.
  • Scope Expansion: The optimization use case was limited to a single customer segment and a single product swap. Future work will look into scaling this to multi-segment customer behaviors and end-to-end hierarchical layout optimization.

Summary updated

BibTeX
@misc{lee2026modelling,
  author = {Ken Ming Lee and Paul Barde and Maxime C. Cohen and Derek Nowrouzezahrai},
  title = {{Modelling Customer Trajectories with Reinforcement Learning for Practical Retail Insights}},
  year = {2026},
  eprint = {2605.18449},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.18449},
}
Figure