RAYRL Parser#
RLlib Argument Parsing Utilities Module#
This module provides utility functions for parsing command-line arguments for RLlib-based scripts. It is adapted from the RAYRL library to include custom configurations and parameters specific to the influencer games project.
The modifications are tailored to support multi-agent reinforcement learning experiments in the context of influencer games, with additional arguments and configurations unique to this domain.
Features:#
Adds RLlib-typical example script arguments.
Supports custom configurations for multi-agent reinforcement learning experiments.
Includes domain-specific parameters for resource distribution and influence modeling.
Dependencies:#
InflGame.utils
InflGame.domains
Usage:#
The add_rl_example_script_args function adds RLlib-typical example script arguments to a parser, allowing for customization of reinforcement learning experiments in the influencer games framework.
Example:#
import argparse
from InflGame.MARL.utils.my_parse import add_rl_example_script_args
# Create a parser and add RLlib arguments
parser = argparse.ArgumentParser()
parser = add_rl_example_script_args(parser)
# Parse arguments
args = parser.parse_args()
# Access parsed arguments
print("Algorithm:", args.algo)
print("Number of agents:", args.num_agents)
print("Domain type:", args.domain_type)
print("Initial positions:", args.initial_position)
Functions
- InflGame.MARL.utils.my_parse.add_rl_example_script_args(parser=None, default_reward=100.0, default_iters=200, default_timesteps=100000)#
Adds RLlib-typical (and common) example script command line arguments to a parser.
Note
This function should be used by most of our example scripts, which already mostly have this logic in them (but written out).
- Parameters:
parser (Optional[argparse.ArgumentParser]) – The parser to add the arguments to. If None, create a new one.
default_reward (float) – The default value for the
--stop-rewardoption.default_iters (int) – The default value for the
--stop-itersoption.default_timesteps (int) – The default value for the
--stop-timestepsoption.
- Returns:
The altered (or newly created) parser object.
- Return type:
argparse.ArgumentParser