Solving OpenAI Gym Environments with MATLAB RL Toolbox
Published in
3 min readApr 24, 2020
If you work with reinforcement learning you have probably heard of TensorFlow, PyTorch and the likes. However, in 2019 MathWorks introduced a new toolbox for reinforcement learning. This product provides a well supported alternative that may be worth checking out. Here, we show one approach for how to use this toolbox to solve OpenAI Gym environments.
Setting Up Python Interpreter in MATLAB
Note: I am currently running MATLAB 2020a on OSX 10.15 using Anaconda 4.8.2 to create Python environments.
To setup Python and install the dependencies follow the steps below:
- In a system terminal, use the
conda create --name matlab-rl python=3.6
command to create an environment with Python 3.6 where we can install packages without risk of conflicting with our system’s Python install. - Run
conda activate matlab-rl
to enter this new environment. - Install OpenAI Gym
pip install gym
. You can see how to install additional components of it here. - Run
which python
to get this environment’s Python interpreter. You should see something along the lines of:/usr/local/anaconda3/envs/matlab-rl/bin/python
- To tell MATLAB to use this Python intepreter use the following command in…