Cs234 lecture 2 markov processes

2.1 Types of Markov Processes

Def: A state has the Markov property if and only if: $p(s_{t+1}|s_t,a_t) = p(s_{t+1}|h_t,a_t)$

Markov Processes

Def: A Markov Process is a double $(S,P)$, with a finite set $S$ of states, and $P$, a transition model specifying $p(s_{t+1} = s’ | s_t = s)$ If the state space is finite, P can be expressed as a matrix of transition probabilities.

Markov Reward Process:

Def: A Markov Reward Process is a quadruple $(S,P,R, \gamma)$, with a finite set $S$ of states, and $P$, a transition model specifying $p(s_{t+1} = s’ | s_t = s)$, and $R$, a reward function $R(s_t = s) = \mathbb{E}[r_t|s_t = s]$. Rewards are discounted by a discount factor $\gamma$. Def: The return is the discounted sum or rewards. Def: The value function of a state is the expected of the return of a state. You can estimate the value of a state by simulation. Def: The Bellman equation states that $V(s) = R(s) + \gamma \sum_{s’ \in S}P(s’|s)V(s’)$. This is used for policy evaluation.

Markov Decision Process (MDP):

Def: A Markov Decision Process a tuple $(S,A,R,P,\gamma)$ with finite set $S$ of states, a finite set $A$ of actions, and $P$, a transition model from each action and each state specifying $p(s_{t+1} = s’ | s_t = s, a_t = a)$, and $R$, a reward function $R(s_t = s, a_t = a) = \mathbb{E}[r_t|s_t = s]$. Rewards are discounted by a discount factor $\gamma$.

Def: A MDP policy is a conditional distribution over actions $\pi(a s) = P(a_t=a s_t=s)$ specifying what action to take in each state. Note that an MDP + a policy $\pi(a s)$ is simply a Markov Reward Process.
- Def: stationary policies only depend on the current state, that is, we can parameterize it $\pi(a s)$.    
- Def: nonstationary policies depend on the timestep as well as the current state. We just parameterize it $\pi(a_t s_t, t)$    
Def: The Q-value of a policy $\pi$ given state $s$ and action $a$ is the value of the policy applied after folloing action $a$ from state $s$: $Q^\pi(s,a) = R(s,a) + \gamma \sum_{s’ \in S} P(s’ s)V^\pi(s’)$.

Operators:

Def: The Bellman backup operator $B$ is an operator using the Bellman equation applied to the value function to improve its value over all states $s$ (note the max, and note that $BV(s)$ is not a function but the operator $B$ applied to the function $V(s)$).

Given a particular policy $\pi$, the Bellman backup operator $B^\pi$ is defined as:

To evaluate the value of a policy $\pi$, we can essentially just run $B^\pi B^\pi B^\pi \cdots B^\pi V_0$ - that is, finding a fixed point of $B^\pi$.

Def: Contracton operator: Let $O$ be an operator and let $ x $ be any norm of $x$.    
If for some functions $V,V’$, we have $ OV - OV’ \le V - V’ $, then $O$ is a contraction operator.

2.2 Model-Based MDP Problems

Policy Evaluation (Computing the Value of a Given Policy):

Def: Policy Evaluation is computing the value of a given policy for every state. There are two model-based approaches to policy evaluation.

(See Lecture 3 for Exposition of Model Free Policy Evaluation)

The MDP Control Problem (Computing the optimal policy)

Def: The MDP control problem is the computation of the optimal policy: $\pi^*(s) = \arg \max V^\pi(s)$. There always exists a unique optimal value function and one or more optimal policies that achieve that function. The optimal policies for a MDP in an infinite horizon problem is deterministic (not stochastic) and independent of time step (stationary).

Note: Value Iteration and Policy Iteration are exactly the same, except the former only updates the state-value function (V), and the latter updates the state-action value function (Q). They result in the same value function at convergence. $V(s)$ is the max of the Qs over all possible actions $a$ from state $s$.

Appendix 1: Proof of Policy Iteration

A Proof that policy iteration leads to monotonic improvement and converges.

Screenshot 2020-03-29 at 3.35.56 PM.png

So a justification is required. In fact, we can telescope the substitution many times, and each time the inequality is ≤.

Screenshot 2020-03-29 at 3.38.18 PM.png

Because policy iteration monotonically increases the value function, and becuase the number of states is finite, it always converges.

Appendix 2: Proof that Bellman Operator is a Contraction Operator:

Screenshot 2020-03-29 at 4.16.11 PM.png