How to create action space in GYM with only two values 0 or 1

Viewed 27

I want an action space which will have only 2 values of 0 or 1.

I have created using the following code.

from gym import spaces
import numpy as np
space = spaces.Box(np.array([0]),np.array([1]))
print(space.sample())

But when I print(space.sample()) I am getting real values between 0 or 1 (eg:0.6789) but it should give me either 0 or 1.

Can someone help me with it?

0 Answers
Related