Skip to content

Instantly share code, notes, and snippets.

View JKCooper2's full-sized avatar

Jesse Cooper JKCooper2

  • EthicalJobs.com.au
  • Melbourne, Australia
View GitHub Profile
@JKCooper2
JKCooper2 / openai-cartpolev0-random0
Created April 30, 2016 06:31
[Open AI] CartPole v0 - Random
import logging
import os
import gym
# The world's simplest agent!
class RandomAgent(object):
def __init__(self, action_space):
self.action_space = action_space
import logging
import gym
from Solved import SolvedAgent
def main():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
env = gym.make('CartPole-v0')
@JKCooper2
JKCooper2 / CartPole-v0.py
Last active November 1, 2018 18:03
[Open AI| CartPole v0 - Simulated Annealing v0
import logging
import gym
from SimulatedAnnealing import SimulatedAnnealingAgent
def main():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
env = gym.make('CartPole-v0')
@JKCooper2
JKCooper2 / Acrobot-v0.py
Last active June 30, 2016 21:55
[Open AI] Acrobot-v0 Simulated Annealing v1
import logging
import gym
from SimulatedAnnealing import SimulatedAnnealingAgent
def main():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
env = gym.make('Acrobot-v0')
Unachievable score resulting from action returning 20 rather than 2
Environment currently sets: velocity += (action-1)*0.001 + math.cos(3*position)*(-0.0025) without a bound checks on the input
Will look at adding range check to the environment
# CARTPOLE MULTI AGENT
# Set up to allow for using a pool of agents
import logging
import gym
from CrossEntropyMethod import CrossEntropyMethodPool
import gym.scoreboard.scoring
import gym.monitoring.monitor
@JKCooper2
JKCooper2 / README
Created June 9, 2016 08:30
Cartpole: for newcomers to RL - Part 1
For Section 1: https://openai.com/requests-for-research/#cartpole
Requirement of environment for algorithm to work:
- Action space has two discrete actions
- Ratio of observations can decide to the best action to take
@JKCooper2
JKCooper2 / README
Last active June 15, 2016 12:35
Linear Model Hill Climbing for CartPole
For part 1 of https://openai.com/requests-for-research/#cartpole
Quite often it doesn't solve (because of local minimum)
@JKCooper2
JKCooper2 / README
Created June 10, 2016 01:05
Hill Climbing Linear Model w/ Biased Update
Alteration to [standard hill climbing model](https://gym.openai.com/algorithms/alg_WKinUO3TNabzwPeaD7A)
Uses biased update that allows for worse performance to becomes new standard with reduced probability
For CartPole environment should result in larger percentage of tests solving the problem
import numpy as np
class Discrete:
def __init__(self, values):
self.values = values
self.max = np.prod(self.values)
def __validate(self, observation):
for i in range(len(self.values)):