O que é Aprendizagem por Reforço?

Um agente aprende a agir sobre um ambiente por tentativa e erro, maximizando recompensa acumulada — sem que ninguém lhe diga a ação certa.

Processos de Decisão de Markov

Um MDP é a tupla \((\mathcal{S}, \mathcal{A}, P, r, \gamma)\): estados, ações, \(P(s'|s,a)\) (transição), \(r(s,a)\) (recompensa), \(\gamma\) (desconto).

Uma política \(\pi(a|s)\) mapeia estados em ações. Objetivo: maximizar \(\mathbb{E}\left[\sum_{k} \gamma^k r(s_k,a_k)\right]\).

Nota

Em controle: \(\mathcal{S}\) é o estado da planta, \(\mathcal{A}\) a entrada, \(-r\) o custo por estágio (Kaelbling et al. 1996).

Valor e Equação de Bellman

\(Q^\pi(s,a)\): retorno esperado seguindo \(\pi\) a partir de \((s,a)\).

A política ótima satisfaz (Bellman 1957): \[ Q^\ast(s,a) = \mathbb{E}_{s'}\left[r(s,a) + \gamma \max_{a'} Q^\ast(s',a')\right] \] e \(\pi^\ast(s) = \arg\max_a Q^\ast(s,a)\).

Q-Learning

Q-learning (Watkins e Dayan 1992) aprende \(Q^\ast\) só observando transições \((s,a,r,s')\):

\[ Q(s,a) \leftarrow Q(s,a) + \alpha \Big[ r + \gamma \max_{a'} Q(s',a') - Q(s,a) \Big] \]

  • Exploração \(\varepsilon\)-greedy: ação aleatória com prob. \(\varepsilon\);
  • Converge para \(Q^\ast\) sob condições brandas (Sutton e Barto 2018).

RL Profundo

Para estados contínuos, tabelas viram redes neurais:

RL e Controle Ótimo: a Ponte

No fundo, o mesmo problema (Bertsekas 2019):

Controle ótimo RL
Custo \(\ell(x,u)\) Recompensa \(-r(s,a)\)
Riccati / HJB Equação de Bellman
Programação dinâmica Iteração de valor/política
LQR Caso exatamente solúvel

Para controle contínuo, muito do que RL “descobre” já tem solução fechada na teoria clássica (Recht 2019) — o exemplo a seguir mostra isso.

Referências

Bellman, Richard. 1957. Dynamic Programming. Princeton University Press.
Bertsekas, Dimitri P. 2019. Reinforcement Learning and Optimal Control. Athena Scientific.
Kaelbling, Leslie Pack, Michael L. Littman, e Andrew W. Moore. 1996. «Reinforcement Learning: A Survey». Journal of Artificial Intelligence Research 4: 237–85. https://doi.org/10.1613/jair.301.
Lillicrap, Timothy P., Jonathan J. Hunt, Alexander Pritzel, et al. 2016. «Continuous Control with Deep Reinforcement Learning». International Conference on Learning Representations (ICLR).
Mnih, Volodymyr, Koray Kavukcuoglu, David Silver, et al. 2015. «Human-Level Control through Deep Reinforcement Learning». Nature 518: 529–33. https://doi.org/10.1038/nature14236.
Recht, Benjamin. 2019. «A Tour of Reinforcement Learning: The View from Continuous Control». Annual Review of Control, Robotics, and Autonomous Systems 2: 253–79. https://doi.org/10.1146/annurev-control-053018-023825.
Schulman, John, Filip Wolski, Prafulla Dhariwal, Alec Radford, e Oleg Klimov. 2017. «Proximal Policy Optimization Algorithms». arXiv preprint arXiv:1707.06347.
Sutton, Richard S., e Andrew G. Barto. 2018. Reinforcement Learning: An Introduction. 2.ª ed. MIT Press.
Watkins, Christopher J. C. H., e Peter Dayan. 1992. «Q-Learning». Machine Learning 8: 279–92. https://doi.org/10.1007/BF00992698.