"SimulatedCartPole" (Reinforcement Learning Environment)

"SimulatedCartPole" is a reinforcement learning environment consisting of a weighted pole attached to a hinge on a cart, which moves along a frictionless track. A force can be applied to the cart in the Left or the Right direction at every time step. The goal is for an agent to apply appropriate forces to the cart to prevent the pole from falling over. A reward of +1 is provided at every time step where the pole is upright. The episode is considered ended when the pole is more than 15 degrees from vertical, or the cart moves more than 2.4 units from the center.

"SimulatedCartPole" corresponds to the version of the cart-pole problem described by Barto et al., 1983. It is also identical to the OpenAI Gym implementation "CartPole-v1".

A pole attached to a moving cart via a hinge.

Examples

Basic Examples  (2)

Open the "SimulatedCartPole" environment:

In[1]:=
Click for copyable input
Out[1]=

Observe the initial state:

In[2]:=
Click for copyable input
Out[2]=

Visualize the environment:

In[3]:=
Click for copyable input
Out[3]=

Obtain a random action:

In[4]:=
Click for copyable input
Out[4]=

Take the random action:

In[5]:=
Click for copyable input
Out[5]=

Taking an action usually modifies the "ObservedState":

In[6]:=
Click for copyable input
Out[6]=

Reset the environment to an initial state. The initial "ObservedState" is returned:

In[7]:=
Click for copyable input
Out[7]=

Close the environment:

In[8]:=
Click for copyable input

Open the "SimulatedCartPole" environment:

In[1]:=
Click for copyable input
Out[1]=

Visualize a random agent controlling the cart:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=