scieee AI-readable full text Open interactive document viewer

Exploring Evolution Strategies for Reinforcement Learning in the Obstacle Tower Environment

Kuypers, Julian

Abstract

In 2017 OpenAI demonstrated that it was possible to train an AI agent by using Evolution Strategies (ES), and that the results rivaled standard Reinforcement Learning (RL) techniques on modern benchmarks. Their research effectively showed that Evolution Strategies is a viable alternative to traditional Reinforcement Learning techniques, and that it bypasses many of Reinforcement Learning’s inconveniences, notably the use of backpropagation. The Obstacle Tower environment aims to set a new Reinforcement Learning benchmark by challenging Artificial Intelligence (AI) agents to traverse 3-Dimensional procedurally generated levels using a real-time 3-Dimensional physics system. The environment tests an agent’s ability to generalize by requiring it to optimize aspects that are common in many Reinforcement Learning environments, but rarely combined in the same environment: vision, planning, and control. In this research, the original implementation of OpenAI’s Evolution Strategies algorithm was applied for the first time to the Obstacle Tower environment to assess how well it performs in a more complex environment, where the agent’s generalization ability is critical. Additionally, in the interest of exploring Evolution Strategies in this environment, common Genetic Algorithm selection and mutation techniques were developed and applied to try and improve the performance of the original Evolution Strategies implementation. Crossover techniques were not explored during this research, as they are rarely applied in Evolution Strategies. The results show that although the basic implementation of Evolution Strategies does not perform well in the complex Obstacle Tower environment, it is possible to improve its performance by applying different evolution methods borrowed from Genetic Algorithm (GA), which are algorithms belonging to the same family as Evolution Strategies.

Full text

i Exploring Evolution Strategies for Reinforcement Learning in the Obstacle Tower Environment Julian Kuypers Dissertation presented as partial requirement for obtaining the Master’s degree in Data Science & Advanced Analytics ii NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa Exploring Evolution Strategies for Reinforcement Learning in the Obstacle Tower Environment by Julian Kuypers Dissertation presented as partial requirement for obtaining the Master’s degree in Data Science & Advanced Analytics Advisor / Co Advisor: Mauro Castelli Co Advisor: Illya Bakurov July 2021 iii ABSTRACT In 2017 OpenAI demonstrated that it was possible to train an AI agent by using Evolution Strategies (ES), and that the results rivaled standard Reinforcement Learning (RL) techniques on modern benchmarks. Their research effectively showed that Evolution Strategies is a viable alternative to traditional Reinforcement Learning techniques, and that it bypasses many of Reinforcement Learning’s inconveniences, notably the use of backpropagation. The Obstacle Tower environment aims to set a new Reinforcement Learning benchmark by challenging Artificial Intelligence (AI) agents to traverse 3-Dimensional procedurally generated levels using a real-time 3-Dimensional physics system. The environment tests an agent’s ability to generalize by requiring it to optimize aspects that are common in many Reinforcement Learning environments, but rarely combined in the same environment: vision, planning, and control. In this research, the original implementation of OpenAI’s Evolution Strategies algorithm was applied for the first time to the Obstacle Tower environment to assess how well it performs in a more complex environment, where the agent’s generalization ability is critical. Additionally, in the interest of exploring Evolution Strategies in this environment, common Genetic Algorithm selection and mutation techniques were developed and applied to try and improve the performance of the original Evolution Strategies implementation. Crossover techniques were not explored during this research, as they are rarely applied in Evolution Strategies. The results show that although the basic implementation of Evolution Strategies does not perform well in the complex Obstacle Tower environment, it is possible to improve its performance by applying different evolution methods borrowed from Genetic Algorithm (GA), which are algorithms belonging to the same family as Evolution Strategies. iv KEYWORDS deep reinforcement learning; evolution strategies; genetic algorithm; obstacle Tower; obstacle Tower Challenge; unity; neuroevolution; reinforcement learning benchmark. v INDEX 1. Introduction .................................................................................................................. 1 2. Literature review .......................................................................................................... 4 2.1. Reinforcement Learning ........................................................................................ 4 2.1. Evolutionary Strategies ......................................................................................... 6 2.2. The Obstacle Tower Environment ......................................................................... 8 3. Methodology .............................................................................................................. 15 3.1. Neural Network................................................................................................... 15 3.2. Distributed System ............................................................................................. 19 3.2. Evolution Strategies ............................................................................................ 22 4. Experiments ................................................................................................................. 27 5. Results and discussion ................................................................................................ 30 6. Conclusions ................................................................................................................. 37 7. Limitations and recommendations for future works ................................................. 39 8. Bibliography ................................................................................................................ 41 9. Appendix...................................................................................................................... 45 10. Annexes………………………………………………………………………………………………………………..51 vi LIST OF FIGURES Figure 1. - Examples of agent's perspective in the Obstacle Tower environment ........... 9 Figure 2. - Examples of floor layouts from the Obstacle Tower environment ................. 9 Figure 3. - Convolutional Neural Network Architecture Diagram ................................... 17 Figure 4. - RLlib Training Cycle…………………………………………………………………………………….21 Figure 5. - Mean episodic reward for all three mutation techniques with Select N Best selection ................................................................................................................................. 30 Figure 6. - Maximum episodic reward for all three mutation techniques with Select N Best selection .................................................................................................................. 30 Figure 7. - Mean episodic reward for all three mutation techniques with Roulette Wheel selection .................................................................................................................. 30 Figure 8. - Maximum episodic reward for all three mutation techniques with Roulette Wheel selection .................................................................................................................. 30 vii LIST OF TABLES Table 1. - Parameters of the Convolutional Neural Network used for this research……17 Table 2. - Ray project API ................................................................................................ 19 Table 3. - Parameters used during experiments… .......................................................... 27 Table 4. - Total Number of environment steps taken during ES training ....................... 32 Table 5. - Baseline results from the Obstacle Tower paper ............................................ 33 viii LIST OF ABBREVIATIONS AND ACRONYMS 2D/3D 2-Dimensional / 3-Dimensional AI Artificial Intelligence CNN Convolutional Neural Network DRL Deep Reinforcement Learning ES Evolutionary Strategies FC Fully Connected FFCNN Feed-Forward Convolutional Neural Network GA Genetic Algorithms ML Machine Learning NES Natural Evolution Strategies OT Obstacle Tower PPO Proximal Policy Optimization RL Reinforcement Learning RNB Rainbow (algorithm) 1 1. INTRODUCTION From Atari games to Doom and Dota 2, Deep Reinforcement Learning (DRL) is considered the go-to technique to solve end-to-end learning from high-dimensional raw pixel images [Mnih et al., 2015]. The recent successes of Google DeepMind’s AlphaStar [Vinyals et al., 2019], where an agent has reached the human level of grandmaster in the real-time strategy game of StarCraft II much sooner than was initially anticipated, and AlphaGo [Silver et al. 2016], which beat Lee Sedol 1 in the game Go in 2015, have garnered a great deal of interest in DRL and many advances have been made in recent years to solve more complex environments. Feed-forward Convolutional Neural Networks (FFCNN) using basic policy gradient methods or value based gradient methods have proven to be effective at solving 2- dimensional (2D) environments such as the ones found in the Atari games [Mnih et al., 2016]. The central goal of a Reinforcement Learning (RL) application is to learn a policy, which is a mapping from the state of the environment to a choice of action, that yields effective performance over time. In their 2017 paper, OpenAI proved it was possible to train an Artificial Intelligence (AI) agent by using Evolutionary Strategies (ES) [Salimans et al., 2016], a type of Neuroevolution algorithm 2 , is a type of black-box optimization algorithm that relies on selecting and perturbing (“mutating”) individuals as an optimization strategy. ES can be understood as a simplified version Genetic Algorithms (GA), where crossover and eventually elitism are omitted. With this paper, they have demonstrated that it is possible to learn a policy using ES, and that this policy achieves results comparable to those of traditional RL 1 Lee Sedol is a former South Korean professional Go player, at the time of playing agains AlphaGo, he was ranked second in the international rankings. 2 Neuroevolution is a machine learning technique that applies evolutionary algorithms to construct artificial neural networks, taking inspiration from the evolution of biological nervous systems in nature. 8 the number of time steps in an episode is long, where actions have long lasting effects, or if no good value function estimates are available. Conversely, they also found some challenges to applying ES in practice. One core problem is that for ES to work, adding noise in parameters must lead to different outcomes to obtain some gradient signal. As they elaborate on in their paper, the use of virtual batch normalization 6 [Salimans et al., 2016] can help alleviate this problem, but further work on effectively parameterizing neural networks to have variable behaviors as a function of noise is necessary. As an example of a related difficulty, they found that in Atari’s Montezuma’s Revenge 7 , one is very unlikely to get the key in the first level with a random network, while this is occasionally possible with random actions. 2.3 The Obstacle Tower Environment The Obstacle Tower environment is a procedurally generated RL environment, meaning the environment is generated with some randomness and is never the same twice. It was developed by game development platform Unity and uses the ML-Agents Toolkit [Juliani et al., 2019]. It can run on the Mac, Windows, and Linux platforms, and can be controlled via the 6 Virtual Batch normalization (VBN), also known as virtual batch norm) is a method used to make artificial neural networks faster and more stable through normalization of the layers' inputs by re-centering and re-scaling. It is similar to batch normalization, except that each example is normalized based on the statistics collected on a reference batch of examples that are chosen once and fixed at the start of training, and on itself, instead of the statistics of several examples belonging to the same mini-batch. 7 Montezuma’s Revenge is an Atari game available in the Arcade Learning Environment that is notoriously difficult to beat with RL due to its sparsely distributed rewards. See Annexes 1. and 2. For DeepMind and OpenAI’s models’ performance on the game. 9 OpenAI Gym interface for easy integration with existing DRL training frameworks [Brockman et al., 2016]. Episode Dynamics The Obstacle Tower environment consists of up to 100 floors, with the agent starting on floor zero. All floors of the environment are treated as a single finite episode in the RL context. Each floor contains at least a starting and ending room. Each room can contain a puzzle to solve, enemies to defeat, obstacles to evade, or a key to open a locked door. The layout of the floors and the contents of the rooms within each floor becomes more complex at higher floors in the Obstacle Tower, providing a natural curriculum for learning agents. Within an episode, it is only possible for the agent to go to higher floors of the environment, and not to return to lower floors. The episode terminates when the agent collides with a hazard such as a pit or enemy, when the timer runs out, or when the agent arrives at the top floor of the environment. The timer is set at the beginning of the episode and completing floors as well as Figure 1. Examples of agent's perspective in the Obstacle Tower environment. Figure 2. Examples of floor layouts from the Obstacle Tower environment. 10 collecting blue time orbs increase the time left to the agent. In this way a successful agent must learn a behavior which is a tradeoff between collecting orbs and quickly completing floors of the tower in order to arrive at the higher floors before the timer ends. The reward function is a mix of sparse and dense rewards; with sparse rewards, the rewards in the environment are sparsely distributed, meaning that there are only a few states in the state space that return a reward, whereas with dense rewards, every transition in the environment is associated with a reward, which can be positive or negative. In the OT environment, the agent is given a positive reward of +1 for completing a floor of the tower (sparse), and a reward of +0.1 for opening a door, solving puzzles, or picking up a key (dense). The environment’s authors describe this reward function as a mix between sparse and dense reward [Juliani et al., 2019], but in reality, they are two different sparse rewards, as the positive reward +0.1 is not associated with every change of state, but rather with a change of state involving a specific, sparsely distributed, state. Observation Space The observation space of the agent consists of two types of information. The first type of observation is a rendered pixel image of the environment from a third person perspective. This image is rendered in 168 × 168 RGB and can be downscaled to 84 × 84. The second type of observation is a vector of auxiliary variables which describe relevant, non-visual information about the state of the environment. The elements which make up this auxiliary vector are the number of keys agent is in possession of, as well as the time left in the episode. 11 Action Space The action space of the agent is multi-discrete, meaning that it consists of a set of smaller discrete action spaces, of which the union corresponds to a single action in the environment. These subspaces are as follows: forward/backward/no-operation movement, left/right/nooperation movement, clockwise/counterclockwise rotation of the camera/no-operation, and no-operation/jump. They also provide a version of the environment with this action space flattened into a single choice between one of 54 possible actions, whose size corresponds to the product of the sizes of all the sub-spaces in the multi-discrete case. The Obstacle Tower Environment as a Benchmark Obstacle Tower was developed specifically to overcome the limitations of previous gamebased AI benchmarks, offering a broad and deep challenge, the solving of which would imply a major advancement in reinforcement learning. In brief, the features of Obstacle Tower outline by Juliani et al. [16] are: High visual fidelity. The environment is rendered in 3D using real-time lighting and shadows, along with much more detailed textures and models than previous benchmarks. See Fig 1. for examples of the agent’s perspective. Procedurally generated floors and rooms. Navigating the game requires both dexterity and planning, and the floors within the environment are procedurally generated, making generalization a requirement to perform well during evaluation. See Fig 2. for examples of floor layouts of various levels of the Obstacle Tower. Physics-driven interactions. The movement of the agent and other objects within the environment are controlled by a real-time 3D physics system. 12 Procedurally generated visuals. There are multiple levels of variation in the environment, including the textures, lighting conditions, and object geometry. Therefore, agents must be able to generalize their understanding of objects’ appearance. The Obstacle Tower environment is designed to provide a meaningful challenge to current and future AI agents, specifically those trained using the pixels-to-control approach. Juliani et al. [16] describes four axes of challenge that this environment provides: vision, control, planning, and generalization. While various other environments and benchmarks have been used to provide difficult challenges for AI agents, this is to the best of our knowledge the first benchmark which combines all such axes of complexity. Vision. The primary observation available to agents within the Obstacle Tower is a rendered RGB image. Obstacle Tower contains high-fidelity real-time lighting, complex 3D shapes, and high-resolution textures. Furthermore, the floors in the environment are rendered in one of multiple different visual themes, such as Ancient or Industrial. These visual themes were chosen to provide a large amount of variation in the textures, colors, and 3D models that the agent would encounter. With the combination of high-fidelity visuals and increased visual variation, models with much greater representational capacity than those used in A3C [Mnih et al., 2016] or DQN [Mnih et al., 2015] will be needed to perform well in the environment. Generalization & Vision. Humans can easily understand that two different doors seen under different lighting conditions are still doors; general-purpose agents should have similar abilities. However, this is not the case; in many cases agents trained under one set of visual conditions, and then tested on even a slightly different visual conditions perform much worse at the same task [Huang et al., 2017]. The procedural lighting and 13 visual appearance of floors within the Obstacle Tower means that agents will need to be able to generalize to new visual appearances which they may never have directly experienced before. Control. An agent in Obstacle Tower must be able to navigate through multiple rooms and floors. Each of these rooms can contain multiple possible obstacles, enemies, and moving platforms, all of which require fine-tuned control over the agent’s movement. Floors of the environment can also contain puzzle rooms, which involve the physical manipulation of objects within the room to unlock doors to other rooms on the floor. While the action space of the agent is discrete, the environment itself uses continuous metrics for the position and velocity of objects, making the state space extremely large. We expect that for agents to perform well on these sub-tasks, the ability to model and predict the results of the agents’ actions within the environment will be of benefit. Generalization & Control. The layout of the rooms on every floor are different on each instance of the Obstacle Tower; as such, it is expected that methods which are designed to exploit determinism of the training environment, such as Brute [Machado et al., 2017] and Go-Explore [Ecoffet, 2018] will perform poorly on the test set of environments. It is also the case that within a single instance of a Tower, there are elements of the environment which contain stochastic behavior, such as the movement of platforms and enemies. Planning. Depending on the difficulty of the floor, some floors of the Obstacle Tower require reasoning over multiple dependencies to arrive at the end room. For example, some rooms cannot be accessed without a key that can only be obtained in rooms sometimes very far from the door they open. In these cases, planning is required to ensure the agent takes the most efficient path between rooms. 14 Generalization & Planning. Due to the procedural generation of each floor layout within the Obstacle Tower, it is not possible to re-use a single high-level plan between floors. It is likewise not possible to re-use plans between environment instances, as the layout of each floor is determined by the environment’s generation seed. Because of this, planning methods which require computationally expensive state discovery phases are likely not able to generalize to unseen floor layouts. 15 3. METHODOLOGY 3.1 Neural Network In DRL, the AI agents are represented by Deep Neural Networks. While there are many suitable network architectures to choose from, ranging from basic to very complex, we have opted for a feed-forward Convolutional Neural Network (FFCNN); these networks have a proven track record for automatically detecting significant features without any human supervision [Alzubaidi et al., 2021] and performing well in pixel-to-control problems [Mnih et al., 2016]. Given the agent’s dependance on visual information in the Obstacle Tower environment, the same model architecture as the one used by Salimans et al. [28] and Mnih et al. [25] was adopted for this research. A Convolutional Neural Network (CNN) is a kind of neural network that is able to extract features from data with convolution structures. Often used to solve image processing, classification, and segmentation problems, CNNs use convolution layers to preserve the relationship between pixels by learning image features using small squares of input data. The outputs of the convolution layers summarize the presence of features in the input image, also called feature maps. Each convolutional layer contains a series of filters known as convolutional kernels. The filter is a matrix of integers that are used on a subset of the input pixel values, the same size as the kernel. Each pixel is multiplied by the corresponding value in the kernel, then the result is summed up for a single value for simplicity representing a grid cell, like a pixel, in the output channel/feature map. This architecture gives CNNs advantages over more classical neural networks; neurons are only connected to a small number of neurons from the previous layer instead of all of them which effectively reduces the parameters and speeds up convergence, and a group of connections can share the same 16 weights, which reduced parameters further [Li et al., 2020]. A problem with the convolution layer outputs, or feature maps, is that they can be sensitive to the location of the features in the input (e.g. an object being on the right or left side of the image). One approach to mitigate this sensitivity is to down sample the feature maps in order to make them more robust to changes in the position of the feature in the image. This robustness to positional variations is referred to as translation invariance and means that the CNN would be able to identify an object regardless of its position in the image (Appendix 2.). Pooling layers, commonly placed in-between successive convolution layers, provide an approach to down sampling feature maps by summarizing the presence of features in patches of the feature map. In addition to progressively reducing the representation size of the input images, Pooling layers also reduce the number of parameters, and hence also control overfitting 8 . Two common pooling methods are Average pooling and Max pooling that summarize the average presence of a feature and the most activated presence of a feature respectively. As mentioned previously, each neuron only receives input from a small local region, or kernel, of the pixels in the input image, unlike a neural network where all the neurons are fully connected. This is the concept of local connectivity, which helps us understand another powerful mechanism that allow CNNs to reduce the number of parameters, and in turn increase translation invariance [Gu et al., 2017]: Parameter Sharing (or weight sharing). With Parameter Sharing, all the neurons in the kernel are constrained to use the same weights and biases. It stems from the assumption that if one feature is useful to compute at some position (e.g. (x, y)), then it should be useful to compute at a different position (e.g (x2, y2)). 8 Overfitting occurs when a machine learning model achieves a good fit (i.e good predictions) on the training data but does not generalize well on unseen data. In other words, the model has learned patterns that are specific to the training data and not relevant to the dataset as whole. 17 The CNN used for this research project was developed in PyTorch and is comprised of two convolutional layers; the first convolution layer has an input size of 3 and an output size of 16 with a kernel size of 8 and a stride of 4. It expects an input image of size 84 x 84, which is the size of the downscaled image from the Obstacle Tower. The second convolution layer has an input size of 16 and an output size of 32 with a kernel size of 4 and a stride of 2. Between Figure 3. Convolutional Neural Network Architecture Diagram Table 1. Parameters of the Convolutional Neural Network used for this research. 24 Repeat steps 2. through 5. until the stopping criteria is met. These steps are repeated until the population has converged, or a stopping criterion has been met; for example, a desired fitness score has been reached, or a maximum number of generations has been reached. There is a concept in GAs called Elitism, where the most fit individual in a population gets a guaranteed place in the next generation, generally without undergoing mutation (it can still be duplicated in the next population and undergo mutation). Although Elitism is not traditionally used in ES, but rather in GA, it was implemented in this research. Pseudocode 3.4 The Obstacle Tower Environment The open-source OT environment is available for download 11 for Linux, Mac, and Windows. The environment version used for this research is v3.1, and requires Python +3.6, the Unity ML-Agents +0.10 and the OpenAI Gym Python packages. Although changes were made to the environment to be able to reduce the action space, these changes were not applied used during the experiments due to time and budget constraints. The following action space reductions were inspired by Kanervisto et al. [18]: 11 https://github.com/Unity-Technologies/obstacle-tower-env START Initialize a population REPEAT: Fitness Evaluation + Save Elite Selection Crossover (optional for ES) Mutation UNTIL specified stopping criteria has been met STOP 25 Full. All actions are possible (i.e. 54 possible discrete actions). Minimal. The only allowed actions are moving forward, turning left, and turning right. Backward. Same as Minimal, but with the additional option of moving backward. Strafe. Same as Backward, but with the additional options of strafing (i.e moving sideways) left and right. Always Forward. The player always moves forward, all other actions are possible except staying in place and going backward. As a reminder, these reduced action space options were implemented in the OT environment but were not tested during the experiments. All experiments are run with the Full action space, which is the original action space provided by the Juliani et al. [16] and the one they used in their benchmarks. No other parameters or functionalities were added to the OT environment, and the environment parameters that were used for all experiments are detailed in Table 3. under the Experiments section of this paper. In order to reproduce the experiments of this research, it is important to be aware of the evaluation criteria outlined by the Juliani et al. [16]. They provide thee possible evaluation schemes that aim at making the performance on agents in the OT environment as reproducible and interpretable as possible: No Generalization. It is possible to evaluate the performance of an agent on a single, fixed version of the OT. In this case they recommend explicitly reporting that the evaluation was performed on a fixed version of the OT, and reporting performance on five random seeds of the dynamics of the agent. These seeds can be provided on 26 environment reset and condition the random number generator used to generate the tower definition. Weak Generalization. Agents should be trained on a fixed set of 100 seeds for the environment configurations. They should then be tested on a held-out set of five randomly selected tower configuration seeds not in the training set. Each should be evaluated five times using different random seeds for the dynamics of the agent (initial weights of the policy and/or value network(s)). Strong Generalization. In addition to the requirements for weak generalization, agents should be tested on a held-out visual theme which is separate from the ones on which it was trained. In their paper, Juliani et al. [16] trained on the Ancient and Moorish themes, and test on the Industrial theme. Because the OT environment is designed to test the generalization ability of agents, Juliani et al. [16] recommend evaluating agents using the latter two methods. For this research, all experiments were evaluated using the Weak Generalization scheme and the results will only be compared to the Weak Generalization benchmark results published by Juliani et al. [16]. 27 4. EXPERIMENTS The focus of this work is on selection and mutation techniques. Crossover techniques were not explored during this research, as they are rarely applied in ES and are more of GA technique [Dianati et al., 2002], and were not explored in the original paper published by Salimans et al. [28] either. Furthermore, as crossover techniques are more difficult to implement when working in distributed systems, and because the complexity of applying crossover techniques to neural network weights falls outside of the scope of this research. Parameter Program Value Generations – The maximum number of generations, in RL terms this would be the training step. This is the stopping criteria of the algorithm; when the maximum generation is reached, the algorithm stops training. ES 85 Population Size - The number of individuals, or agents, in the population. A population of the specified size is initialized at the beginning of training, and the population size remains constant throughout the training process. ES 200 Number of selected individuals – The number of individuals, or agents, that are selected to recreate the population at each generation. As the population is constant, some of the selected individuals may appear twice in the population (except during the initialization of the population at the start of training, where all individuals are unique). ES 30 Maximum Timesteps per Episode – The maximum number of steps an agent is allowed to take during an episode, or generation. It is possible for the agent to exit the environment earlier if another exit condition is met (e.g., the agent won before using its maximum timesteps). ES 3500 Mutation Power – The amount of perturbation applied to the parameter during mutation. ES 0.005 Mutation Probability – The probability of mutation occurring. This is evaluated at each generation for each individual, or agent, before it enters the OT environment. ES 0.6 Number of Workers – Number of Kubernetes nodes, or CPUs, available to Worker tasks. ES 94 Greyscale – Turn images into greyscale (1 x 128 x 128) instead of RGB (3 x 128 x 128). OT False Retro – Downscale images from 128 x 128 to 84 x 84. OT True Realtime Mode – Show the agent traversing the environment in real-time speed. OT True Table 3. Parameters used during experiments. 28 All experiments used the parameters specified in Table 3, except for the mutation power, which could change due to the nature of the mutation techniques that were being used. Selection Methods Two selection methods were implemented and tested for this research; the first is the basic ES selection used by OpenAI, and the second is a popular GA selection method: Select N Best Individuals. In this selection method, individuals were ranked according to their fitness scores. The N highest ranking individuals were selected to re-create the population, where N is an exogenous parameter representing the number of selected individuals. Fitness Proportionate Selection. Also called Roulette Wheel Selection, is a stochastic selection method, where the probability for selection of an individual is proportional to its fitness. This selection method gets its name from real-world roulette wheels that can be found in casinos, the only distinction is that the slots are not all the same size; instead, their size, and thus their probability of being selected, is proportional to their fitness score. This means that any individual has a chance of being selected, with fitter individuals having a higher probability of being selected. Mutations All mutations had the following parameters: a starting mutation power of 0.005, and a mutation probability of 0.6. All experiments were also run with a linearly decreasing mutation probability, where the mutation probability decreases with each generation. Gaussian Mutation. Referred to as Simple mutation for the remainder of this research. If the individual is selected for mutation, some noise is added to the genes, or weights of that individual. The added noise is equal to a randomly selected weight value from 29 a normal distribution with a mean of 0 and a variance of 1, multiplied by the mutation power. This is the mutation technique that was applied in the paper published by OpenAI. Random Mutation. This mutation is similar to the Simple Mutation, the only difference being that the mutation power is randomized to a uniform power between 0 and the defined mutation power of 0.005. Decaying Mutation. The goal of this mutation technique is to linearly reduce the mutation power as the number of generations increases. Adding even small amounts of noise to the weights of the neural networks (i.e the individual solutions) can dramatically change the way they behave; the goal of this mutation technique is to reduce the amount of noise added to the weights as the population converges. This means earlier generations will have higher degrees of noise added, whereas later generations will have much smaller degrees of noise added. 30 5. RESULTS AND DISCUSSION We are interested in analyzing the mean episodic rewards and maximum episodic rewards of the experiments; the mean episodic rewards will give us insights into whether the population was evolving as expected and whether the population hit a plateau at some point during its evolution. The maximum episodic reward will allow us to assess the performance of the elite of each generation and determine whether a plateau was reached at a certain reward level. It is particularly important to analyze for performance plateaus in the OT environment, as they can indicate the introduction of a new game mechanic that the agents are unable to Figure 5. The mean episodic reward for all three mutation techniques with Select N Best selection. Figure 6. The mean episodic reward for all three mutation techniques with Roulette Wheel/Fitness Proportionate selection. Figure 7. The maximum episodic reward for all three mutation techniques with Select N Best selection. Fig 8. The maximum episodic reward for all three mutation techniques with Roulette Wheel/Fitness Proportionate selection. 31 overcome; in the baseline results published by the team behind the Obstacle Tower environment, they found that with the weak generalization evaluation criteria (i.e. where agents are trained on a fixed set of 100 seeds), the agents were plateauing at the 5th floor, which is the floor where a locked doors mechanic was introduced [Juliani et al., 2019]. Solving this mechanic required the model to have a long-term memory mechanism, which their models did not have. The results of the experiments are organized in a way that makes it easy to compare the mean and maximum episodic rewards for both selection and all three mutation methods: Figures 5. and 6. compare the mean episodic rewards for the Simple/Gaussian (green), Random (orange), and Decaying (blue) mutation methods under the Select N Best (figure 5.) and Roulette Wheel (figure 6.) selection methods. Figures 7. and 8. compare the maximum episodic rewards for the same mutation and selection methods. The y-axis shows the rewards, while the x-axis shows the generation at which the reward was obtained. As a reminder, we used the OT environment’s default reward configuration, where the agent receives a sparse reward of +1 for completing a floor of the tower, and a dense reward of +0.1 for opening doors, solving puzzles, or picking up keys. Figures 5. And 6. show that the selection and mutation techniques facilitate evolution and that the average fitness scores of the populations increases with each generation. For both selection methods, the Decaying and Random mutations performed better on average than the Simple mutation. Figure 5. Shows that Select N Best, the selection method where the top performers are selected to build the next generation, has a steadier incline, and showcases higher average rewards than the Roulette Wheel selection (figure 6.), which seems to plateau around generation 50 for each mutation method. Looking at Table 5., which shows the results of the baseline models published by Juliani et al. [16], we see that with the Select N Best 32 selection method, all three mutation methods achieve the same mean episodic reward as their Proximal Policy Optimization 12 (PPO) algorithm, with the Random mutation achieving a higher mean episodic reward of 1.15. This is not the case for the Roulette Wheel selection; only the Random mutation method achieves a mean episodic reward of 0.8 around the 42nd generation before dropping below the PPO score. It is important to note that in order to achieve the results published in Table 5., Juliani et al. [16] trained their PPO and Rainbow 13 (RNB) models sessions spanning 20 million environment steps, which is significantly more that the number steps performed for this research (see Table 4.). As the mean episodic reward for the mutation methods under the Select N Best selection method do not seem to be plateauing (figure 5.), it is plausible that their mean episodic scores would have increased if they were to take up to 20 million steps. In the future, it would be interesting to increase the number of generations or the number of agents for the three mutation methods under the Select N Best selection method. The graph for the mean episodic rewards of PPO and RNB at different evaluation criteria published by Juliani et al. [16] is available in Appendix 8. 12 Proximal Policy Optimization (PPO) is a RL algorithm belonging to the family of policy gradient methods for reinforcement learning, which alternate between sampling data through interaction with the environment and optimizing a "surrogate" objective function using stochastic gradient ascent [Schulman et al., 2017]. 13 DeepMind’s Rainbow algorithm is the combination of six independent improvements on the Deep Q- Learning (DQN) algorithm. In their 2017 paper, Hessel, M. et al. [38] demonstrated that combining the Double Q- Learning, Prioritized Replay, Dueling Networks, Multi-Step Learning, Distributional RL, and Noisy Nets techniques into one DQN algorithm outperformed the state-of-the-art RL algorithms on the Atari 2600 benchmark. Mutation Method Select N Best Roulette Wheel Simple 12 019 911 11 261 466 Random 12 261 356 11 824 878 Decaying 12 235 011 11 759 863 Table 4. Total number of environment steps after the maximum number of generations was reached (i.e stopping criteria) 33 Figures 7. and 8. reveal that the Roulette Wheel selection outperforms the Select N Best selection in terms of achieving the highest episodic score. Figure 8. shows that the Decaying mutation combined with the Roulette Wheel selection achieves the highest scores, however it is difficult to attribute the agents’ performance to the mutation function, as the figure shows that the highest score is achieved early in the evolution, at a point where the mutation power would still be very close to the one applied with the Simple mutation. This makes it difficult to single out any mutation technique as being more effective at producing better offspring. The success of the Decaying mutation function can more likely be attributed to randomness; similar to how the OpenAI researchers found that even a random network can get good results, the success of the decaying mutation technique can likely be attributed to a lucky initialization of the network weights. It is clear from figures 7. and 8. that the elite agents (i.e. the agent with the highest episodic score at every generation) are plateauing very early in the evolution and that for all selection and mutation methods the elites stagnate on the second floor; only the Decaying mutation with Roulette Wheel selection reaches the 4th and even the 6th floor but plateaus 3rd floor. The few spikes in figures 7. and 8. can likely be attributed to luck and randomness, as the early floors of the OT environment are relatively straightforward; the there are no traps Model Mean Episodic Reward Number of Environment Steps Proximal Policy Optimization (PPO) 0.8 20 000 000 Rainbow (RNB) 3.4 20 000 000 Human 15.6 - Table 5. Baseline results from the Obstacle Tower paper comparing PPO, Rainbow (Dopamine), and human performance reported as the mean of the number of floors solved in a single episode under “weak generalization” evaluation criteria. 40 Finally, there are changes to the environment, or the way the agent interacts with the environment, that can be applied in order to increase performance. For this research, changes were made to the environment to minimize the action space. Unfortunately, these methods were not tested due to budgetary constraints. Using greyscale instead of RGB images could also help the agent identify with its surroundings better and changing to reward function to include more densely distributed rewards can potentially help the agent learn to navigate the environment more effectively. Most of the suggested improvements in this section were not tested due to time and budget constraints, as mentioned previously. However, given the work that has already been delivered for this paper, most of the suggestions above could be easily implemented in future research. 41 8. BIBLIOGRAPHY [1] Abdoun, O., et al. “Analyzing the Performance of Mutation Operators to Solve the Travelling Salesman Problem.” ArXiv:1203.3099 [Cs], (2012). arXiv.org, http://arxiv.org/abs/1203.3099. [2] Alzubaidi, L., Zhang, J., Humaidi, A.J. et al. “Review of deep learning: concepts, CNN architectures, challenges, applications, future directions”. J Big Data 8, 53 (2021). https://doi.org/10.1186/s40537-021-00444-8 [3] Bellemare, M. G., et al. “The Arcade Learning Environment: An Evaluation Platform for General Agents.” Journal of Artificial Intelligence Research, vol. 47, (2013), pp. 253–79. arXiv.org, doi:10.1613/jair.3912. [4] Booth, J. “PPO Dash: Improving Generalization in Deep Reinforcement Learning.” ArXiv:1907.06704 [Cs], (2019). arXiv.org, http://arxiv.org/abs/1907.06704. [5] Braylan A., Hollenbeck M., Meyerson E., Miikkulainen R., et al. “Frame skip is a powerful parameter for learning to play Atari”. AAAI workshop, (2015). UTexas, http://nn.cs.utexas.edu/downloads/papers/braylan.aaai15.pdf [6] Brockman, G., et al. “OpenAI Gym.” ArXiv:1606.01540 [Cs], (2016). arXiv.org, http://arxiv.org/abs/1606.01540. [7] Brunnbauer, A., et al. “Model-Based versus Model-Free Deep Reinforcement Learning for Autonomous Racing Cars.” ArXiv:2103.04909 [Cs], (2021). arXiv.org, http://arxiv.org/abs/2103.04909. [8] Câmara, D. “Evolution and Evolutionary Algorithms.” Bio-Inspired Networking, Elsevier, (2015), pp. 1–30. DOI.org (Crossref), doi:10.1016/B978-1-78548-021- 8.50001-6 [9] Christlein, V., et al. “Deep Generalized Max Pooling.” ArXiv:1908.05040 [Cs], (2019). arXiv.org, http://arxiv.org/abs/1908.05040. [10] Dayan, P., Niv, Y. “Reinforcement Learning: The Good, The Bad and The Ugly.” Current Opinion in Neurobiology, vol. 18, no. 2, (2008), pp. 185–96. DOI.org (Crossref), doi:10.1016/j.conb.2008.08.003. 42 [11] Dianati, M., Song, I., Treiber, M. ”An Introduction to Genetic Algorithms and Evolution.” ceas3.uc.edu, (2002). University of Cincinnati https://static.aminer.org/pdf/PDF/000/304/974/multi_population_evolution_stra tegies_for_structural_image_analysis.pdf [12] Ecoffet, A. “Montezuma’s Revenge Solved by Go-Explore, a New Algorithm for Hard-Exploration Problems (Sets Records on Pitfall, Too).” Uber Engineering Blog, (2018), https://eng.uber.com/go-explore/. [13] Gu, J., et al. “Recent Advances in Convolutional Neural Networks.” ArXiv:1512.07108 [Cs], (2017). arXiv.org, http://arxiv.org/abs/1512.07108. [14] Howard, A. G., et al. “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.” ArXiv:1704.04861 [Cs], (2017). arXiv.org, http://arxiv.org/abs/1704.04861. [15] Huang, S., et al. “Adversarial Attacks on Neural Network Policies.” ArXiv:1702.02284 [Cs, Stat], (2017). arXiv.org, http://arxiv.org/abs/1702.02284. [16] Juliani, A., et al. “Obstacle Tower: A Generalization Challenge in Vision, Control, and Planning.” ArXiv:1902.01378 [Cs], (2019). arXiv.org, http://arxiv.org/abs/1902.01378. [17] Juliani, A., et al. “Unity: A General Platform for Intelligent Agents.” ArXiv:1809.02627 [Cs, Stat], (2020). arXiv.org, http://arxiv.org/abs/1809.02627. [18] Kanervisto, A., et al. “Action Space Shaping in Deep Reinforcement Learning.” ArXiv:2004.00980 [Cs], (2020). arXiv.org, http://arxiv.org/abs/2004.00980. [19] Li, Z., et al. “A Survey of Convolutional Neural Networks: Analysis, Applications, and Prospects.” ArXiv:2004.02806 [Cs, Eess], (2020). arXiv.org, http://arxiv.org/abs/2004.02806. [20] Liang, E., et al. “RLlib: Abstractions for Distributed Reinforcement Learning.” ArXiv:1712.09381 [Cs], (2018). arXiv.org, http://arxiv.org/abs/1712.09381. [21] Lillicrap, T. P., et al. “Continuous Control with Deep Reinforcement Learning.” ArXiv:1509.02971 [Cs, Stat], (2019). arXiv.org, http://arxiv.org/abs/1509.02971. 43 [22] Machado, M. C., et al. “Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents.” ArXiv:1709.06009 [Cs], (2017). arXiv.org, http://arxiv.org/abs/1709.06009. [23] Minsky, M. "Steps toward Artificial Intelligence," in Proceedings of the IRE, vol. 49, no. 1, pp. (1961), doi: 10.1109/JRPROC.1961.287775. [24] Mnih, V., Kavukcuoglu, K., Silver, D. et al. “Human-level control through deep reinforcement learning.” Nature 518, 529–533 (2015). https://doi.org/10.1038/nature14236 [25] Mnih, V., et al. “Asynchronous Methods for Deep Reinforcement Learning.” ArXiv:1602.01783 [Cs], (2016). arXiv.org, http://arxiv.org/abs/1602.01783. [26] Moritz, P., et al. “Ray: A Distributed Framework for Emerging AI Applications.” ArXiv:1712.05889 [Cs, Stat], (2018). arXiv.org, http://arxiv.org/abs/1712.05889. [27] Pleines, M., et al. “Obstacle Tower Without Human Demonstrations: How Far a Deep Feed-Forward Network Goes with Reinforcement Learning.” ArXiv:2004.00567 [Cs, Stat], (2020). arXiv.org, http://arxiv.org/abs/2004.00567. [28] Salimans, T., et al. “Evolution Strategies as a Scalable Alternative to Reinforcement Learning.” ArXiv:1703.03864 [Cs, Stat], (2017). arXiv.org, http://arxiv.org/abs/1703.03864. [29] Salimans, T., et al. “Improved Techniques for Training GANs.” ArXiv:1606.03498 [Cs], June 2016. arXiv.org, http://arxiv.org/abs/1606.03498. [30] Schaul, T., Glasmachers, T., Schmidhuber, J., et al. “High dimensions and heavy tails for natural evolution strategies”. (2011). In Proceedings of the 13th annual conference on Genetic and evolutionary computation, pages 845–852. ACM, (2011). [31] Silver, D., Huang, A., Maddison, C. et al. “Mastering the game of Go with deep neural networks and tree search”. Nature 529, 484–489 (2016). https://doi.org/10.1038/nature16961 [32] Springenberg, J. T., et al. “Striving for Simplicity: The All Convolutional Net.” ArXiv:1412.6806 [Cs], 2015. arXiv.org, http://arxiv.org/abs/1412.6806. [33] Stavens, D., Sebastian, T. “A Self-Supervised Terrain Roughness Estimator for Off- Road Autonomous Driving.” ArXiv:1206.6872 [Cs], (2012). arXiv.org, http://arxiv.org/abs/1206.6872. 44 [34] Vinyals, O., Babuschkin, I., Czarnecki, W.M. et al. “Grandmaster level in StarCraft II using multi-agent reinforcement learning”. Nature 575, 350–354 (2019). https://doi.org/10.1038/s41586-019-1724-z [35] Wierstra, D., Schaul, T., Peters, J., Schmidhuber, J. et al. “Natural evolution strategies. In Evolutionary Computation”. (2008). CEC 2008. (IEEE World Congress on Computational Intelligence). IEEE Congress on, pages 3381–3387. IEEE, 2008. [36] Part 2: Kinds of RL Algorithms — Spinning Up Documentation. https://spinningup.openai.com/en/latest/spinningup/rl_intro2.html. Accessed 8 Nov. 2021. [37] Cheoi KJ., Choi H., Ko J.” Empirical Remarks on the Translational Equivariance of Convolutional Layers”. (2020). Applied Sciences. 2020; 10(9):3161. https://doi.org/10.3390/app10093161 [38] Hessel, Matteo, et al. “Rainbow: Combining Improvements in Deep Reinforcement Learning.” ArXiv:1710.02298 [Cs], Oct. 2017. arXiv.org, http://arxiv.org/abs/1710.02298. [39] Schulman, John, et al. “Proximal Policy Optimization Algorithms.” ArXiv:1707.06347 [Cs], Aug. 2017. arXiv.org, http://arxiv.org/abs/1707.06347. [40] Hausknecht, Matthew, et al. “HyperNEAT-GGP: A HyperNEAT-Based Atari General Game Player.” Proceedings of the 14th Annual Conference on Genetic and Evolutionary Computation, Association for Computing Machinery, 2012, pp. 217– 24. ACM Digital Library, https://doi.org/10.1145/2330163.2330195. [41] “Model-Based and Model-Free Reinforcement Learning - Pytennis Case Study.” Neptune.Ai, 27 Nov. 2020, https://neptune.ai/blog/model-based-and-model-free- reinforcement-learning-pytennis-case-study. 45 9. APPENDIX Appendix 1. OpenAI’s non-exhaustive taxonomy of modern RL algorithms [36]. Appendix 2. Showing the Translation Invariance property; when the inputs are shifted towards the right, the representations are also shifted [37]. 46 Tasks (stateless) Actors (stateful) Fine-grained load balancing Coarse-grained load balancing Support for object locality Poor locality support High overhead for small updates Low overhead for small updates Efficient failure handling Overhead from checkpointing Appendix 4. Trade-offs between Tasks and Actors presented Moritz et al. [26]. Appendix 3. Alternative Convolutional Neural Network Architecture Diagram 47 cluster_name: obstacle-tower-cluster-rllib-v0 min_workers: 0 max_workers: 10 upscaling_speed: 1.0 provider: type: gcp region: europe-west4 availability_zone: europe-west4-c project_id: obstacle-tower-gcp head_node: machineType: n1-highcpu-96 #n1-standard-16 disks: - boot: true autoDelete: true type: PERSISTENT initializeParams: diskSizeGb: 50 sourceImage: projects/deeplearning-platform-release/global/images/family/tf-1-13-cpu worker_nodes: machineType: n1-highcpu-96 disks: - boot: true autoDelete: true type: PERSISTENT initializeParams: diskSizeGb: 50 sourceImage: projects/deeplearning-platform-release/global/images/family/tf-1-13-cpu setup_commands: - export DEBIAN_FRONTEND=noninteractive - sudo apt-get update - sudo apt install -y libgconf-2-4 - sudo apt install -y libsoup2.4 - sudo apt install -y xorg - sudo apt-get install -y libxfont-dev - sudo apt-get install -y xvfb - wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh || true - bash Anaconda3-5.0.1-Linux-x86_64.sh -b -p $HOME/anaconda3 || true - echo 'export PATH="$HOME/anaconda3/bin:$PATH"' >> ~/.bashrc - pip install --upgrade pip - pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl - pip install -U ray[dashboard]==1.1.0 48 from worker import Worker from selections import roulette_wheel_selection, select_n_best DEFAULT_CONFIG = with_common_config({ "population_size": 85, #1000 "max_timesteps_per_episode": 1000, #2000 "max_evaluation_steps": 3, #2000 "number_elites": 20, "mutation_power": 0.005, "mutation_probability": 0.6, "num_workers": 7, "create_display": False, "generations": 10, "mutation_func": "simple", "decreasing_mutation": False, "action_space": 54, "local_dir": "models/" }) class GATrainer(Trainer): _name = "GA" _default_config = DEFAULT_CONFIG @override(Trainer) def _init(self, config: TrainerConfigDict, env_creator: Callable[[EnvContext], EnvType]): self._default_config = DEFAULT_CONFIG self.config = config Appendix 5. Configuration file to deploy the Kubernetes cluster with Ray on Google Cloud Platform to run the experiments for this research (.YAML). Appendix 6. Source code for the custom Ray/RLlib Trainer class (GATrainer). 49 self.generation = 0 self._workers = [ Worker.remote(config, env_creator, idx + 1) for idx in range(config["num_workers"]) ] self.episodes_total = 0 self.timesteps_total = 0 self.elites = [] self.elite = None self.highest_reward = 0 if self.config['decreasing_mutation']: self.mutation_probs = np.round(np.linspace(self.config['mutation_probability'], 0.01, self.config['generations']), 3) @override(Trainer) def step(self): logging.basicConfig(level=logging.INFO) worker_jobs = [] for i in range(self.config['population_size']): elite_id = i % self.config['number_elites'] worker_id = i % self.config['num_workers'] weights = self.elites[elite_id] if self.elites else None worker_jobs += [self._workers[worker_id].evaluate.remote(weights=weights, mutate=True, record=False, generation=self.generation, mutation_probability=self.mutation_probs[self.generation])] results = ray.get(worker_jobs) elites = select_n_best(results, self.config['number_elites']) self.elites = [] for result_id in elites: self.elites.append(results[result_id]['state_dict']) rewards = [result['total_reward'] for result in results] elite_index = np.argmax(rewards) if results[elite_index]['total_reward'] >= self.highest_reward: self.highest_reward = results[elite_index]['total_reward'] self.elite = results[elite_index]['state_dict'] self.timesteps_total += sum([result['timesteps_total'] for result in results]) self.episodes_total += len(results) self.generation += 1 return dict( timesteps_total=self.timesteps_total, episodes_total=self.episodes_total, generation=self.generation, train_reward_min=np.min(rewards), train_reward_mean=np.mean(rewards), train_reward_med=np.median(rewards), train_reward_max=np.max(rewards), )