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 / utility.cls
Last active September 19, 2017 00:33
APEX sObject sObjectHasProperty, sObjectHasPath, getSObjectPath (including default)
/*
Provides utility functions for checking/accessing sObject properties
Updates:
- Namespace no longer required
- Replaced getPopulatedFieldsAsMap() with a plain try catch to improve speed
- Allowed for returns of SObjects
- Throw out SObjectException where the field exists but wasn't queried
To Do:

Random agent with action_space value checking

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)):
@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
@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 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
# 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
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
@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')
@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')