Class

SingleAgentEnvironment

(abstract) SingleAgentEnvironment()

An environment with a single agent

Constructor

# abstract new SingleAgentEnvironment()

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 9

Extends

Members

Taction | undefined

# lastAction

get the last action

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 36

Methods

# abstract actionSpace() → {Array}

The action space

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 35

Array

# additionalInfo(EnvStateContext) → {EnvStateContext}

Get additional info about the environment state

Parameters:
Name Type Description
EnvStateContext number

EnvStateContext maxIterPerGame

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 223

# agent(agent)

set the agent

Parameters:
Name Type Description
agent Agent | undefined

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 180

# abstract encodeStateToIndices(state) → {Array.<number>}

encode the state into an number array

Parameters:
Name Type Description
state object

the state to encode

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 123

an numbers array

Array.<number>

# abstract getReturn() → {number}

The total Return of the agent.

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 240

number

# abstract init(optionsnullable, initialStatenullable) → {void}

initialize the environment

Parameters:
Name Type Attributes Description
options EnvOptions <nullable>

the environment options

initialState object <nullable>

the optional initial state of the environment

Overrides:

View Source core/src/RLInterface/Environment.ts, line 92

void

# initAgent() → {void}

This method can be used to initialize the environment and for example initialize the agents

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 195

test

void

# abstract isTerminal() → {boolean}

Whether the enviroment state is terminal

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 51

boolean

# abstract iteration() → {number}

The current iteration

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 67

number

# lastAction() → {string|undefined}

get the last action

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 188

string | undefined

# log(trainIteration) → {void}

Is called each iteration defined by the logEvery parameter in the training method

Parameters:
Name Type Description
trainIteration

The current training iteration

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 215

void

# abstract name() → {string}

The enviromnet name

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 83

string

# onIterationEnd() → {void}

Function called after the training Iteration and before the logging. This function can be used for example for logging specifig cleanups/ calculations

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 231

void

# abstract options() → {EnvOptions|undefined}

The current options

Overrides:

View Source core/src/RLInterface/Environment.ts, line 59

EnvOptions | undefined

# abstract reset() → {boolean}

The reset the environment

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 107

boolean

# abstract resetStats() → {boolean}

reset the stats accumulated over the life time of the environment

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 130

True if the reset was sucessfull

boolean

# abstract setOptions(optionsnullable) → {void}

Set the environment options

Parameters:
Name Type Attributes Description
options EnvOptions <nullable>
Overrides:

View Source core/src/RLInterface/Environment.ts, line 115

void

# async singleTrainStep(maxIterationPerGame) → {Promise.<void>}

A single trainign step

Parameters:
Name Type Description
maxIterationPerGame number

The max iterations per game

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 131

Promise.<void>

# abstract state() → {object}

The state

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 43

object

# abstract stateDim() → {Array}

The state dimension

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 27

Array

# abstract stats() → {object}

The current environment stats

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 75

object

# abstract step(action) → {StepResult}

take an action in the environment

Parameters:
Name Type Description
action string

the action to take

Inherited From:

View Source core/src/RLInterface/Environment.ts, line 100

the result of the taken action

StepResult

# async train(iterationsopt, logEveryopt, maxIterationPerGameopt, resetStatsOnLogopt) → {Promise.<number>}

The trains the agent, defined for the environment.

Parameters:
Name Type Attributes Default Description
iterations number <optional>
100

numbers of iterations to iterate.

logEvery number <optional>
-1

loging interval relative to training iterations.

maxIterationPerGame number <optional>
-1

how many iterations for a game until it automatically terminates.

resetStatsOnLog boolean <optional>
true

bool to indicate the reseting of stats after logging

View Source core/src/RLInterface/SingleAgentEnvironment.ts, line 207

Promise.<number>