This function resets the environment to its initial state, and returns the observation of the environment corresponding to the initial state.
Initial states can be always same or random per each environment’s property.
# Create the environment env = gym.make("Ant-v4", terminate_when_unhealthy=False) # Reset the environment and see the initial observation obs = env.reset() print("The initial observation is {}".format(obs)) # Sample a random action from the entire action space random_action = env.action_space.sample() # Take the action and get the new observation space new_obs, reward, done, info = env.step(random_action) print("The new observation is {}".format(new_obs)) print("The reward is {}".format(reward)) print("Is the environment terminated?: {}".format(done)) print("Additional informations: {}".format(info))