city_of_gold.vec.runner

Vectorized runners

Members

class city_of_gold.vec.runner.vec_runner_1

Bases: pybind11_object

Threaded game runner for 1 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_1) – The vector of environments to run

  • sampler (vec_sampler_1) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_1) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_1) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_1) city_of_gold.vec.env.vec_cog_env_1

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_1

get_n_threads(self: city_of_gold.vec.runner.vec_runner_1) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_1) city_of_gold.vec.sampler.vec_sampler_1

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_1

make_samplers(self: city_of_gold.vec.runner.vec_runner_1, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_1

sample(self: city_of_gold.vec.runner.vec_runner_1) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_1) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_1) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_1) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_1) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_1) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_1) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_1) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_128

Bases: pybind11_object

Threaded game runner for 128 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_128) – The vector of environments to run

  • sampler (vec_sampler_128) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_128) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_128) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_128) city_of_gold.vec.env.vec_cog_env_128

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_128

get_n_threads(self: city_of_gold.vec.runner.vec_runner_128) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_128) city_of_gold.vec.sampler.vec_sampler_128

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_128

make_samplers(self: city_of_gold.vec.runner.vec_runner_128, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_128

sample(self: city_of_gold.vec.runner.vec_runner_128) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_128) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_128) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_128) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_128) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_128) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_128) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_128) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_16

Bases: pybind11_object

Threaded game runner for 16 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_16) – The vector of environments to run

  • sampler (vec_sampler_16) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_16) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_16) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_16) city_of_gold.vec.env.vec_cog_env_16

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_16

get_n_threads(self: city_of_gold.vec.runner.vec_runner_16) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_16) city_of_gold.vec.sampler.vec_sampler_16

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_16

make_samplers(self: city_of_gold.vec.runner.vec_runner_16, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_16

sample(self: city_of_gold.vec.runner.vec_runner_16) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_16) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_16) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_16) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_16) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_16) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_16) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_16) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_2

Bases: pybind11_object

Threaded game runner for 2 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_2) – The vector of environments to run

  • sampler (vec_sampler_2) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_2) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_2) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_2) city_of_gold.vec.env.vec_cog_env_2

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_2

get_n_threads(self: city_of_gold.vec.runner.vec_runner_2) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_2) city_of_gold.vec.sampler.vec_sampler_2

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_2

make_samplers(self: city_of_gold.vec.runner.vec_runner_2, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_2

sample(self: city_of_gold.vec.runner.vec_runner_2) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_2) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_2) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_2) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_2) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_2) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_2) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_2) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_256

Bases: pybind11_object

Threaded game runner for 256 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_256) – The vector of environments to run

  • sampler (vec_sampler_256) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_256) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_256) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_256) city_of_gold.vec.env.vec_cog_env_256

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_256

get_n_threads(self: city_of_gold.vec.runner.vec_runner_256) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_256) city_of_gold.vec.sampler.vec_sampler_256

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_256

make_samplers(self: city_of_gold.vec.runner.vec_runner_256, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_256

sample(self: city_of_gold.vec.runner.vec_runner_256) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_256) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_256) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_256) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_256) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_256) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_256) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_256) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_3

Bases: pybind11_object

Threaded game runner for 3 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_3) – The vector of environments to run

  • sampler (vec_sampler_3) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_3) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_3) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_3) city_of_gold.vec.env.vec_cog_env_3

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_3

get_n_threads(self: city_of_gold.vec.runner.vec_runner_3) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_3) city_of_gold.vec.sampler.vec_sampler_3

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_3

make_samplers(self: city_of_gold.vec.runner.vec_runner_3, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_3

sample(self: city_of_gold.vec.runner.vec_runner_3) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_3) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_3) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_3) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_3) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_3) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_3) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_3) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_32

Bases: pybind11_object

Threaded game runner for 32 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_32) – The vector of environments to run

  • sampler (vec_sampler_32) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_32) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_32) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_32) city_of_gold.vec.env.vec_cog_env_32

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_32

get_n_threads(self: city_of_gold.vec.runner.vec_runner_32) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_32) city_of_gold.vec.sampler.vec_sampler_32

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_32

make_samplers(self: city_of_gold.vec.runner.vec_runner_32, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_32

sample(self: city_of_gold.vec.runner.vec_runner_32) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_32) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_32) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_32) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_32) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_32) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_32) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_32) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_4

Bases: pybind11_object

Threaded game runner for 4 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_4) – The vector of environments to run

  • sampler (vec_sampler_4) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_4) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_4) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_4) city_of_gold.vec.env.vec_cog_env_4

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_4

get_n_threads(self: city_of_gold.vec.runner.vec_runner_4) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_4) city_of_gold.vec.sampler.vec_sampler_4

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_4

make_samplers(self: city_of_gold.vec.runner.vec_runner_4, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_4

sample(self: city_of_gold.vec.runner.vec_runner_4) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_4) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_4) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_4) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_4) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_4) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_4) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_4) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_5

Bases: pybind11_object

Threaded game runner for 5 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_5) – The vector of environments to run

  • sampler (vec_sampler_5) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_5) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_5) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_5) city_of_gold.vec.env.vec_cog_env_5

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_5

get_n_threads(self: city_of_gold.vec.runner.vec_runner_5) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_5) city_of_gold.vec.sampler.vec_sampler_5

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_5

make_samplers(self: city_of_gold.vec.runner.vec_runner_5, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_5

sample(self: city_of_gold.vec.runner.vec_runner_5) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_5) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_5) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_5) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_5) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_5) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_5) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_5) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_6

Bases: pybind11_object

Threaded game runner for 6 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_6) – The vector of environments to run

  • sampler (vec_sampler_6) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_6) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_6) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_6) city_of_gold.vec.env.vec_cog_env_6

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_6

get_n_threads(self: city_of_gold.vec.runner.vec_runner_6) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_6) city_of_gold.vec.sampler.vec_sampler_6

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_6

make_samplers(self: city_of_gold.vec.runner.vec_runner_6, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_6

sample(self: city_of_gold.vec.runner.vec_runner_6) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_6) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_6) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_6) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_6) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_6) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_6) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_6) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_64

Bases: pybind11_object

Threaded game runner for 64 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_64) – The vector of environments to run

  • sampler (vec_sampler_64) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_64) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_64) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_64) city_of_gold.vec.env.vec_cog_env_64

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_64

get_n_threads(self: city_of_gold.vec.runner.vec_runner_64) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_64) city_of_gold.vec.sampler.vec_sampler_64

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_64

make_samplers(self: city_of_gold.vec.runner.vec_runner_64, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_64

sample(self: city_of_gold.vec.runner.vec_runner_64) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_64) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_64) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_64) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_64) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_64) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_64) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_64) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_7

Bases: pybind11_object

Threaded game runner for 7 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_7) – The vector of environments to run

  • sampler (vec_sampler_7) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_7) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_7) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_7) city_of_gold.vec.env.vec_cog_env_7

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_7

get_n_threads(self: city_of_gold.vec.runner.vec_runner_7) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_7) city_of_gold.vec.sampler.vec_sampler_7

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_7

make_samplers(self: city_of_gold.vec.runner.vec_runner_7, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_7

sample(self: city_of_gold.vec.runner.vec_runner_7) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_7) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_7) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_7) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_7) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_7) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_7) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_7) None

Wakes up all worker threads to poll for new tasks.

Returns:

None

class city_of_gold.vec.runner.vec_runner_8

Bases: pybind11_object

Threaded game runner for 8 environments.

Provides threaded wrappers to stepping environments in parallel, and to sampling random actions for benchmarking performance. Spawns threads that each are responsible for processing a continuous batch of environments.

Parameters:
  • env (vec_cog_env_8) – The vector of environments to run

  • sampler (vec_sampler_8) – The vector of environments to run

  • n_threads (unsigned int) – Number of worker threads to spawn

Returns:

The runner instance.

get_action_masks(self: city_of_gold.vec.runner.vec_runner_8) numpy.ndarray[city_of_gold.ActionMask]

Get an immutable reference to action masks of currently active players

Returns:

The action masks of currently active players

Return type:

numpy.ndarray of ActionMask

get_actions(self: city_of_gold.vec.runner.vec_runner_8) numpy.ndarray[city_of_gold.ActionData]

Get a mutable reference to the underlying array of actions.

Custom agents need to write to this array for their actions to be processed when advancing the environments via the step() function.

Returns:

Mutable reference to the action array read from when stepping the environments and written to when sampling actions

Return type:

numpy.ndarray of ActionData

get_envs(self: city_of_gold.vec.runner.vec_runner_8) city_of_gold.vec.env.vec_cog_env_8

Get a mutable reference to the underlying array of environments.

Returns:

Reference to the environments managed by this object

Return type:

vec_cog_env_8

get_n_threads(self: city_of_gold.vec.runner.vec_runner_8) int

Get the number of workers.

Returns:

Number of workers spawned by this object

Return type:

unsigned int

get_samplers(self: city_of_gold.vec.runner.vec_runner_8) city_of_gold.vec.sampler.vec_sampler_8

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_8

make_samplers(self: city_of_gold.vec.runner.vec_runner_8, seed: int) None

Get a mutable reference to the underlying array of action samplers.

Returns:

Reference to the samplers managed by this object

Return type:

vec_sampler_8

sample(self: city_of_gold.vec.runner.vec_runner_8) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.Contrary to the sequential sample_seq(), sampling is performed in parallel. The indices sampled by each thread are guaranteed to match the environments processed by the thread when step() is called. No thread synchronization is applied automatically.

Returns:

None

sample_seq(self: city_of_gold.vec.runner.vec_runner_8) None

Generate a uniform sample of the valid action space for each environment.

Update the contents of actions with a new sample masked using the current action masks of the managed environments.

Returns:

None

sleep(self: city_of_gold.vec.runner.vec_runner_8) None

Releases worker threads from busy waiting.

Returns:

None

start_workers(self: city_of_gold.vec.runner.vec_runner_8) None

Start worker threads for parallel execution

Returns:

None

step(self: city_of_gold.vec.runner.vec_runner_8) None

Advance the environment state according to set actions

Contrary to the sequential step_seq(), stepping is performed in parallel. Each worker thread processes \(x\) consecutive environments, where

\[\frac{n_{\text{envs}}}{n_{\text{threads}}} < x < \frac{n_{\text{envs}}}{n_{\text{threads}}} + 1\]

Synchronizes environments with the main thread before returning. Each worker is guaranteed to always step and sample actions of the same environments.

Returns:

None

step_seq(self: city_of_gold.vec.runner.vec_runner_8) None

Sequentially advance the environment states according to set actions

Returns:

None

sync(self: city_of_gold.vec.runner.vec_runner_8) None

Blocks the main thread until all workers have finished all queued tasks.

Returns:

None

wake(self: city_of_gold.vec.runner.vec_runner_8) None

Wakes up all worker threads to poll for new tasks.

Returns:

None