How can I change observation states' values in OpenAI gym's cartpole environment?
I don't recommend changing the rules of the environment.
What you could do:
Perform a method called bucketing i.e. take a value from a continuous state space see which discrete bucket it should go into and then let your agent use the bucket number as the observation.
e.g. Say I do have a continuous state space with one variable in range $[-\infty,\infty]$
The buckets can be as follows:
0). x &lt; -1000
1). -1000 $\le$ x $&lt;$ -500
2). -500 $\le$ x $&lt;$ -100
3). -100 $\le$ x $&lt;$ -50
4). -50 $\le$ x $&lt;$ 0
5). 0 $\le$ x $&lt;$ 50
6). 50 $\le$ x $&lt;$ 100
7). 100 $\le$ x $&lt;$ 500
8). 500 $\le$ x $&lt;$ 1000
9). x &gt; 1000
Therefore in this example scenario there are 9 buckets. Hence, the observations can be in range [0, 9] discretely.