A R6Class to represent reinforcement learning environments. To define custom environment, one should define a R6Class which inherit rlR::Environment.

Environment

Format

R6Class object

Value

[Environment].

Member Variables

act_cnt

[int]
Number of actions of the agent to environment

state_dim

[vector(int)]
The dimension of the observation(or state) space on the environment. Must be vector of integers. For example, c(28, 28, 3), which can be the dimension for a tensor of order 3.

name

[character]
A string to represent the name of the environment

flag_continous

[logic]
A boolean variable to represent whether the action space is continous or not

Methods

initialize(...)

[function]
Constructor function to initialize environment

step(action)

[function]
Function to make a step in the environment. Must return a named list of [state(array of size state_dim), reward(reward the agent get after making the step), done(boolean variable whether the episode is finished or not), info(list of anything)]. There must be stoping criteria in step function which should return [list(state = state, reward = reward, done = TRUE, info = list())] to stop the interaction between the environment and the agent.

reset()

[function]
Reset the environment

render()

[function]
Print out information to user about the environment, can be left empty

afterAll()

[function]
What needs to be done after learning is finished, could be left empty

evaluateArm(vec_arm)

[function]
process value of vec_arm which is the same length vector as action count act_cnt to only generate legal action, by default doing nothing