create_tournament
- negmas.tournaments.create_tournament(competitors: Sequence[str | type[Agent]], config_generator: ConfigGenerator, config_assigner: ConfigAssigner, world_generator: WorldGenerator, score_calculator: Callable[[list[World], dict[str, Any], bool], WorldRunResults], competitor_params: Sequence[dict[str, Any]] | None = None, n_competitors_per_world: int | None = None, round_robin: bool = True, agent_names_reveal_type=False, n_agents_per_competitor=1, n_configs: int = 10, max_worlds_per_config: int | None = 100, n_runs_per_world: int = 5, max_n_configs: int | None = None, n_runs_per_config: int | None = None, base_tournament_path: Path | str | None = None, total_timeout: int | None = None, parallelism='parallel', scheduler_ip: str | None = None, scheduler_port: str | None = None, non_competitors: tuple[str | Any, ...] | None = None, non_competitor_params: tuple[dict[str, Any], ...] | None = None, dynamic_non_competitors: tuple[str | Any, ...] | None = None, dynamic_non_competitor_params: tuple[dict[str, Any], ...] | None = None, exclude_competitors_from_reassignment: bool = True, name: str | None = None, verbose: bool = False, compact: bool = False, save_video_fraction: float = 0.0, forced_logs_fraction: float = 0.0, video_params=None, video_saver=None, **kwargs) Path[source]
Creates a tournament
- Parameters:
name – Tournament name
config_generator – Used to generate unique configs that will be used to evaluate competitors
config_assigner – Used to generate assignments of competitors to the configs created by the
config_generatorworld_generator – A functions to generate worlds for the tournament that follows the assignments made by the
config_assignerscore_calculator – A function for calculating the score of all agents in a world After it finishes running. The second parameter is a dict describing any scoring context that may have been added by the world config generator or assigneer. The third parameter is a boolean specifying whether this is a dry_run. For dry runs, scores are not expected but names and types should exist in the returned
WorldRunResults.competitors – A list of class names for the competitors
competitor_params – A list of competitor parameters (used to initialize the competitors).
n_competitors_per_world –
The number of competitors allowed in every world. It must be >= 1 and <= len(competitors) or None.
If None or len(competitors), then all competitors will exist in every world.
If 1, then each world will have one competitor
round_robin – Only effective if 1 < n_competitors_per_world < len(competitors). if True, all combinations will be tried otherwise n_competitors_per_world must divide len(competitors) and every competitor appears only in one set.
agent_names_reveal_type – If true then the type of an agent should be readable in its name (most likely at its beginning).
n_configs – The number of different world configs (up to competitor assignment) to be generated.
max_worlds_per_config – The maximum number of worlds to run per config. If None, then all possible assignments of competitors within each config will be tried (all permutations).
n_runs_per_world – Number of runs per world. All of these world runs will have identical competitor assignment and identical world configuration.
n_agents_per_competitor – The number of agents of each competing type to be instantiated in the world.
max_n_configs – [Depricated] The number of configs to use (it is replaced by separately setting
n_configandmax_worlds_per_config)n_runs_per_config – [Depricated] The number of runs (simulation) for every config. It is replaced by
n_runs_per_worldtotal_timeout – Total timeout for the complete process
base_tournament_path – Path at which to store all results. A new folder with the name of the tournament will be created at this path. A scores.csv file will keep the scores and logs folder will keep detailed logs
parallelism – Type of parallelism. Can be ‘serial’ for serial, ‘parallel’ for parallel and ‘distributed’ for distributed! For parallel, you can add the fraction of CPUs to use after a colon (e.g. parallel:0.5 to use half of the CPU in the machine). By defaults parallel uses all CPUs in the machine
scheduler_port – Port of the dask scheduler if parallelism is dask, dist, or distributed
scheduler_ip – IP Address of the dask scheduler if parallelism is dask, dist, or distributed
non_competitors – A list of agent types that will not be competing but will still exist in the world.
non_competitor_params – paramters of non competitor agents
dynamic_non_competitors – A list of non-competing agents that are assigned to the simulation dynamically during the creation of the final assignment instead when the configuration is created
dynamic_non_competitor_params – paramters of dynamic non competitor agents
exclude_competitors_from_reassignment – If true, copmetitors are not included in the reassignment even if they exist in
dynamic_non_competitorsverbose – Verbosity
compact – If true, compact logs will be created and effort will be made to reduce the memory footprint
save_video_fraction – The fraction of simulations for which to save videos
forced_logs_fraction – The fraction of simulations for which to always save logs. Notice that this has no effect except if no logs were to be saved otherwise (i.e.
no_logsis passed as True)video_params – The parameters to pass to the video saving function
video_saver – The parameters to pass to the video saving function after the world
kwargs – Arguments to pass to the
config_generatorfunction
- Returns:
The path at which tournament configs are stored