reinforce-0.0.0.1: Reinforcement learning in Haskell

Copyright(c) Sentenai 2017
LicenseBSD3
Maintainersam@sentenai.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Environments.Gym.ClassicControl.CartPoleV0

Contents

Description

Environment description: > 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.

https://gym.openai.com/envs/CartPole-v0

Synopsis

Documentation

data Action Source #

Cartpole can only go left or right has an action space of "discrete 2" containing {0..n-1}.

FIXME: Migrate this to either a more generic "directions" actions (would need things like "up", "down" versions as well) or a "discrete actions" version. I'm a fan of the former.

Constructors

GoLeft 
GoRight 

Instances

Bounded Action Source # 
Enum Action Source # 
Eq Action Source # 

Methods

(==) :: Action -> Action -> Bool #

(/=) :: Action -> Action -> Bool #

Ord Action Source # 
Show Action Source # 
Generic Action Source # 

Associated Types

type Rep Action :: * -> * #

Methods

from :: Action -> Rep Action x #

to :: Rep Action x -> Action #

Hashable Action Source # 

Methods

hashWithSalt :: Int -> Action -> Int #

hash :: Action -> Int #

ToJSON Action Source # 
DiscreteActionSpace Action Source # 

Associated Types

type Size Action :: Nat Source #

MonadEnv Environment StateCP Action Reward Source # 
MonadWriter (DList Event) Environment # 
type Rep Action Source # 
type Rep Action = D1 (MetaData "Action" "Data.CartPole" "reinforce-0.0.0.1-BYNakn0URySEY5wecxfdnO" False) ((:+:) (C1 (MetaCons "GoLeft" PrefixI False) U1) (C1 (MetaCons "GoRight" PrefixI False) U1))
type Size Action Source # 
type Size Action = 2

type Runner s a x = RunnerT s a IO x Source #

type alias of RunnerT in IO

data StateCP Source #

The state of a cart on a pole in a CartPole environment

Constructors

StateCP 

Fields

Instances

Eq StateCP Source # 

Methods

(==) :: StateCP -> StateCP -> Bool #

(/=) :: StateCP -> StateCP -> Bool #

Ord StateCP Source # 
Show StateCP Source # 
Generic StateCP Source # 

Associated Types

type Rep StateCP :: * -> * #

Methods

from :: StateCP -> Rep StateCP x #

to :: Rep StateCP x -> StateCP #

Monoid StateCP Source # 
Hashable StateCP Source # 

Methods

hashWithSalt :: Int -> StateCP -> Int #

hash :: StateCP -> Int #

FromJSON StateCP Source # 
StateSpace StateCP Source # 
StateSpaceStatic StateCP Source # 

Associated Types

type Size StateCP :: Nat Source #

Methods

toR :: StateCP -> R (Size StateCP) Source #

MonadEnv Environment StateCP Action Reward Source # 
MonadWriter (DList Event) Environment # 
type Rep StateCP Source # 
type Size StateCP Source # 
type Size StateCP = 4

type EnvironmentT t = GymEnvironmentT StateCP Action t Source #

Alias to GymEnvironmentT with CartPoleV0 type dependencies

Orphan instances