scml.scml2019.utils19

Module Contents

Classes

DefaultGreedyManager

The default factory manager that will be implemented by the committee of ANAC-SCML 2019

Functions

anac2019_world(, params, Any]] =, randomize, ...[, ...])

Creates a world compatible with the ANAC 2019 competition. Note that

balance_calculator(→ negmas.tournaments.WorldRunResults)

A scoring function that scores factory managers' performance by the final balance only ignoring whatever still

anac2019_tournament(...)

The function used to run ANAC 2019 SCML tournament (collusion track).

anac2019_std(...)

The function used to run ANAC 2019 SCML tournament (standard track).

anac2019_collusion(...)

The function used to run ANAC 2019 SCML tournament (collusion track).

anac2019_sabotage(...)

The function used to run ANAC 2019 SCML tournament (collusion track).

class scml.scml2019.utils19.DefaultGreedyManager(*args, reserved_value=0.0, negotiator_params=None, optimism=0.0, negotiator_type=DEFAULT_NEGOTIATOR, n_retrials=5, use_consumer=True, reactive=True, sign_only_guaranteed_contracts=False, riskiness=0.0, max_insurance_premium: float = float('inf'), **kwargs)[source]

Bases: scml.scml2019.factory_managers.builtins.GreedyFactoryManager

The default factory manager that will be implemented by the committee of ANAC-SCML 2019

scml.scml2019.utils19.anac2019_world(competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] = (), params: Sequence[Dict[str, Any]] = (), randomize: bool = True, log_file_name: str = None, name: str = None, agent_names_reveal_type: bool = False, n_intermediate: Tuple[int, int] = (1, 4), n_miners=5, n_factories_per_level=11, n_agents_per_competitor=1, n_consumers=5, n_lines_per_factory=10, guaranteed_contracts=False, use_consumer=True, max_insurance_premium=float('inf'), n_retrials=5, negotiator_type: str = DEFAULT_NEGOTIATOR, transportation_delay=0, default_signing_delay=0, max_storage=sys.maxsize, consumption_horizon=15, consumption=(3, 5), negotiation_speed=21, neg_time_limit=60 * 4, neg_n_steps=20, n_steps=100, time_limit=90 * 90, n_default_per_level: int = 5, compact: bool = False, **kwargs) scml.scml2019.world.SCML2019World[source]

Creates a world compatible with the ANAC 2019 competition. Note that

Parameters:
  • n_agents_per_competitor – Number of instantiations of each competing type.

  • name – SCML2020World name to use

  • agent_names_reveal_type – If true, a snake_case version of the agent_type will prefix agent names

  • randomize – If true, managers are assigned to factories randomly otherwise in the order

  • giving (they are) –

  • n_intermediate

  • n_default_per_level

  • competitors – A list of class names for the competitors

  • params – A list of dictionaries giving parameters to pass to the competitors

  • n_miners – number of miners of the single raw material

  • n_factories_per_level – number of factories at every production level

  • n_consumers – number of consumers of the final product

  • n_steps – number of simulation steps

  • n_lines_per_factory – number of lines in each factory

  • negotiation_speed – The number of negotiation steps per simulation step. None means infinite

  • default_signing_delay – The number of simulation between contract conclusion and signature

  • neg_n_steps – The maximum number of steps of a single negotiation (that is double the number of rounds)

  • neg_time_limit – The total time-limit of a single negotiation

  • time_limit – The total time-limit of the simulation

  • transportation_delay – The transportation delay

  • n_retrials – The number of retrials the Miner and GreedyFactoryManager will try if negotiations fail

  • max_insurance_premium – The maximum insurance premium accepted by GreedyFactoryManager (-1 to disable)

  • use_consumer – If true, the GreedyFactoryManager will use an internal consumer for buying its needs

  • guaranteed_contracts – If true, the GreedyFactoryManager will only sign contracts that it can guaratnee not to

  • break.

  • consumption_horizon – The number of steps for which Consumer publishes CFP s

  • consumption – The consumption schedule will be sampled from a uniform distribution with these limits inclusive

  • log_file_name – File name to store the logs

  • negotiator_type – The negotiation factory used to create all negotiators

  • max_storage – maximum storage capacity for all factory managers If None then it is unlimited

  • compact – If True, then compact logs will be created to reduce memory footprint

  • kwargs – key-value pairs to be passed as argument to chain_world() and then to SCML2019World()

Returns:

SCML2019World ready to run

Remarks:

  • Every production level n has one process only that takes n steps to complete

scml.scml2019.utils19.balance_calculator(worlds: List[scml.scml2019.world.SCML2019World], scoring_context: Dict[str, Any], dry_run: bool, ignore_default=True) negmas.tournaments.WorldRunResults[source]

A scoring function that scores factory managers’ performance by the final balance only ignoring whatever still in their inventory.

Parameters:
  • worlds – The world which is assumed to be run up to the point at which the scores are to be calculated.

  • scoring_context – A dict of context parameters passed by the world generator or assigner.

  • dry_run – A boolean specifying whether this is a dry_run. For dry runs, only names and types are expected in the returned WorldRunResults

Returns:

WorldRunResults giving the names, scores, and types of factory managers.

scml.scml2019.utils19.anac2019_tournament(competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]], agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: int = 1000, n_runs_per_world: int = 5, n_agents_per_competitor: int = 5, tournament_path: str = None, total_timeout: int | None = None, parallelism='parallel', scheduler_ip: str | None = None, scheduler_port: str | None = None, tournament_progress_callback: Callable[[negmas.tournaments.WorldRunResults | None], None] = None, world_progress_callback: Callable[[scml.scml2019.world.SCML2019World | None], None] = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) negmas.tournaments.TournamentResults | os.PathLike[source]

The function used to run ANAC 2019 SCML tournament (collusion track).

Parameters:
  • name – Tournament name

  • competitors – A list of class names for the competitors

  • 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 – Number of agents per competitor

  • total_timeout – Total timeout for the complete process

  • tournament_path – Path at which to store all results. 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

  • 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

  • world_progress_callback – A function to be called after everystep of every world run (only allowed for serial evaluation and should be used with cautious).

  • tournament_progress_callback – A function to be called with WorldRunResults after each world finished processing

  • verbose – Verbosity

  • configs_only – If true, a config file for each

  • compact – If true, effort will be made to reduce memory footprint including disableing most logs

  • kwargs – Arguments to pass to the world_generator function

Returns:

TournamentResults The results of the tournament or a PathLike giving the location where configs were saved

Remarks:

Default parameters will be used in the league with the exception of parallelism which may use distributed processing

scml.scml2019.utils19.anac2019_std(competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]], competitor_params: Sequence[Dict[str, Any]] | None = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: int | None = 1000, n_runs_per_world: int = 5, min_factories_per_level: int = 5, tournament_path: str = None, total_timeout: int | None = None, parallelism='parallel', scheduler_ip: str | None = None, scheduler_port: str | None = None, tournament_progress_callback: Callable[[negmas.tournaments.WorldRunResults | None], None] = None, world_progress_callback: Callable[[scml.scml2019.world.SCML2019World | None], None] = None, non_competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] | None = None, non_competitor_params: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] | None = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) negmas.tournaments.TournamentResults | os.PathLike[source]

The function used to run ANAC 2019 SCML tournament (standard track).

Parameters:
  • name – Tournament name

  • competitors – A list of class names for the competitors

  • competitor_params – A list of competitor parameters (used to initialize the competitors).

  • 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.

  • min_factories_per_level – Minimum number of factories for each production level

  • total_timeout – Total timeout for the complete process

  • tournament_path – Path at which to store all results. 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

  • 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

  • world_progress_callback – A function to be called after everystep of every world run (only allowed for serial evaluation and should be used with cautious).

  • tournament_progress_callback – A function to be called with WorldRunResults after each world finished processing

  • non_competitors – A list of agent types that will not be competing in the sabotage competition but will exist in the world

  • non_competitor_params – parameters of non competitor agents

  • verbose – Verbosity

  • configs_only – If true, a config file for each

  • compact – If true, compact logs will be created and effort will be made to reduce the memory footprint

  • kwargs – Arguments to pass to the world_generator function

Returns:

TournamentResults The results of the tournament or a PathLike giving the location where configs were saved

Remarks:

Default parameters will be used in the league with the exception of parallelism which may use distributed processing

scml.scml2019.utils19.anac2019_collusion(competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]], competitor_params: Sequence[Dict[str, Any]] | None = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: int | None = 1000, n_runs_per_world: int = 5, n_agents_per_competitor: int = 5, min_factories_per_level: int = 5, tournament_path: str = None, total_timeout: int | None = None, parallelism='parallel', scheduler_ip: str | None = None, scheduler_port: str | None = None, tournament_progress_callback: Callable[[negmas.tournaments.WorldRunResults | None], None] | None = None, world_progress_callback: Callable[[scml.scml2019.world.SCML2019World | None], None] | None = None, non_competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] | None = None, non_competitor_params: Sequence[Dict[str, Any]] | None = None, name: str | None = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) negmas.tournaments.TournamentResults | os.PathLike[source]

The function used to run ANAC 2019 SCML tournament (collusion track).

Parameters:
  • name – Tournament name

  • competitors – A list of class names for the competitors

  • competitor_params – A list of competitor parameters (used to initialize the competitors).

  • 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 – Number of agents per competitor

  • min_factories_per_level – Minimum number of factories for each production level

  • total_timeout – Total timeout for the complete process

  • tournament_path – Path at which to store all results. 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

  • 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

  • world_progress_callback – A function to be called after everystep of every world run (only allowed for serial evaluation and should be used with cautious).

  • tournament_progress_callback – A function to be called with WorldRunResults after each world finished processing

  • non_competitors – A list of agent types that will not be competing in the sabotage competition but will exist in the world

  • non_competitor_params – parameters of non competitor agents

  • verbose – Verbosity

  • configs_only – If true, a config file for each

  • compact – If true, compact logs will be created and effort will be made to reduce the memory footprint

  • kwargs – Arguments to pass to the world_generator function

Returns:

TournamentResults The results of the tournament or a PathLike giving the location where configs were saved

Remarks:

Default parameters will be used in the league with the exception of parallelism which may use distributed processing

scml.scml2019.utils19.anac2019_sabotage(competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]], competitor_params: Sequence[Dict[str, Any]] | None = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: int | None = 1000, n_runs_per_world: int = 5, n_agents_per_competitor: int = 5, min_factories_per_level: int = 5, tournament_path: str | pathlib.Path | None = None, total_timeout: int | None = None, parallelism='parallel', scheduler_ip: str | None = None, scheduler_port: str | None = None, tournament_progress_callback: Callable[[negmas.tournaments.WorldRunResults | None], None] = None, world_progress_callback: Callable[[scml.scml2019.world.SCML2019World | None], None] = None, non_competitors: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] | None = None, non_competitor_params: Sequence[str | Type[scml.scml2019.factory_managers.builtins.FactoryManager]] | None = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) negmas.tournaments.TournamentResults | os.PathLike[source]

The function used to run ANAC 2019 SCML tournament (collusion track).

Parameters:
  • name – Tournament name

  • competitors – A list of class names for the competitors

  • competitor_params – A list of competitor parameters (used to initialize the competitors).

  • 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 – Number of agents per competitor

  • min_factories_per_level – Minimum number of factories for each production level

  • total_timeout – Total timeout for the complete process

  • tournament_path – Path at which to store all results. 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

  • 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

  • world_progress_callback – A function to be called after every step of every world run (only allowed for serial evaluation and should be used with cautious).

  • tournament_progress_callback – A function to be called with WorldRunResults after each world finished processing

  • non_competitors – A list of agent types that will not be competing in the sabotage competition but will exist in the world

  • non_competitor_params – parameters of non competitor agents

  • verbose – Verbosity

  • configs_only – If true, a config file for each

  • compact – If true, compact logs will be created and effort will be made to reduce the memory footprint

  • kwargs – Arguments to pass to the world_generator function

Returns:

TournamentResults The results of the tournament or a PathLike giving the location where configs were saved

Remarks:

Default parameters will be used in the league with the exception of parallelism which may use distributed processing