Rl
This namespace provides various reinforcement learning utilities.
AliveBonusScheduleWrapper
¶
Bases: Wrapper
A Wrapper which awards the agent for being alive in a scheduled manner This wrapper is meant to be used for non-vectorized environments.
Source code in evotorch/neuroevolution/net/rl.py
__init__(env, alive_bonus_schedule, **kwargs)
¶
__init__(...)
: Initialize the AliveBonusScheduleWrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Env
|
Environment to wrap. |
required |
alive_bonus_schedule
|
tuple
|
If given as a tuple |
required |
kwargs
|
Expected in the form of additional keyword arguments, these will be passed to the initialization method of the superclass. |
{}
|
Source code in evotorch/neuroevolution/net/rl.py
reset_env(env)
¶
Reset a gymnasium environment.
Even though the gymnasium
library switched to a new API where the
reset()
method returns a tuple (observation, info)
, this function
follows the conventions of the classical gym
library and returns
only the observation of the newly reset environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Env
|
The gymnasium environment which will be reset. |
required |
Source code in evotorch/neuroevolution/net/rl.py
take_step_in_env(env, action)
¶
Take a step in the gymnasium environment. Taking a step means performing the action provided via the arguments.
Even though the gymnasium
library switched to a new API where the
step()
method returns a 5-element tuple of the form
(observation, reward, terminated, truncated, info)
, this function
follows the conventions of the classical gym
library and returns
a 4-element tuple (observation, reward, done, info)
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Env
|
The gymnasium environment in which the action will be performed. |
required |
action
|
Iterable
|
The action to be performed. |
required |