Maxton‘s Blog

Back

Basic Concepts#

I. Core Definitions#

  1. State The status of the Agent relative to the environment. In a grid world, this is typically considered the Agent’s coordinate location. For example, S1S_1 can be represented as a vector: S1=(xy)S_1 = \begin{pmatrix} x \\ y \end{pmatrix}

  2. State space The set of all possible states, denoted as S\mathcal{S}. For example: S={si}i=19S=\left\{s_{i}\right\}_{i=1}^{9}. It is essentially just a Set.

  3. Action The moves an Agent can take for every State. For example, in a grid world, there might be five: up, down, left, right, and stay.

  4. Action space The set of all possible actions for a specific state sis_i, denoted as A(si)={ai}i=15\mathcal{A}(s_{i}) = \left\{a_{i}\right\}_{i=1}^{5}. Note: Action often depends on the State, meaning A\mathcal{A} is a function of ss.

  5. State transition The process where the Agent transfers from one state to another after taking an action, denoted as S1a2S2S_{1}\stackrel{a_2}{\longrightarrow}S_{2}. This defines the mechanism of interaction with the environment. In a virtual world, this can be defined arbitrarily; in the real world, it must obey objective physical laws.

  6. State transition probability Uses probability to describe the uncertainty of state transitions. For example, if we choose a2a_2 at S1S_1, the probability of moving to S2S_2 is:

    p(ss,a){p(s2s1,a2)=1p(sis1,a2)=0,i2p(s'|s, a) \Rightarrow \begin{cases} p(s_{2}|s_{1},a_{2})=1 \\ p(s_{i}|s_{1},a_{2})=0, & \forall i\neq2 \end{cases}

    The example above represents a deterministic environment, but it can also be stochastic (random).

  7. Policy The rule or function π\pi that describes what action the Agent should take in a given State. For example, a Deterministic Policy:

    π(as){π(a2s1)=1π(ais1)=0,i2\pi(a|s) \Rightarrow \begin{cases} \pi(a_{2}|s_{1})=1 \\ \pi(a_{i}|s_{1})=0, & \forall i\neq2 \end{cases}

    Stochastic Policies follow the same logic, where π\pi represents the probability of selecting an action.

  8. Reward A scalar real number received after the Agent takes a specific action.

    • Positive numbers typically represent rewards (encouraging behavior);
    • Negative numbers typically represent punishment (suppressing behavior).

    Reward is a key method of Human-Machine Interface, used to guide the Agent to exhibit the behavior we expect. Mathematical expression:

    p(r=1s1,a1)=1andp(r1s1,a1)=0p(r=-1|s_{1},a_{1})=1 \quad \text{and} \quad p(r\neq-1|s_{1},a_{1})=0
  9. Trajectory A complete State-Action-Reward chain. Specifically: taking an Action in a State, receiving a Reward, and transferring to the next State, repeated in a loop.

    S1r=0a3S4r=1a3S7r=0a2S8r=+1a2S9S_{1} \xrightarrow[r=0]{a_3} S_{4} \xrightarrow[r=-1]{a_3} S_{7} \xrightarrow[r=0]{a_2} S_{8} \xrightarrow[r=+1]{a_2} S_{9}
  10. Return The sum of all Rewards in a Trajectory. Different Policies will lead to different Returns.

  11. Discounted Return For a Trajectory that runs infinitely, a simple sum would result in an infinite Return (divergence). We introduce a discount factor γ[0,1)\gamma \in [0,1):

    Return=0+0+1+1+=(Divergent)\text{Return} = 0+0+1+1+\dots = \infty \quad (\text{Divergent})

    With γ\gamma:

    Gt=Rt+1+γRt+2+γ2Rt+3+=k=0γkRt+k+1G_t = R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \dots = \sum_{k=0}^{\infty} \gamma^k R_{t+k+1}

    Example:

    Discounted Return=γ3(1+γ+γ2+)=γ31γ(Convergent)\text{Discounted Return} = \gamma^{3}(1+\gamma+\gamma^{2}+\ldots) = \frac{\gamma^{3}}{1-\gamma} \quad (\text{Convergent})
    • Role of γ\gamma: Determines the Agent’s “vision.” A smaller γ\gamma makes the Agent “near-sighted” (focusing on immediate rewards), while a larger γ\gamma makes it “far-sighted” (focusing on long-term benefits).
  12. Episode When interacting with the environment following a Policy, if the Agent stops at a Terminal State, the resulting trajectory is called an Episode (or Trial).

    • Episodic Tasks: Tasks with terminal states (finite steps).
    • Continuing Tasks: Tasks without terminal states (infinite steps).

II. MDP (Markov Decision Process) Elements#

1. Sets#

  • State: The set of States S\mathcal{S}
  • Action: The set of Actions A(s)\mathcal{A}(s), where sSs \in \mathcal{S}
  • Reward: The set of Rewards R(s,a)\mathcal{R}(s,a)

2. Probability Distribution (Dynamics)#

  • State transition probability: p(ss,a)p(s'|s,a)
  • Reward probability: p(rs,a)p(r|s,a)

3. Policy#

  • The Agent’s decision mechanism: π(as)\pi(a|s)

4. MDP Property#

Memoryless (Markov Property): The probability of the next state and reward depends only on the current state and action, and is independent of all prior history.

p(st+1,rt+1st,at,st1,)=p(st+1,rt+1st,at)p(s_{t+1}, r_{t+1} | s_t, a_t, s_{t-1}, \dots) = p(s_{t+1}, r_{t+1} | s_t, a_t)

5. MDP vs Markov Process#

  • Markov Process: Contains only States and Transition Probabilities. The observer can only passively accept the environment’s evolution based on probability and cannot intervene.
  • MDP (Markov Decision Process): Adds Decision (Action). State transitions depend not only on the current state but also on the Action taken. The Agent can actively influence the outcome probabilities by choosing different actions, rather than just passively accepting a fixed distribution.
RL Study Notes: Basic Concepts
https://en.maxtonniu.com/blog/rl_chapter01
Author Maxton Niu
Published at February 15, 2026