ray.rllib.core.rl_module.marl_module.MultiAgentRLModuleSpec#

class ray.rllib.core.rl_module.marl_module.MultiAgentRLModuleSpec(marl_module_class: Type[ray.rllib.core.rl_module.marl_module.MultiAgentRLModule] = <class 'ray.rllib.core.rl_module.marl_module.MultiAgentRLModule'>, module_specs: Optional[Union[ray.rllib.core.rl_module.rl_module.SingleAgentRLModuleSpec, Dict[str, ray.rllib.core.rl_module.rl_module.SingleAgentRLModuleSpec]]] = None)[source]#

Bases: object

A utility spec class to make it constructing MARL modules easier.

Users can extend this class to modify the behavior of base class. For example to share neural networks across the modules, the build method can be overriden to create the shared module first and then pass it to custom module classes that would then use it as a shared module.

Parameters
  • marl_module_class – The class of the multi-agent RLModule to construct. By default it is set to MultiAgentRLModule class. This class simply loops throught each module and calls their foward methods.

  • module_specs – The module specs for each individual module. It can be either a SingleAgentRLModuleSpec used for all module_ids or a dictionary mapping from module IDs to SingleAgentRLModuleSpecs for each individual module.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

Methods

add_modules(module_specs[, overwrite])

Add new module specs to the spec or updates existing ones.

build([module_id])

Builds either the multi-agent module or the single-agent module.

from_dict(d)

Creates a MultiAgentRLModuleSpec from a dictionary.

from_module(module)

Creates a MultiAgentRLModuleSpec from a MultiAgentRLModule.

get_marl_config()

Returns the MultiAgentRLModuleConfig for this spec.

to_dict()

Converts the MultiAgentRLModuleSpec to a dictionary.

update(other[, overwrite])

Updates this spec with the other spec.

Attributes

module_specs