Answers.Body: <p><strong>Evolutionary algorithms (EAs)</strong> are a family of algorithms inspired by the biological evolution that can be used to solve (constrained or not) optimization problems where the function that needs to be optimized does not necessarily need to be differentiable (or satisfy any strong constraint). In EAs, you typically only need to define</p>
  <ul>
  <li>an encoding of the solution (aka chromosome or individual)</li>
  <li>a <a href="https://ai.stackexchange.com/a/25028/2444">fitness function</a> that determines the <em>relative</em> quality of each solution</li>
  <li>operations that stochastically change or combine solutions (e.g. the cross-over or the mutation operators, in genetic algorithms)</li>
  </ul>
  <p>There are other parameters that you need to defined (such as the number of solutions to consider at each generation or the number of generations to run the algorithms for), but these are the three most important things to take into account when attempting to solve an optimization problem with EAs (in particular, GAs).</p>
  <p><strong>Reinforcement learning (RL)</strong> is the field that studies how agents can sequentially take actions in a certain environment in order to maximize some notion of long-term <em>reward</em> (aka <em>return</em>).  The strategy that determines the behavior of the agent (i.e. which actions the agent takes) is called the <em>policy</em>. So, the goal of RL is to find a policy that maximizes the (expected) return, which depends on the <a href="https://ai.stackexchange.com/q/12264/2444">reward function</a> of the environment. For example, in the case of chess, a reward function may be any function that gives you a positive number if you win the game or a negative number if you lose it. The RL algorithms typically assume that the agent is able to interact with the environment in order to understand its dynamics.</p>
  <p>RL is thus concerned with a specific type of optimization problem, i.e. finding policies (strategies) that maximize the return, while an agent interacts with an environment in time steps. On the other hand, EAs can be applied to any optimization problem where you can encode solutions, define a fitness function that compares solutions and you can stochastically change those solutions. Essentially, EAs can be applied to almost any optimization problem. In principle, you could use EAs to find policies, as long as you're able to compare them with a <a href="https://ai.stackexchange.com/q/25872/2444">fitness function</a> (e.g. the amount of reward that you obtain by following these policies).</p>
  <p>Of course, this does not mean that EAs are the most efficient and appropriate approach to solve all optimization problems! You typically use EAs when you need to solve certain problems where better approaches do not exist. For example, when your objective function is not differentiable, then you cannot apply gradient-based solutions, so, in that case, EAs may be a viable option (but there are also other alternatives to EAs, such as simulated annealing).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-02T16:56:04.550Z
Answers.LastActivityDate: 2021-08-07T12:30:08.373Z
Answers.LastEditDate: 2021-08-07T12:30:08.373Z
Answers.UserDisplayName: nbro
Body: <p>What is the difference between reinforcement learning (RL) and evolutionary algorithms (EA)?</p>
  <p>I am trying to understand the basics of RL, but I do not yet have practical experience with RL. I know slightly more about EAs, but not enough to understand the difference between RL and EA, and that's why I'm asking for their main differences.</p>
  
Tags: <reinforcement-learning><comparison><genetic-algorithms><optimization><evolutionary-algorithms>
Title: What is the difference between reinforcement learning and evolutionary algorithms?
UserDisplayName: Single Malt
ThreadText: # What is the difference between reinforcement learning and evolutionary algorithms?
  
  (Asked by: username_0 on 2020-06-02)
  
  What is the difference between reinforcement learning (RL) and evolutionary algorithms (EA)?
  
  I am trying to understand the basics of RL, but I do not yet have practical experience with RL. I know slightly more about EAs, but not enough to understand the difference between RL and EA, and that's why I'm asking for their main differences.
  
  **Tags:** reinforcement-learning, comparison, genetic-algorithms, optimization, evolutionary-algorithms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-02. Score: 9 | Accepted answer
  
  **Evolutionary algorithms (EAs)** are a family of algorithms inspired by the biological evolution that can be used to solve (constrained or not) optimization problems where the function that needs to be optimized does not necessarily need to be differentiable (or satisfy any strong constraint). In EAs, you typically only need to define
  
  * an encoding of the solution (aka chromosome or individual)
  * a [fitness function](https://ai.stackexchange.com/a/25028/2444) that determines the *relative* quality of each solution
  * operations that stochastically change or combine solutions (e.g. the cross-over or the mutation operators, in genetic algorithms)
  
  There are other parameters that you need to defined (such as the number of solutions to consider at each generation or the number of generations to run the algorithms for), but these are the three most important things to take into account when attempting to solve an optimization problem with EAs (in particular, GAs).
  
  **Reinforcement learning (RL)** is the field that studies how agents can sequentially take actions in a certain environment in order to maximize some notion of long-term *reward* (aka *return*). The strategy that determines the behavior of the agent (i.e. which actions the agent takes) is called the *policy*. So, the goal of RL is to find a policy that maximizes the (expected) return, which depends on the [reward function](https://ai.stackexchange.com/q/12264/2444) of the environment. For example, in the case of chess, a reward function may be any function that gives you a positive number if you win the game or a negative number if you lose it. The RL algorithms typically assume that the agent is able to interact with the environment in order to understand its dynamics.
  
  RL is thus concerned with a specific type of optimization problem, i.e. finding policies (strategies) that maximize the return, while an agent interacts with an environment in time steps. On the other hand, EAs can be applied to any optimization problem where you can encode solutions, define a fitness function that compares solutions and you can stochastically change those solutions. Essentially, EAs can be applied to almost any optimization problem. In principle, you could use EAs to find policies, as long as you're able to compare them with a [fitness function](https://ai.stackexchange.com/q/25872/2444) (e.g. the amount of reward that you obtain by following these policies).
  
  Of course, this does not mean that EAs are the most efficient and appropriate approach to solve all optimization problems! You typically use EAs when you need to solve certain problems where better approaches do not exist. For example, when your objective function is not differentiable, then you cannot apply gradient-based solutions, so, in that case, EAs may be a viable option (but there are also other alternatives to EAs, such as simulated annealing).
  
  
  ---
  
  