# Types of RL algorithms

We knew that the final objective is

$$
\theta^\star=\arg\max\_{\theta} E\_{\tau\sim p\_\theta(\tau)}\left\[\sum\_t r(s\_t,a\_t)\right]
$$

There are various methods to accomplish this objective.

## Model-free RL

No need to estimate the transition model.

### Policy gradient

Directly differentiate the above objective. If the problem has huge possibles, this solution will be intractable, but we can use approximation.

![Policy gradient](/files/-LjUuykcKnBP2HI1rHew)

### Value-based

Estimate value function or Q-function of the optimal policy with **arg max trick**, but no explicit policy.

![Value-based](/files/-LjUuykeKi5bd70xCP6P)

Use samples to fit Q-function -- supervised learning, then policy set to the best.

### Actor-critic

Estimate value function or Q-function of the current policy, the use it to improve policy. The combination of *policy gradient* and *Value-based*.

![Actor-critic](/files/-LjUuykgKJ9r_Qo9ptP9)

## Model-based RL

Estimate the transition model and then...

* Use it for planning (no explicit policy)
  * Trajectory optimization/Optimal control (primarily in continuous spaces)

    Essentially backpropagation to optimize over actions
  * Discrete planning in discrete action spaces, e.g. Monte Carlo tree search
* Use it to improve policy
  * Backpropagate gradients into the policy

    requires some tricks to make it work
* Use the model to learn a value function
  * Dynamic programming
  * Generate simulated experience for model-free learner (Dyna)

![Model-based RL](/files/-LjUuykibqt3ORfMLlBj)

## Examples of specific algorithms

* Policy gradient methods
  * REINFORCE
  * Natural policy gradient
  * Trust region policy optimization
* Value function fitting methods
  * Q-learning, DQN
  * Temporal difference learning
  * Fitted value iteration
* Actor-critic algorithms
  * Asynchronous advantage actor-critic (A3C)
  * Soft actor-critic (SAC)
* Model-based RL
  * Dyna
  * Guided policy search


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://drdh.gitbook.io/rl/deep-rl-course/intro-to-rl/types-of-rl-algorithms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
