0.9.5 • Published 6 years ago

@rl-js/redux-mdp v0.9.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Classes

Typedefs

MdpFactory ⇐ EnvironmentFactory

Class for constructing an Environment implemented as a ReduxMDP

Kind: global class
Extends: EnvironmentFactory

new MdpFactory(params)

Create a factory for a particular MDP

ParamTypeDefaultDescription
paramsobjectParameters for constructing the MDP
params.reducerReducerRedux reducer representing the state of the MDP
params.getObservationgetObservationCompute the current observation
params.computeRewardcomputeRewardCompute the current reward
params.isTerminatedisTerminatedCompute whether the environment is terminated
params.resolveActionresolveActionResolve the MdpAction into a ReduxAction
params.gammanumber1Reward discounting factor for the MDP

mdpFactory.createEnvironment() ⇒ ReduxMDP

Create an instance of the environment.

Kind: instance method of MdpFactory

mdpFactory.setMdpMiddleware(middleware)

Configure any MdpMiddleware that should be part of the next invocation of createEnvironment()

Kind: instance method of MdpFactory

ParamType
middlewarefunction

mdpFactory.setReduxMiddleware(middleware)

Configure any ReduxMiddleware that should be part of the next invocation of createEnvironment()

Kind: instance method of MdpFactory

ParamType
middlewarefunction

ReduxMDP ⇐ Environment

Class representing in an Environment as an MDP using Redux.

Kind: global class
Extends: Environment

State : *

The underlying state representation of the environment. Should be a serializable object, e.g. state => JSON.parse(JSON.stringify(state)) should be an identity

Kind: global typedef

MdpAction : *

An object representing an action in an MDP. The type is specific to the MDP.

Kind: global typedef

Observation : *

An object representing the observation of an agent in the current state. The type is specific to the MDP.

Kind: global typedef

ReduxAction : Object

An Redux action. e.g. a Flux Standard Action: https://github.com/redux-utilities/flux-standard-action Your MdpAction will be converted into a ReduxAction by resolveAction

Kind: global typedef
Properties

NameTypeDescription
typestringEach action must have a type associated with it.
payload*Any data associated with the action goes here
errorbooleanShould be true IIF the action represents an error
meta*Any data that is not explicitly part of the payload

reducer ⇒ State

A Redux reducer. Computes the next state without mutating the previous state object

Kind: global typedef
Returns: State - The new state object after the action is applied

ParamTypeDescription
stateStateThe current state of the MDP
actionReduxActionThe resolved action for the MDP

getObservation ⇒ Observation

A function to get the observation of the agent given the current state.

Kind: global typedef
Returns: Observation - The observation for the current state

ParamTypeDescription
stateStateThe current state of the MDP

computeReward ⇒ number

A function to compute the reward given a state transition, i.e. (s, a, s). This function should be completely deterministic; any non-determinism should be handled by resolveAction.

Kind: global typedef
Returns: number - The reward for given the state transition.

ParamTypeDescription
stateStatethe current state for the MDP
actionReduxActionThe next action
nextStateStatethe next state for the mdp

isTerminated ⇒ boolean

A function to compute whether the environment is terminated, i.e. the current episode is over.

Kind: global typedef
Returns: boolean - True if the environment is terminated, false otherwise.

ParamTypeDescription
stateStatethe current state for the MDP
actionReduxActionThe next action
nextStateStatethe next state for the MDP.
timenumberThe current timestep of the MDP, useful for finite horizon MDPs.

resolveAction ⇒ ReduxAction

A function to resolve a MdpAction into a ReduxAction. Any non-determinism in your environment should go here, as your Redux reducer should be completely deterministic.

Kind: global typedef
Returns: ReduxAction - The new state object after the action is applied

ParamTypeDescription
stateStatethe current state for the MDP
actionMdpActionThe resolved action for the MDP
0.9.5

6 years ago

0.9.3

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.3

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3-alpha.0

6 years ago

0.0.2

6 years ago

0.0.2-alpha.0

6 years ago

1.0.0

6 years ago