From 46616c15b325ec2e7a4f8a90d58db5c989447fb5 Mon Sep 17 00:00:00 2001
From: pmaas <philip.maas@stud.hs-bochum.de>
Date: Mon, 31 Jan 2022 12:03:28 +0100
Subject: [PATCH] Added readme and requirements

---
 README.md        |  35 ++++++++++++++++++++++++++++++++++-
 main.py          |   6 +++---
 population.py    |   3 ---
 requirements.txt | Bin 0 -> 54 bytes
 walker.py        |   1 -
 5 files changed, 37 insertions(+), 8 deletions(-)
 create mode 100644 requirements.txt

diff --git a/README.md b/README.md
index 43c3fff..a476550 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,36 @@
 # Bipedal Walker Evo
 
-Trying to solve the bipedal walker with an evolution algorithm
\ No newline at end of file
+This project tries to solve OpenAI's bipedal walker with an evolutionary strategy.\
+After 1000 episodes, which is about 1h of learning, it will reach ~250 reward.\
+Best score until now: 292/300
+
+## How it works
+1. Generate a randomly weighted neural net
+2. Create a population of neural nets with mutated weights
+3. Let every net finish an episode and reward it accordingly
+4. The better the reward, the higher the chance to pass weights to next gen
+
+## Hyperparameters
+| Parameter         | Description                                                 | Interval  |
+|-------------------|-------------------------------------------------------------|-----------|
+| `HIDDEN_LAYER`    | Size of hidden layer.                                       | [1;∞[     |
+| `POP_SIZE`        | Size of population.                                         | [0;∞[     |
+| `MUTATION_FACTOR` | Percentage of weights that will be mutated for each mutant. | [0;1]     |
+| `LEARNING_RATE`   | This is the rate of learning.                               | [0;1]     |
+| `GENS`            | Number of generations.                                      | [0;1]     |
+| `MAX_STEPS`       | Number of steps that are played in one episode.             | [0; 1600] |
+
+
+## Installation
+We use Windows, Anaconda and Python 3.7 \
+` conda create -n evo_neuro python=3.7` \
+`conda activate evo_neuro`\
+`conda install swig`\
+`pip install -r requirements.txt`\
+
+
+
+## Sources
+Environment: https://github.com/openai/gym/wiki/BipedalWalker-v2 \
+OpenAI Website: https://gym.openai.com/envs/BipedalWalker-v2/ \
+More on evolution strategies: https://openai.com/blog/evolution-strategies/
\ No newline at end of file
diff --git a/main.py b/main.py
index cdcf7a0..ac391d1 100644
--- a/main.py
+++ b/main.py
@@ -8,12 +8,12 @@ HIDDEN_LAYER = 12
 POP_SIZE = 50
 MUTATION_FACTOR = 0.1  # 0 <= x <= 1
 LEARNING_RATE = 0.03   # 0 <= x <= 1
-GENS = 1000
-MAX_STEPS = 300  # after 1600 steps the Environment gives us a done anyway.
+GENS = 3000
+MAX_STEPS = 1200  # after 1600 steps the Environment gives us a done anyway.
 
 
 VERSION = 1
-TEST_WALKER = True
+TEST_WALKER = False
 LOAD_BRAIN = False
 RENDER_BEST = False
 if TEST_WALKER:
diff --git a/population.py b/population.py
index 66cc3b0..460e7d0 100644
--- a/population.py
+++ b/population.py
@@ -1,7 +1,4 @@
 import numpy as np
-import random
-import logging
-import copy
 from walker import Walker
 import gym
 
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0c85215b839de1a44c1b47e1fc37c70c6b9032b7
GIT binary patch
literal 54
zcmezWFP)*1A(w%dfr}xRA(5ekp@1QWA)ldyA%`K8Aqgy=$56_U%TT~j3Fd)R0svh5
B3K#$Y

literal 0
HcmV?d00001

diff --git a/walker.py b/walker.py
index b3fad9c..2269af2 100644
--- a/walker.py
+++ b/walker.py
@@ -1,4 +1,3 @@
-import gym
 import numpy as np
 import pickle
 import copy
-- 
GitLab