Docsity

Markov Decision Process(MDP)AI, Lecture notes of Artificial Intelligence

Toggle sidebar
bg1
STUDENT HANDOUT · ARTIFICIAL INTELLIGENCE · WEEK 6
MDPs and Q-Learning: The
Problem vs. The Solver
A companion to the Week 6 lecture. It answers the most common confusion in Reinforcement
Learning — is an MDP the same thing as Q-Learning? — and builds up Q-values, Q-tables,
and optimal policies with everyday examples.
01
Is MDP the Same as Q-Learning?
ONE-LINE ANSWER
No.
The MDP is the
problem
(the world and its rules). Q-Learning is
one
method to solve
that problem.
Analogy — a city and a taxi driver. The city already exists: roads, traffic, signals, speed breakers,
fuel costs, destinations. The city is the environment — that is the MDP. Now a new taxi driver
arrives knowing nothing. Day one he takes a wrong road; day two he gets stuck in traffic; day three
he finds a shortcut. After weeks he learns: "at this junction, turning left is usually better." That
learning process is Q-Learning. The city never changed — only the driver's knowledge improved.
Reinforcement Learning
Problem = MDP
Value Iteration
model-based
Policy Iteration
model-based
Q-Learning
model-free
SARSA · Deep Q Network
Figure 1 — The MDP defines the problem; algorithms like Q-Learning learn how to act within it.
MDPs
&
Q-Learning AI · Week 6 · Sitare University
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Markov Decision Process(MDP)AI and more Lecture notes Artificial Intelligence in PDF only on Docsity!

S T U D E N T H A N D O U T · A R T I F I C I A L I N T E L L I G E N C E · W E E K 6

MDPs and Q-Learning: The

Problem vs. The Solver

A companion to the Week 6 lecture. It answers the most common confusion in Reinforcement

Learning — is an MDP the same thing as Q-Learning? — and builds up Q-values, Q-tables,

and optimal policies with everyday examples.

01 Is MDP the Same as Q-Learning?

O N E - L I N E A N S W E R No. The MDP is the problem (the world and its rules). Q-Learning is one method to solve that problem.

Analogy — a city and a taxi driver. The city already exists: roads, traffic, signals, speed breakers,

fuel costs, destinations. The city is the environment — that is the MDP. Now a new taxi driver

arrives knowing nothing. Day one he takes a wrong road; day two he gets stuck in traffic; day three

he finds a shortcut. After weeks he learns: "at this junction, turning left is usually better." That

learning process is Q-Learning. The city never changed — only the driver's knowledge improved.

Reinforcement Learning

Problem = MDP

Value Iteration model-based

Policy Iteration model-based

Q-Learning model-free SARSA · Deep Q Network

Figure 1 — The MDP defines the problem; algorithms like Q-Learning learn how to act within it.

02 What Exactly Is an MDP?

An MDP completely describes the environment with five components. Note what is missing : there is

no Q-table and no learning. An MDP simply describes the world.

Component Meaning Warehouse-robot example

States S "Where am I right now?" Shelf A, Shelf B, Charging Station, Delivery Point

Actions A "What can I do next?" Move Left, Move Right, Pick Item, Drop Item

Transition T(s,a,s′)

P(s′|s,a) — where do I actually end up?

Move right → 95% actually moves right, 5% wheel slips

Reward R Was that move good or bad?

Deliver +100 · Collision −100 · Each step −

Discount γ How much are future rewards worth? 0 < γ < 1, e.g. γ = 0.

Stochastic transitions — the GridWorld question

In the lecture's GridWorld, from START with action UP : the intended move succeeds with probability

0.8 , the agent slips RIGHT with 0.1 , and stays at START with 0.1. Yes — that statement is correct,

and it is exactly what the transition model encodes:

START

UP · 0.

slip · 0. stay · 0.

T(UP | START, UP) = 0. T(RIGHT | START, UP) = 0. T(START | START, UP) = 0. Σ = 1.0 ✓ Probabilities over all outcomes of one action always sum to 1.

Markov Property: the future depends only on the current state and action — never on how you got there. Google Maps doesn't need yesterday's route; it only needs where you are now. This is what makes MDPs tractable.

02a·ii Gamma in Plain Words

Before any formula, it helps to see γ as a simple human question. Gamma answers:

T H E Q U E S T I O N γ A N S W E R S “How much do I value something I get later ?”

L O W γ = 0. 5

You are very impatient.

You heavily reduce the value of future money.

₹100 today → ₹ 100 ₹100 much later → feels like a much smaller amount

H I G H γ = 0. 9 9

You are patient.

You don't reduce the value of future money very much.

₹100 today → ₹ 100 ₹100 later → still feels close to ₹ 100

But here's the crucial point

Gamma does not change the actual money. If someone promises you ₹100 tomorrow, you still receive ₹ 100. Gamma only determines how valuable that future ₹100 is to you now , when making your decision.

Now bring it back to the taxi

You are a taxi driver right now. You have two offers:

Ride A (^) ₹ 10 takes 10 minutes Ride B (^) ₹ 70 takes 30 minutes

The environment says: Ride A pays ₹10, Ride B pays ₹70. Those rewards don't change. Gamma asks the driver a different question: “How much importance should I give to money I will receive later?”

W I T H L O W γ , T H E D R I V E R S A Y S

“I don't like waiting. Future money loses a lot

of value.”

W I T H H I G H γ , T H E D R I V E R S A Y S

“I don't mind waiting. Future money is still

quite valuable.”

T H I N K O F γ A S A M I N D S E T

Think of γ as the driver's mindset toward future rewards. An impatient driver gives

more importance to rewards that can be obtained sooner, whereas a patient driver is

willing to wait longer when the future reward is sufficiently valuable.

02a·iii Choosing γ: How Far Ahead Is the Payoff?

The choice of γ depends on how long the agent must wait for the rewards that matter. Problems that need a long sequence of decisions need patience-based decision making, so γ should be large. Problems where the payoff comes quickly can use a smaller γ.

Type of problem Suitable γ Why Long sequence of decisions reward arrives only at the end

high · 0.95–0.99 A higher γ preserves the value of the future reward, so it still influences the decision made today. Immediate / short-term decisions reward arrives within a few steps

lower · e.g. 0.5–0.9 Only the near future matters, so a lower γ is appropriate and makes learning faster and more stable.

A handy rule: how far does the agent “see”?

Roughly, the agent pays attention to about 1 / (1 − γ) steps into the future.

γ = 0. ≈ 2 steps very short-sighted

γ = 0. ≈ 10 steps medium range

γ = 0. ≈ 100 steps far-sighted

This is why, on the next page, the γ = 0.9 driver loses interest in a ride that pays after 30 minutes, while the γ = 0.99 driver still values it.

Example: building an institution

The final goal, becoming a successful, established institution, may take many years and many decisions. A higher γ means the agent gives greater importance to that future outcome while making decisions today, rather than focusing only on immediate rewards.

L O W γ · S H O R T - S I G H T E D

“Maximise this semester's numbers, even if it

hurts long-term quality.”

H I G H γ · L O N G - S I G H T E D

“Invest in faculty, research and reputation

now, because they pay off over years.”

Is higher γ always better?

No. A very high γ makes learning slower and less stable, because the agent must account for rewards far into the future. Pick γ to match how far ahead the important rewards really are.

O N E S E N T E N C E F O R T H E B O A R D γ does not tell us how much reward we get. γ tells us how much importance we give to future rewards when making a decision now.

03 Q-Learning and Q-Values

Q-Learning is an algorithm that learns the best action for every state by interacting with the MDP

— trial and error, no map given. Q stands for Quality : Q(s, a) measures "how good is taking action a

in state s ?" The agent stores these values in a Q-table and, at each state, simply picks the action

with the largest Q-value.

Worked example — a food-delivery rider

A rider must go from the Restaurant to the Destination. Three roads are available. Reaching the

destination pays +100; each minute of travel costs −1. The rider does not know the travel times

in advance.

Restaurant

Road 1 20 min

Road 2 15 min

Road 3 8 min

Destination

REWARD PER ROAD Road 1: +100 − 20 = + Road 2: +100 − 15 = + Road 3: +100 − 8 = +

After many deliveries the rider's experience converges to these expected rewards — without ever being told the travel times.

The Q-table: before and after learning

EPISODE 0 — KNOWS NOTHING

State Road 1 Road 2 Road 3

Restaurant 0 0 0

→

AFTER MANY DELIVERIES State Road 1 Road 2 Road 3 Restaurant (^80 85 92) ★

Key insight: a Q-table does not store routes. It stores the quality (expected future reward) of each action in each state. By picking the highest Q-value at every state, the agent naturally follows the optimal route

without ever storing the path.

04 Route vs. Policy π*

Is π* simply "Restaurant → Road 3 → Destination"? Almost — but not quite. That is a route : one

path. The optimal policy π* is a decision rule : it tells the agent the best action from every state , not

just the start.

ROUTE Restaurant → Road 3 → Destination A sequence of states and actions from start to goal. The blue line on Google Maps.

OPTIMAL POLICY π* : S → A Restaurant → go to Junction A Junction A → take Road 3 Junction C → go straight Destination → stop The voice guidance: "given your current state, do this." Take a wrong turn and it still knows the best action from wherever you are.

Remember: Route = one path. Policy π = a rule "state → action". Optimal policy π* = the best such rule — following it from any starting state produces the best route.

05 MDP vs. Q-Learning at a Glance

MDP — the problem Q-Learning — one solver

Defines the environment Learns how to act in the environment

Contains states, actions, rewards Learns values Q(s, a) for state–action pairs

Knows transition probabilities (part of the world) Never told them — discovers behaviour through experience

Static description; no learning Dynamic learning process (model-free)

Can also be solved by Value / Policy Iteration when T and R are known Assumes an underlying MDP exists

Every Q-Learning problem assumes an underlying MDP — but not every MDP is solved with Q-Learning. When the transition model and rewards are already known, model-based methods (Value Iteration, Policy Iteration) solve it directly.