eta_utility.eta_x.envs.no_vec_env module

class eta_utility.eta_x.envs.no_vec_env.NoVecEnv(env_fns: list[Callable])[source]

Bases: DummyVecEnv

NoVecEnv is an environment vectorizer which hands the implementation of multithreading off to the environment. The environment must specify the attribute “is_multithreaded” and set it to True. NoVecEnv will hand all actions it receives over to the environment, even if they were meant for multiple environments. Therefore, the environment has to specifically support parallel evaluation of multiple action sets.

This vectorizer is useful for environments implemented for example in julia, where we do not want to create multiple environments and could potentially implement multithreading inside the environment.

Note

The reset function of the environment should only return a single set of observations. The order in which the reset function is called will always be the same. For example, if subenvironments 5, 10 and 15 return done, the reset function will be called three times, first for environment 5, then for 10 and finally for 15.

If the environment returns done (even if it is just for a single subenvironment / action set) the reset function of the environment will be called to retrieve initial observations for each one of the done returns separately.

All other functionality is directly derived from DummyVecEnv. Since there is only a single

See also: stable_baselines3.common.vec_env.DummyVecEnv

Parameters:

env_fns – A list of functions that will create the environments (each callable returns a gymnasium.Env instance when called).

step_wait() VecEnvStepReturn[source]

Store observations and reset environments

Returns:

Tuple with stepping result sequences (observations, rewards, dones, infos)

reset() VecEnvObs[source]

Reset all sub environments and return their observations.

Returns:

Observations from all sub environments.