cartesian_tournament

negmas.tournaments.cartesian_tournament(competitors, scenarios, private_infos=None, competitor_params=None, rotate_ufuns=True, rotate_private_infos=True, n_repetitions=1, path=None, njobs=0, mechanism_type=<class 'negmas.sao.mechanism.SAOMechanism'>, mechanism_params=None, n_steps=100, time_limit=None, pend=0.0, pend_per_second=0.0, step_time_limit=None, negotiator_time_limit=None, hidden_time_limit=None, external_timeout=None, plot_fraction=0.0, plot_params=None, verbosity=1, self_play=True, randomize_runs=True, sort_runs=False, save_every=0, save_stats=True, save_scenario_figs=True, final_score=('advantage', 'mean'), id_reveals_type=False, name_reveals_type=True, shorten_names=True, raise_exceptions=True, mask_scenario_names=True, only_failures_on_self_play=False)[source]

A simplified version of Cartesian tournaments not using the internal machinay of NegMAS tournaments

Parameters:
  • competitors (list[type[Negotiator] | str] | tuple[type[Negotiator] | str, ...]) – A tuple of the competing negotiator types.

  • scenarios (list[Scenario] | tuple[Scenario, ...]) – A tuple of base scenarios to use for the tournament.

  • competitor_params (Optional[Sequence[dict | None]]) – Either None for no-parameters or a tuple of dictionaries with parameters to initialize the competitors (in order).

  • private_infos (list[None | tuple[dict, ...]] | None) – If given, a list of the same length as scenarios. Each item is a tuple giving the private information to be passed to every negotiator in every scenario.

  • rotate_ufuns (bool) – If True, the ufuns will be rotated over negotiator positions (for bilateral negotiation this leads to two scenarios for each input scenario with reversed ufun order).

  • rotate_private_infos (bool) – If True and rotate_ufuns is also True, private information will be rotated with the utility functions.

  • n_repetitions (int) – Number of times to repeat each scenario/partner combination

  • path (Path | None) – Path on disk to save the results and details of this tournament. Pass None to disable logging

  • n_jobs – Number of parallel jobs to run. -1 means running serially (useful for debugging) and 0 means using all cores.

  • mechanism_type (type[Mechanism]) – The mechanism (protocol) used for all negotiations.

  • n_steps (int | tuple[int, int] | None) – Number of steps/rounds allowed for the each negotiation (None for no-limit and a 2-valued tuple for sampling from a range)

  • time_limit (float | tuple[float, float] | None) – Number of seconds allowed for the each negotiation (None for no-limit and a 2-valued tuple for sampling from a range)

  • pend (float | tuple[float, float]) – Probability of ending the negotiation every step/round (None for no-limit and a 2-valued tuple for sampling from a range)

  • pend_per_second (float | tuple[float, float]) – Probability of ending the negotiation every second (None for no-limit and a 2-valued tuple for sampling from a range)

  • step_time_limit (float | tuple[float, float] | None) – Time limit for every negotiation step (None for no-limit and a 2-valued tuple for sampling from a range)

  • negotiator_time_limit (float | tuple[float, float] | None) – Time limit for all actions of every negotiator (None for no-limit and a 2-valued tuple for sampling from a range)

  • hidden_time_limit (float | tuple[float, float] | None) – Time limit for negotiations that is not known to the negotiators

  • external_timeout (int | None) – A timeout applied directly to reception of results from negotiations in parallel runs only.

  • mechanism_params (dict[str, Any] | None) – Parameters of the mechanism (protocol). Usually you need to pass one or more of the following: time_limit (in seconds), n_steps (in rounds), p_ending (probability of ending the negotiation every step).

  • plot_fraction (float) – fraction of negotiations for which plots are to be saved (only if path is not None)

  • plot_params (dict[str, Any] | None) – Parameters to pass to the plotting function

  • verbosity (int) – Verbosity level (minimum is 0)

  • self_play (bool) – Allow negotiations in which all partners are of the same type

  • only_failures_on_self_play (bool) – If given, self-play runs will only be recorded if they fail to reach agreement. This is useful if you want to keep self-play but still penalize strategies for failing to reach agreements in self-play

  • randomize_runs (bool) – If True negotiations will be run in random order, otherwise each scenario/partner combination will be finished before starting on the next

  • save_every (int) – Number of negotiations after which we dump details and scores

  • save_stats (bool) – Whether to calculate and save extra statistics like pareto_optimality, nash_optimality, kalai-smorodinsky optimality (ks_optimality), kalai_optimality, etc

  • save_scenario_figs (bool) – Whether to save a png of the scenario represented in the utility domain for every scenario.

  • final_score (tuple[str, str]) – A tuple of two strings giving the metric used for ordering the negotiators for the final score: First string can be one of the following (advantage, utility, partner_welfare, welfare) or any statistic from the set calculated if save_stats is True. The second string can be mean, median, min, max, or std. The default is (‘advantage’, ‘mean’)

  • id_reveals_type (bool) – Each negotiator ID will reveal its type.

  • name_reveals_type (bool) – Each negotiator name will reveal its type.

  • shorten_names (bool) – If True, shorter versions of names will be used for results

  • raise_exceptions (bool) – When given, negotiators and mechanisms are allowed to raise exceptions stopping the tournament

  • mask_scenario_names (bool) – If given, scenario names will be masked so that the negotiators do not know the original scenario name

Return type:

SimpleTournamentResults

Returns:

A pandas DataFrame with all negotiation results.