Main Content

Environments

Model the dynamics and output of a reinforcement learning environment

In a reinforcement learning scenario, the environment models the world with which the agent interacts.

Reinforcement Learning Toolbox™ provides predefined objects that implement different benchmark environments. You can also create your own environments using custom functions for the environment dynamics, modifying an existing environment template class, or using a Simulink® model.

For an introduction to reinforcement learning environments, see Reinforcement Learning Environments.

Functions

expand all

rlFiniteSetSpecCreate specifications object for a finite-set action or observation channel
rlNumericSpecCreate specifications object for a numeric action or observation channel
getActionInfoObtain action data specifications from reinforcement learning environment, agent, or experience buffer
getObservationInfoObtain observation data specifications from reinforcement learning environment, agent, or experience buffer
validateEnvironmentValidate custom reinforcement learning environment
bus2RLSpecCreate reinforcement learning data specifications for elements of a Simulink bus
createGridWorldCreate a two-dimensional grid world for reinforcement learning
createMDPCreate Markov decision process model
rlMDPEnvCreate Markov decision process environment for reinforcement learning
rlPredefinedEnvCreate a predefined reinforcement learning environment
generateRewardFunctionGenerate a reward function from control specifications to train a reinforcement learning agent (Since R2021b)
exteriorPenaltyExterior penalty value for a point with respect to a bounded region (Since R2021b)
hyperbolicPenaltyHyperbolic penalty value for a point with respect to a bounded region (Since R2021b)
barrierPenaltyLogarithmic barrier penalty value for a point with respect to a bounded region (Since R2021b)
rlFunctionEnvCreate custom reinforcement learning environment using your reset and step functions
rlMultiAgentFunctionEnvCreate custom multiagent reinforcement learning environment (Since R2023b)
rlTurnBasedFunctionEnvCreate custom turn-based multiagent reinforcement learning environment (Since R2023b)
rlCreateEnvTemplateCreate custom reinforcement learning environment template
rlSimulinkEnvCreate environment object from a Simulink model already containing agent and environment
createIntegratedEnvCreate environment object from a Simulink environment model that does not contain an agent block
SimulinkEnvWithAgentReinforcement learning environment with a dynamic model implemented in Simulink
bus2RLSpecCreate reinforcement learning data specifications for elements of a Simulink bus
validateEnvironmentValidate custom reinforcement learning environment
rlNeuralNetworkEnvironmentEnvironment model with deep neural network transition models (Since R2022a)
rlContinuousDeterministicTransitionFunctionDeterministic transition function approximator object for neural network-based environment (Since R2022a)
rlContinuousGaussianTransitionFunctionStochastic Gaussian transition function approximator object for neural network-based environment (Since R2022a)
rlContinuousDeterministicRewardFunctionDeterministic reward function approximator object for neural network-based environment (Since R2022a)
rlContinuousGaussianRewardFunctionStochastic Gaussian reward function approximator object for neural network-based environment (Since R2022a)
rlIsDoneFunctionIs-done function approximator object for neural network-based environment (Since R2022a)
predictPredict next observation, next reward, or episode termination given observation and action input data (Since R2022a)
evaluateEvaluate function approximator object given observation (or observation-action) input data (Since R2022a)
accelerate (Not recommended) Option to accelerate computation of gradient for approximator object based on neural network (Since R2022a)
resetReset environment, agent, experience buffer, or policy object (Since R2022a)
setupSet up reinforcement learning environment or initialize data logger object (Since R2022a)
cleanupClean up reinforcement learning environment or data logger object (Since R2022a)

Blocks

RL AgentReinforcement learning agent

Topics

Introduction to Reinforcement Learning Environments

Grid World Environments

Predefined Control System Environments

Custom MATLAB Environments

Custom Simulink Environments

Load Environments in Reinforcement Learning Designer