rlVectorEnv
R2026bDescription
Use rlVectorEnv to create a vectorized reinforcement learning
environment by supplying an environment factory function that creates a scalar MATLAB® environment. Vectorized environments use built-in vectorization features to step
and reset many environment instances in batch. This capability can improve hardware
utilization and enable higher data throughput compared to non-vectorized (that is,
single-instance, or scalar) environments. For agents that use large experience batches,
training against a vectorized environment can be much faster than training against a
corresponding scalar version of the environment. After creating the environment, call
validateEnvironment
to check that the environment is configured correctly.
Note
Vectorized environments created using rlFunctionVectorEnv
typically perform better than equivalent environments created with
rlVectorEnv.
Creation
Description
creates the vectorized reinforcement learning environment venv = rlVectorEnv(envFactoryFcn)venv using
the factory function envFactoryFcn.
also specifies the number of environment instances.venv = rlFunctionVectorEnv(envFactoryFcn,NumEnv=N)
Input Arguments
Properties
Object Functions
rlFunctionVectorEnv | Create a vectorized reinforcement learning environment using your setup, reset, and step functions |
convertToScalarEnv | Convert a vectorized environment to a scalar environment |
validateEnvironment | Validate custom reinforcement learning environment |
Examples
Limitations
Setting the
UseParalleltraining option toonis not supported with vectorized environments.Training an agent using an evolution strategy (
trainWithEvolutionStrategy) is not supported with vectorized environments.Training Q-Learning, SARSA, LSPI, PG and AC agents is not supported with vectorized environments.
Training agents with actors or critics that use recursive neural networks is not supported with vectorized environments.
Version History
Introduced in R2026b
See Also
Functions
rlFunctionVectorEnv|convertToScalarEnv|rlPredefinedEnv|validateEnvironment|getObservationInfo|getActionInfo|train|sim|rollout