Skip to content

Latest commit

 

History

History

Gym

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

OpenAI Gym

This directory contains reinforcement learning algorithms in OpenAI Gym environments.

A pole is attached by an un-actuated joint to a cart, which moves along a frictionless track. The system is controlled by applying a force of +1 or -1 to the cart. The pendulum starts upright, and the goal is to prevent it from falling over. A reward of +1 is provided for every timestep that the pole remains upright. The episode ends when the pole is more than 15 degrees from vertical, or the cart moves more than 2.4 units from the center.

The agent controls the movement of a character in a grid world. Some tiles of the grid are walkable, and others lead to the agent falling into the water. Additionally, the movement direction of the agent is uncertain and only partially depends on the chosen direction. The agent is rewarded for finding a walkable path to a goal tile.

This demonstrates four different approaches to playing the game Blackjack, including a q-learning approach.

Setup

To begin, you'll need the latest version of Swift for TensorFlow installed. Make sure you've added the correct version of swift to your path.

Please install OpenAI Gym to run these models.

pip install gym

To build and run the models, run:

swift run Gym-CartPole
swift run Gym-FrozenLake
swift run Gym-Blackjack
swift run Gym-DQN