4

They both seem like matrix/arrays.

I'm not much of a python guy, are these generic datatypes used within python or specific to the gym?

I'm reading through API and still confused on what these actually are.


For example (from the docs)

print(env.action_space)
#> Discrete(2)
print(env.observation_space)
#> Box(4,)

Why does the box have a trailing comma? Does this represent something.

What's the difference between the Discrete data type and Box type?

From what I've gathered the numbers inside are the dimensions.

Is Discrete analogous to an array and Box analogous to a matrix?

Tobiq
  • 2,489
  • 19
  • 38

1 Answers1

6

Discrete is a collection of actions that the agent can take, where only one can be chose at each step. There is no variability to an action in this scenario. If, for example you have an agent traversing a grid-world, an action in a discrete space might tell the agent to move forward, but the distance they will move forward is a constant.

Box defines a space in which the agent can act, and allows for variable forward distances in the gridworld scenario.

MultiDiscrete allows for multiple actions to be taken at once, similar to Box, but like Discrete, either they are taken or they are not. There is no 0.1 forward step.

Review this question for more information on how Box is used.

There isn't great built documentation that I have found, but reviewing the comments in the source code can be helpful.

Maxwell Omdal
  • 172
  • 3
  • 14