Vectorized environments
One of the very interesting and useful features of Stable Baselines is that we can train our agent in multiple independent environments either in separate processes (using SubprocVecEnv) or in the same process (using DummyVecEnv).
For example, say we are training our agent in a cart pole balancing environment – instead of training our agent only in a single cart pole balancing environment, we can train our agent in the multiple cart pole balancing environments.
We generally train our agent in a single environment per step but now we can train our agent in multiple environments per step. This helps our agent to learn more quickly. Now, our state, action, reward, and done will be in the form of a vector since we are training our agent in multiple environments. So, we call this a vectorized environment.
There are two types of vectorized environment offered by Stable Baselines:
- SubprocVecEnv
- DummyVecEnv