Dummy Vectorization

Single-Agent

class xuance.environment.vector_envs.dummy.dummy_vec_env.DummyVecEnv(env_fns, env_seed)[源代码]

基类:VecEnv

VecEnv that does runs multiple environments sequentially, that is, the step and reset commands are send to one environment at a time. Useful when debugging and when num_env == 1 (in the latter case, avoids communication overhead) :param env_fns: environment function. :param env_seed: the random seed for the first environment.

close_extras()[源代码]

Clean up the extra resources, beyond what’s in this base class. Only runs when not self.closed.

render(mode)[源代码]
reset()[源代码]

Reset all the environments and return an array of observations, or a dict of observation arrays. If step_async is still doing work, that work will be cancelled and step_wait() should not be called until step_async() is invoked again.

step_async(actions)[源代码]

Tell all the environments to start taking a step with the given actions. Call step_wait() to get the results of the step. You should not call this if a step_async run is already pending.

step_wait()[源代码]

Wait for the step taken with step_async(). Returns (obs, rews, dones, infos):

  • obs: an array of observations, or a dict of

    arrays of observations.

  • rews: an array of rewards

  • dones: an array of “episode done” booleans

  • infos: a sequence of info objects

class xuance.environment.vector_envs.dummy.dummy_vec_env.DummyVecEnv_Atari(env_fns, env_seed)[源代码]

基类:DummyVecEnv

Multi-Agent

class xuance.environment.vector_envs.dummy.dummy_vec_maenv.DummyVecEnv_Football(env_fns, env_seed)[源代码]

基类:DummyVecMultiAgentEnv

step_wait()[源代码]

Waits for the completion of asynchronous step operations and updates internal buffers with the received results.

class xuance.environment.vector_envs.dummy.dummy_vec_maenv.DummyVecEnv_StarCraft2(env_fns, env_seed)[源代码]

基类:DummyVecMultiAgentEnv

step_wait()[源代码]

Waits for the completion of asynchronous step operations and updates internal buffers with the received results.

class xuance.environment.vector_envs.dummy.dummy_vec_maenv.DummyVecMultiAgentEnv(env_fns, env_seed)[源代码]

基类:VecEnv

VecEnv that does runs multiple environments sequentially, that is, the step and reset commands are send to one environment at a time. Useful when debugging and when num_env == 1 (in the latter case, avoids communication overhead) :param env_fns – environment function.:

close_extras()[源代码]

Closes the communication with subprocesses and joins the subprocesses.

render(mode)[源代码]
reset()[源代码]

Reset the vectorized environments.

step_async(actions)[源代码]

Sends asynchronous step commands to each subprocess with the specified actions.

step_wait()[源代码]

Waits for the completion of asynchronous step operations and updates internal buffers with the received results.