5.6.17Machine Learning (Aerospace Applications)

Reinforcement learning — MDP, Bellman equation, Q-learning

1,996 words9 min readdifficulty · medium6 backlinks

1. The Markov Decision Process (MDP)


2. Policies, Returns, and Value


3. Deriving the Bellman Equation (from scratch)

Now take the expectation under policy π\pi: Vπ(s)=Eπ[Rt+γGt+1st=s]V^\pi(s) = \mathbb{E}_\pi[R_t + \gamma G_{t+1}\mid s_t=s] Split expectation over the action, then over the next state: Vπ(s)=aπ(as)sP(ss,a)[R(s,a)+γVπ(s)]\boxed{V^\pi(s) = \sum_a \pi(a\mid s)\sum_{s'} P(s'\mid s,a)\Big[R(s,a) + \gamma\,V^\pi(s')\Big]}

Figure — Reinforcement learning — MDP, Bellman equation, Q-learning

4. Q-learning (solving it WITHOUT knowing PP)


5. Common Mistakes (Steel-manned)


6. Flashcards

What five elements define an MDP?
States SS, Actions AA, Transition P(ss,a)P(s'|s,a), Reward RR, Discount γ\gamma.
What is the Markov property?
The next state depends only on the current state and action, not on earlier history.
Why do we discount future rewards with γ<1\gamma<1?
To keep infinite-horizon returns finite/convergent and to value near-term rewards more than distant ones.
State the Bellman optimality equation for QQ^*.
Q(s,a)=sP(ss,a)[R(s,a)+γmaxaQ(s,a)]Q^*(s,a)=\sum_{s'}P(s'|s,a)[R(s,a)+\gamma\max_{a'}Q^*(s',a')].
Write the Q-learning update rule.
Q(s,a)Q(s,a)+α[r+γmaxaQ(s,a)Q(s,a)]Q(s,a)\leftarrow Q(s,a)+\alpha[r+\gamma\max_{a'}Q(s',a')-Q(s,a)].
What is the TD error?
δ=r+γmaxaQ(s,a)Q(s,a)\delta = r+\gamma\max_{a'}Q(s',a') - Q(s,a): the gap between Bellman target and current estimate.
Why is Q-learning called "model-free" and "off-policy"?
Model-free: it samples real transitions instead of using PP. Off-policy: the max\max target learns the optimal policy while exploring with a different (ε\varepsilon-greedy) policy.
Difference between Q-learning and SARSA in the target?
Q-learning uses maxaQ(s,a)\max_{a'}Q(s',a'); SARSA uses Q(s,a)Q(s',a') for the action actually taken next.
How do you recover the optimal policy from QQ^*?
π(s)=argmaxaQ(s,a)\pi^*(s)=\arg\max_a Q^*(s,a).
What does ε\varepsilon-greedy balance?
Exploration (random actions) vs exploitation (greedy best-known action).
Given α=0.5,γ=0.9,Q=2,r=1,maxQ=6\alpha=0.5,\gamma=0.9,Q=2,r=1,\max Q'=6, new QQ?
target=1+0.96=6.4=1+0.9\cdot6=6.4, δ=4.4\delta=4.4, Q2+0.54.4=4.2Q\leftarrow2+0.5\cdot4.4=4.2.

Recall Feynman: explain to a 12-year-old

Imagine a video game where you don't get points immediately — sometimes the good move now only pays off ten moves later. You keep a scorebook that guesses "how many points can I eventually get if I press this button in this situation?" Every time you play, you peek at where you ended up, see how many points you could get from there, and gently fix your guess to be a little more correct. Do this thousands of times and your scorebook tells you the best button for every situation — even though nobody ever told you the rules of the game. That scorebook is QQ, and fixing-your-guess is Q-learning.

Connections

  • Markov Chains — MDP = Markov chain + actions + rewards
  • Dynamic Programming — Bellman equation is the DP recursion; value/policy iteration solve it when PP is known
  • Stochastic Approximation — justifies the α\alpha-step Q-update
  • Deep Q Networks (DQN) — replace the QQ table with a neural net for large state spaces
  • Optimal Control — Bellman ⟷ Hamilton–Jacobi–Bellman equation in aerospace guidance
  • Gradient Descent — TD update is (semi-)gradient descent on squared TD error

Concept Map

formalized as

assumes

includes

makes convergent

learns

generates

expectation gives

expectation gives

peel first term

recursion for

recursion for

solves

estimates

greedy action yields

Reinforcement Learning

MDP tuple S A P R gamma

Markov property

Discount gamma

Policy pi

Return G_t

State value V

Action value Q

Bellman equation

Q-learning

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Reinforcement Learning ka core idea simple hai: ek agent (maano autopilot) kisi environment mein actions leta hai, aur turant answer nahi milta — sirf reward milta hai, kabhi late bhi. Problem yeh hai ki abhi liya gaya action future ke rewards ko affect karta hai (smooth landing tabhi hoga jab tumne kai steps pehle sahi throttle diya). Isko model karne ke liye hum MDP use karte hain: states, actions, transition probability PP, reward RR, aur discount γ\gamma. Markov property ka matlab — future sirf current state pe depend karta hai, poori history yaad rakhne ki zaroorat nahi, bas state mein saari relevant cheezein (velocity, angle) daal do.

Bellman equation bas ek recursion hai: aaj ki value = abhi ka reward + γ\gamma times "jahan pahuchoge uski value". Yeh peeche ki taraf value propagate karta hai — goal ka reward slowly-slowly pichhle states tak pahuchta hai, har step pe γ\gamma se multiply hote hue. Isiliye door ka reward bhi aaj ke decision ko guide karta hai.

Q-learning ka magic yeh hai ki humein PP (physics model) pata hone ki zaroorat nahi. Turbulence, unknown dynamics — koi baat nahi. Bas real experience (s,a,r,s)(s,a,r,s') se seekho: target banao r+γmaxaQ(s,a)r + \gamma \max_{a'}Q(s',a'), apne purane guess se compare karo (yeh gap hai TD error), aur chhota sa step α\alpha lo target ki taraf. Yeh baar-baar karo, aur QQ table batayega har situation mein best action. Exploration ke liye ε\varepsilon-greedy use karo — kabhi-kabhi random action, warna tum apne early galat estimate mein hi phas jaoge. Aerospace mein guidance, control, aur autonomous decision-making ke liye yeh foundational hai.

Test yourself — Machine Learning (Aerospace Applications)

Connections