A Markov Decision Process (MDP) is a formal mathematical framework for modeling sequential decision-making in a stochastic environment, defined by a tuple (S, A, P, R, γ). An agent observes the current state (S), selects an action (A), and the environment transitions to a new state according to a transition probability (P), emitting a numerical reward (R). The Markov property ensures the next state depends solely on the immediate state and action, not the full history.
Glossary
Markov Decision Process (MDP)

What is Markov Decision Process (MDP)?
A Markov Decision Process is the mathematical foundation for modeling optimal decision-making in environments where outcomes are partly random and partly under the control of a decision-maker.
The objective is to discover an optimal policy (π) that maximizes the expected cumulative discounted reward over time. The discount factor (γ) balances immediate versus future rewards. MDPs are the theoretical backbone of Reinforcement Learning (RL) and are directly applied in last-mile logistics to model dynamic dispatching, where a vehicle's location is the state, routing choices are actions, and on-time delivery is the reward signal.
Core Components of an MDP
A Markov Decision Process provides the mathematical scaffolding for sequential decision-making under uncertainty. Each component defines how an agent perceives its world, makes choices, and learns from outcomes.
State Space (S)
The complete set of distinct situations the agent can encounter. A state must capture all relevant information for decision-making, satisfying the Markov property—the future depends only on the current state, not the history.
- Example: In last-mile delivery, a state might encode the vehicle's current grid location, remaining capacity, and the set of undelivered parcels.
- Design: A compact, informative state representation is critical; omitting key variables (like remaining driver hours) breaks the Markov assumption and degrades policy quality.
Action Space (A)
The set of all possible moves the agent can execute in a given state. Actions can be discrete or continuous and are the agent's only mechanism for influencing the environment.
- Discrete Actions: Navigate north, south, east, west on a grid; accept or reject a new order.
- Continuous Actions: Apply a specific steering angle and acceleration value.
- Constraint: The set of available actions may be state-dependent (e.g., you cannot 'deliver' if the vehicle is empty).
Transition Probability (P)
The core stochastic element, defining the probability of moving from state s to state s' after taking action a. It is formally expressed as P(s' | s, a).
- Deterministic vs. Stochastic: In a deterministic grid world, 'move north' always succeeds. In a stochastic delivery model, 'dispatch to zone A' has a 70% chance of on-time arrival and a 30% chance of delay due to traffic.
- Model-Based vs. Model-Free: If the transition function is known, the agent can plan internally. If unknown, the agent must learn it through real-world interaction.
Reward Function (R)
A scalar feedback signal received after transitioning from state s to s' via action a. It defines the goal, not how to achieve it. The agent's objective is to maximize the cumulative discounted reward over time.
- Sparse Rewards: +100 for successful delivery, 0 otherwise. Simple but hard to learn from.
- Dense Rewards: -1 per time step (penalizing delay), +10 for each parcel dropped off. Provides constant learning signal.
- Shaping: Carefully designing intermediate rewards is essential for guiding the agent toward the terminal goal in complex routing problems.
Policy (π)
The agent's brain—a mapping from states to actions. It dictates the behavior: π(a|s) is the probability of selecting action a in state s. The goal of solving an MDP is to find the optimal policy π*.
- Deterministic Policy: In state s, always take action a (e.g., always turn right at this intersection).
- Stochastic Policy: In state s, take action a1 60% of the time and a2 40% of the time. Useful for exploration and optimal play in games like rock-paper-scissors.
Discount Factor (γ)
A value between 0 and 1 that determines the present value of future rewards. A reward received k steps in the future is worth γᵏ times its immediate value.
- γ ≈ 0 (Myopic): The agent aggressively prioritizes immediate rewards, ignoring long-term consequences. A delivery agent might refuse a slightly out-of-the-way pickup even if it leads to a high-value chain.
- γ ≈ 1 (Farsighted): The agent values future rewards almost as much as immediate ones, enabling long-term strategic planning like repositioning an empty vehicle to a high-demand area.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about Markov Decision Processes and their role in sequential decision-making under uncertainty.
A Markov Decision Process (MDP) is a mathematical framework for modeling sequential decision-making in environments where outcomes are partly random and partly under the control of a decision-maker. An MDP is formally defined by a 5-tuple: a finite set of states (S), a finite set of actions (A), a transition probability function P(s'|s,a) that defines the probability of moving to state s' after taking action a in state s, a reward function R(s,a) that provides immediate feedback, and a discount factor γ (gamma) between 0 and 1 that balances immediate versus future rewards. The defining characteristic is the Markov property—the future depends only on the current state and action, not on the history of how that state was reached. The objective is to find an optimal policy π(s) that maps states to actions to maximize the expected cumulative discounted reward over time.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
MDP vs. Related Optimization Frameworks
A comparison of mathematical frameworks used for modeling sequential decision-making under uncertainty, highlighting their core assumptions and applicability to last-mile logistics.
| Feature | Markov Decision Process (MDP) | Multi-Armed Bandit (MAB) | Contextual Bandit |
|---|---|---|---|
State Dependency | Full state transitions; next state depends on current state and action | Stateless; each decision is independent of previous actions | State represented as a context vector; no sequential state transitions |
Feedback Loop | Delayed reward; actions affect future states and long-term cumulative return | Immediate reward; no impact on future decision scenarios | Immediate reward; context changes but is not influenced by the agent's actions |
Exploration vs. Exploitation | Balanced via policy iteration; explores state-action space for optimal long-term trajectory | Balanced to minimize regret over independent trials | Balanced by learning context-reward mappings to minimize regret |
Modeling Horizon | Infinite or finite horizon with discount factor | Fixed number of independent trials | Fixed number of independent trials with varying contexts |
Optimal Policy Goal | Maximize expected cumulative discounted reward | Maximize total reward by identifying the single best arm | Maximize total reward by selecting the best arm for each specific context |
Transition Probability Matrix | |||
Last-Mile Application | Dynamic re-routing of a vehicle where each decision changes its location and future delivery windows | A/B testing delivery time slot offerings to find the single most accepted option | Selecting the optimal delivery time slot for a specific customer based on their historical preferences and location |
Related Terms
A Markov Decision Process (MDP) is the mathematical bedrock for sequential decision-making under uncertainty. The following concepts are essential for understanding how MDPs are applied to optimize last-mile delivery routes and logistics.
Policy vs. Value Function
The two core concepts solved for in an MDP. A policy (π) is a mapping from states to actions—the driver's rulebook for which street to take next. A value function (V(s)) estimates the expected long-term reward from a given state, quantifying how 'good' it is to be at a specific location at a specific time.
- *Optimal Policy (π)**: The strategy that maximizes cumulative reward, such as minimizing total delivery time.
- State-Value Function: Predicts future on-time probability from the current vehicle location.
Bellman Equation
The recursive decomposition that makes solving MDPs computationally tractable. It states that the value of a state equals the immediate reward plus the discounted value of the next state, assuming optimal actions thereafter. This principle underpins dynamic programming solutions for the Vehicle Routing Problem (VRP).
- Bellman Optimality Equation: Defines the condition an optimal value function must satisfy.
- Discount Factor (γ): Models the preference for immediate on-time deliveries versus future ones, typically set between 0.9 and 0.99.
Stochastic Transition Model
The 'Markov' property of an MDP: the future state depends only on the current state and action, not on the history. In last-mile delivery, this models the probabilistic nature of travel times. An action (taking a route) does not lead to a deterministic outcome but to a distribution of possible arrival times due to traffic and weather.
- Transition Probability P(s'|s,a): The probability of arriving at the next stop on time given the current location and chosen route.
- Markov Property: Simplifies complex historical traffic patterns into the current state of congestion.
Exploration vs. Exploitation
The fundamental trade-off in learning an MDP without a pre-defined model. An agent must exploit known high-reward routes to ensure current delivery performance while also exploring new, potentially faster paths to improve future efficiency. This is critical for adapting to urban dynamics.
- ε-Greedy Strategy: A simple method where the agent chooses a random action with probability ε, otherwise exploits the best-known route.
- Upper Confidence Bound (UCB): A more sophisticated approach that balances the estimated value of a route with the uncertainty of that estimate.
Partially Observable MDP (POMDP)
An extension of the MDP framework where the agent cannot directly observe the true state of the world. A delivery vehicle only sees its own GPS location, not the full traffic state or all other drivers' intentions. The agent must maintain a belief state—a probability distribution over possible true states.
- Belief State Update: Uses Bayesian inference to update the understanding of traffic conditions based on new sensor readings.
- Application: Essential for coordinating autonomous mobile robots in a warehouse where sensor occlusion is common.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us