Skip to content
/ cartpole Public

A simple genetic algorithm to solve Open AI Gym's CartPole environment.

Notifications You must be signed in to change notification settings

bdura/cartpole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CartPole

A simple project to try out some learning strategies on Open AI Gym's CartPole-v0 environment :

  • a solution based on genetic algorithm;
  • a k nearest-neighbors strategy.

Genetic Algorithm

The idea is simplistic: make a fixed-sized population of agents compete. At every generation, survivors are selected stochastically according to their fitness (in this case their overall reward), and mutate into the next generation.

An Agent receives information about its environment (the observation variable returned by the step() method of the environment), and makes a decision on the action to take.

In our case, and Agent's brain consists of a simple two-layer neural network, which is fed the observation output by the environment at the end of each step. The genetic algorithm aims at determining the best parameters for the neural network.

k-Nearest Neighbors

About

A simple genetic algorithm to solve Open AI Gym's CartPole environment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published