Foundations — Policies and value functions
This page assumes you have seen nothing. Every letter, arrow, and squiggle that the parent note Policies and value functions throws at you is built here, in order, each one leaning on the one before it.
0. The stage: agent, world, and the loop of time
Before any symbol, picture the game that everything else describes.
An agent (the decision-maker — the cyan dot) sits inside an environment (the world — the blueprint grid). Time ticks in whole steps: . At each tick the agent looks, acts, and the world responds. That loop is the whole subject. Introduced properly in 5.1.01-Introduction-to-RL.
Everything below names a piece of this picture.
1. — the time index (subscript)
Plain words: a counter that says which tick we are on. A subscript like just means "the state at time ".
The picture: the row of tick-marks along the bottom of the figure above. is the dot's position at that tick; is where it is one tick later.
Why we need it: rewards arrive over time, and "later" rewards will matter less than "sooner" ones. Without a clock we could not even say "later".
2. , , and — states
Plain words: a state is a complete description of "the situation right now" — everything the agent needs to decide.
- (capital, no subscript) = the set of all possible situations.
- (lowercase) = one specific situation, a name we plug in, like .
- = the random situation the agent actually finds itself in at time .
The picture: each blueprint grid-cell is one state . The whole grid is . The cyan dot marks the current .
Why we need it: value functions ask "how good is this situation?" — you cannot ask that without a way to name situations. Formalised in 5.1.02-Markov-Decision-Processes.
3. , , and — actions
Plain words: an action is a move the agent can make.
- = the set of all possible moves.
- = one named move (e.g.
RIGHT,BUY). - = the move actually taken at time .
The picture: the four amber arrows leaving a grid-cell (up / down / left / right) — each arrow is one action .
Why we need it: the agent influences its future only through actions. Rewards depend on which action you pick, so actions are how you steer.
4. , , and — reward
Plain words: a reward is a single number the world hands you after each move, saying "that was good (+) or bad (−)".
- = the (random) reward received one tick after acting at time .
- = a specific number-value the reward can take, used when we sum over possibilities.
The picture: a number floating over the arrow the agent just took: +1, +2, -5.
Why we need it: reward is the only signal telling the agent what "good" means. The entire goal — value functions — is built from reward.
5. — the policy (the first notebook)
Plain words: the policy is the agent's strategy — a rule that turns a state into an action.
Two flavours:
| flavour | notation | meaning |
|---|---|---|
| deterministic | "in state , always do action " | |
| stochastic | "in state , do action with probability " |
The picture: below — the policy is the arrow assignment painted onto every cell of the map.
Reading : the vertical bar reads "given". So = "the probability of picking , given we are in ". Because it is a probability, for every state its numbers over all actions add to :
Why we need it: the policy is what the agent does. Value functions are always measured while following a specific — that is what the little superscript in will mean.
6. — the summation sign
Plain words: (capital Greek sigma) means "add up a list".
The symbol under the says what to sweep through (here, every action ).
The picture: a checklist where you write a number next to each item, then total the column.
Why we need it: an uncertain future has many branches. To get the average outcome we weight each branch by its probability and add them all — that is a sum.
7. and — probability and the world's dynamics
Plain words: is a number in measuring how likely something is. = never, = certain, = coin-flip.
The dynamics of the world are packed into one object:
Read it: "the probability that, after doing in , the world lands you in and pays reward ." The prime mark in just means "the next one" — is the state after .
The picture:
One state, one action, but several possible outcomes, each on its own branch with a probability that all together sum to .
Why we need it: the same action can lead to different next-states. This object is the world's rulebook, and it is what every value equation averages over.
8. — expectation (the average future)
Plain words: is the average value of a random quantity , where each possible value is weighted by how likely it is:
The subscript in says "average over the randomness produced by following policy " (and the world's dynamics).
The picture: stand at the branching tree of section 7, multiply each leaf's value by its probability, and add — the balance point of all futures.
Why we need it: "how good is this state" has no single answer — the future is uncertain. Expectation collapses all possible futures into one honest number.
9. — the discount factor
Plain words: (Greek "gamma"), a number in , is how much you shrink a reward for each tick you must wait.
- A reward now counts fully.
- A reward one step later counts times as much.
- Two steps later: . And so on.
The three reasons the parent gives:
- Uncertainty — far-off rewards may never arrive.
- Convergence — with an infinite stream of bounded rewards still adds to a finite number.
- Impatience — models "sooner is better", like interest in economics.
Edge cases (cover them all):
- : agent is totally short-sighted — it cares only about the very next reward .
- : no discounting — every future reward counts fully (safe only when the game is guaranteed to end).
- : the usual case; distant rewards fade smoothly to nothing.
The geometric-series fact (used in every worked example): if you receive a constant reward forever, This is exactly why in the parent's example.
Why we need it: without , an endless game would give infinite value everywhere and "better" would lose all meaning.
10. — the return
Plain words: the return is the whole discounted pile of future reward, added up from time onward:
Reading the compact form: is a counter starting at ; is the shrink-factor at that distance; is the reward steps in the future. Sweep and add.
The one trick that unlocks everything — peel off the first term: "This return = next reward + times the next return." This recursion is the seed of every Bellman equation in 5.1.04-Bellman-Equations.
Why we need it: is what value functions take the average of. It is a single random number summarising an entire future.
11. — the state-value function (the second notebook)
Plain words: the average return you can expect starting in state and behaving according to :
The picture: paint a number on every grid-cell — "how much total good flows out of here if I follow ."
Why we need it: it is the critic — the score that lets us compare states and, later, improve the policy.
12. — the action-value function
Plain words: the average return if you start in , force action right now, then follow :
How it relates to : average over the actions the policy would take:
Why we need it (vs ): is per action, so you can literally compare moves and pick the best — the foundation of 5.3.01-Q-Learning.
13. , , and the star
Plain words:
- = the largest value in the list
- = which achieves that largest value (the winner's name, not the score).
- The star, as in or , marks the best possible — the optimum.
The picture: a bar chart of -values; is the height of the tallest bar, is the label under it.
Why we need it: learning aims at the best strategy. picks the best score; turns that score back into an action to actually take. These drive 5.2.01-Policy-Iteration and 5.2.02-Value-Iteration.
How the foundations feed the topic
Read top to bottom: raw pieces (time, states, actions, reward) combine into the two big ideas — the policy and, through return + discount + expectation, the value functions — which finally give the optimal quantities.
Equipment checklist
Cover the right side and answer out loud before revealing.