scml.scml2019.utils19 ===================== .. py:module:: scml.scml2019.utils19 Classes ------- .. autoapisummary:: scml.scml2019.utils19.DefaultGreedyManager Functions --------- .. autoapisummary:: scml.scml2019.utils19.anac2019_world scml.scml2019.utils19.balance_calculator scml.scml2019.utils19.anac2019_tournament scml.scml2019.utils19.anac2019_std scml.scml2019.utils19.anac2019_collusion scml.scml2019.utils19.anac2019_sabotage Module Contents --------------- .. py:class:: 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) Bases: :py:obj:`scml.scml2019.factory_managers.builtins.GreedyFactoryManager` The default factory manager that will be implemented by the committee of ANAC-SCML 2019 .. py:function:: anac2019_world(competitors: Sequence[Union[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 Creates a world compatible with the ANAC 2019 competition. Note that :param n_agents_per_competitor: Number of instantiations of each competing type. :param name: SCML2020World name to use :param agent_names_reveal_type: If true, a snake_case version of the agent_type will prefix agent names :param randomize: If true, managers are assigned to factories randomly otherwise in the order :param they are giving: :type they are giving: cycling :param n_intermediate: :param n_default_per_level: :param competitors: A list of class names for the competitors :param params: A list of dictionaries giving parameters to pass to the competitors :param n_miners: number of miners of the single raw material :param n_factories_per_level: number of factories at every production level :param n_consumers: number of consumers of the final product :param n_steps: number of simulation steps :param n_lines_per_factory: number of lines in each factory :param negotiation_speed: The number of negotiation steps per simulation step. None means infinite :param default_signing_delay: The number of simulation between contract conclusion and signature :param neg_n_steps: The maximum number of steps of a single negotiation (that is double the number of rounds) :param neg_time_limit: The total time-limit of a single negotiation :param time_limit: The total time-limit of the simulation :param transportation_delay: The transportation delay :param n_retrials: The number of retrials the `Miner` and `GreedyFactoryManager` will try if negotiations fail :param max_insurance_premium: The maximum insurance premium accepted by `GreedyFactoryManager` (-1 to disable) :param use_consumer: If true, the `GreedyFactoryManager` will use an internal consumer for buying its needs :param guaranteed_contracts: If true, the `GreedyFactoryManager` will only sign contracts that it can guaratnee not to :param break.: :param consumption_horizon: The number of steps for which `Consumer` publishes `CFP` s :param consumption: The consumption schedule will be sampled from a uniform distribution with these limits inclusive :param log_file_name: File name to store the logs :param negotiator_type: The negotiation factory used to create all negotiators :param max_storage: maximum storage capacity for all factory managers If None then it is unlimited :param compact: If True, then compact logs will be created to reduce memory footprint :param 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 .. py:function:: balance_calculator(worlds: List[scml.scml2019.world.SCML2019World], scoring_context: Dict[str, Any], dry_run: bool, ignore_default=True) -> negmas.tournaments.WorldRunResults A scoring function that scores factory managers' performance by the final balance only ignoring whatever still in their inventory. :param worlds: The world which is assumed to be run up to the point at which the scores are to be calculated. :param scoring_context: A dict of context parameters passed by the world generator or assigner. :param 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. .. py:function:: anac2019_tournament(competitors: Sequence[Union[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: Optional[int] = None, parallelism='parallel', scheduler_ip: Optional[str] = None, scheduler_port: Optional[str] = None, tournament_progress_callback: Callable[[Optional[negmas.tournaments.WorldRunResults]], None] = None, world_progress_callback: Callable[[Optional[scml.scml2019.world.SCML2019World]], None] = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) -> Union[negmas.tournaments.TournamentResults, os.PathLike] The function used to run ANAC 2019 SCML tournament (collusion track). :param name: Tournament name :param competitors: A list of class names for the competitors :param agent_names_reveal_type: If true then the type of an agent should be readable in its name (most likely at its beginning). :param n_configs: The number of different world configs (up to competitor assignment) to be generated. :param 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). :param n_runs_per_world: Number of runs per world. All of these world runs will have identical competitor assignment and identical world configuration. :param n_agents_per_competitor: Number of agents per competitor :param total_timeout: Total timeout for the complete process :param tournament_path: Path at which to store all results. A scores.csv file will keep the scores and logs folder will keep detailed logs :param parallelism: Type of parallelism. Can be 'serial' for serial, 'parallel' for parallel and 'distributed' for distributed :param scheduler_port: Port of the dask scheduler if parallelism is dask, dist, or distributed :param scheduler_ip: IP Address of the dask scheduler if parallelism is dask, dist, or distributed :param 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). :param tournament_progress_callback: A function to be called with `WorldRunResults` after each world finished processing :param verbose: Verbosity :param configs_only: If true, a config file for each :param compact: If true, effort will be made to reduce memory footprint including disableing most logs :param 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 .. py:function:: anac2019_std(competitors: Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]], competitor_params: Optional[Sequence[Dict[str, Any]]] = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: Optional[int] = 1000, n_runs_per_world: int = 5, min_factories_per_level: int = 5, tournament_path: str = None, total_timeout: Optional[int] = None, parallelism='parallel', scheduler_ip: Optional[str] = None, scheduler_port: Optional[str] = None, tournament_progress_callback: Callable[[Optional[negmas.tournaments.WorldRunResults]], None] = None, world_progress_callback: Callable[[Optional[scml.scml2019.world.SCML2019World]], None] = None, non_competitors: Optional[Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]]] = None, non_competitor_params: Optional[Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]]] = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) -> Union[negmas.tournaments.TournamentResults, os.PathLike] The function used to run ANAC 2019 SCML tournament (standard track). :param name: Tournament name :param competitors: A list of class names for the competitors :param competitor_params: A list of competitor parameters (used to initialize the competitors). :param agent_names_reveal_type: If true then the type of an agent should be readable in its name (most likely at its beginning). :param n_configs: The number of different world configs (up to competitor assignment) to be generated. :param 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). :param n_runs_per_world: Number of runs per world. All of these world runs will have identical competitor assignment and identical world configuration. :param min_factories_per_level: Minimum number of factories for each production level :param total_timeout: Total timeout for the complete process :param tournament_path: Path at which to store all results. A scores.csv file will keep the scores and logs folder will keep detailed logs :param parallelism: Type of parallelism. Can be 'serial' for serial, 'parallel' for parallel and 'distributed' for distributed :param scheduler_port: Port of the dask scheduler if parallelism is dask, dist, or distributed :param scheduler_ip: IP Address of the dask scheduler if parallelism is dask, dist, or distributed :param 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). :param tournament_progress_callback: A function to be called with `WorldRunResults` after each world finished processing :param non_competitors: A list of agent types that will not be competing in the sabotage competition but will exist in the world :param non_competitor_params: parameters of non competitor agents :param verbose: Verbosity :param configs_only: If true, a config file for each :param compact: If true, compact logs will be created and effort will be made to reduce the memory footprint :param 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 .. py:function:: anac2019_collusion(competitors: Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]], competitor_params: Optional[Sequence[Dict[str, Any]]] = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: Optional[int] = 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: Optional[int] = None, parallelism='parallel', scheduler_ip: Optional[str] = None, scheduler_port: Optional[str] = None, tournament_progress_callback: Callable[[Optional[negmas.tournaments.WorldRunResults]], None] | None = None, world_progress_callback: Callable[[Optional[scml.scml2019.world.SCML2019World]], None] | None = None, non_competitors: Optional[Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]]] = None, non_competitor_params: Optional[Sequence[Dict[str, Any]]] = None, name: str | None = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) -> Union[negmas.tournaments.TournamentResults, os.PathLike] The function used to run ANAC 2019 SCML tournament (collusion track). :param name: Tournament name :param competitors: A list of class names for the competitors :param competitor_params: A list of competitor parameters (used to initialize the competitors). :param agent_names_reveal_type: If true then the type of an agent should be readable in its name (most likely at its beginning). :param n_configs: The number of different world configs (up to competitor assignment) to be generated. :param 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). :param n_runs_per_world: Number of runs per world. All of these world runs will have identical competitor assignment and identical world configuration. :param n_agents_per_competitor: Number of agents per competitor :param min_factories_per_level: Minimum number of factories for each production level :param total_timeout: Total timeout for the complete process :param tournament_path: Path at which to store all results. A scores.csv file will keep the scores and logs folder will keep detailed logs :param parallelism: Type of parallelism. Can be 'serial' for serial, 'parallel' for parallel and 'distributed' for distributed :param scheduler_port: Port of the dask scheduler if parallelism is dask, dist, or distributed :param scheduler_ip: IP Address of the dask scheduler if parallelism is dask, dist, or distributed :param 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). :param tournament_progress_callback: A function to be called with `WorldRunResults` after each world finished processing :param non_competitors: A list of agent types that will not be competing in the sabotage competition but will exist in the world :param non_competitor_params: parameters of non competitor agents :param verbose: Verbosity :param configs_only: If true, a config file for each :param compact: If true, compact logs will be created and effort will be made to reduce the memory footprint :param 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 .. py:function:: anac2019_sabotage(competitors: Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]], competitor_params: Optional[Sequence[Dict[str, Any]]] = None, agent_names_reveal_type=False, n_configs: int = 5, max_worlds_per_config: Optional[int] = 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: Optional[int] = None, parallelism='parallel', scheduler_ip: Optional[str] = None, scheduler_port: Optional[str] = None, tournament_progress_callback: Callable[[Optional[negmas.tournaments.WorldRunResults]], None] = None, world_progress_callback: Callable[[Optional[scml.scml2019.world.SCML2019World]], None] = None, non_competitors: Optional[Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]]] = None, non_competitor_params: Optional[Sequence[Union[str, Type[scml.scml2019.factory_managers.builtins.FactoryManager]]]] = None, name: str = None, verbose: bool = False, configs_only=False, compact=False, **kwargs) -> Union[negmas.tournaments.TournamentResults, os.PathLike] The function used to run ANAC 2019 SCML tournament (collusion track). :param name: Tournament name :param competitors: A list of class names for the competitors :param competitor_params: A list of competitor parameters (used to initialize the competitors). :param agent_names_reveal_type: If true then the type of an agent should be readable in its name (most likely at its beginning). :param n_configs: The number of different world configs (up to competitor assignment) to be generated. :param 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). :param n_runs_per_world: Number of runs per world. All of these world runs will have identical competitor assignment and identical world configuration. :param n_agents_per_competitor: Number of agents per competitor :param min_factories_per_level: Minimum number of factories for each production level :param total_timeout: Total timeout for the complete process :param tournament_path: Path at which to store all results. A scores.csv file will keep the scores and logs folder will keep detailed logs :param parallelism: Type of parallelism. Can be 'serial' for serial, 'parallel' for parallel and 'distributed' for distributed :param scheduler_port: Port of the dask scheduler if parallelism is dask, dist, or distributed :param scheduler_ip: IP Address of the dask scheduler if parallelism is dask, dist, or distributed :param 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). :param tournament_progress_callback: A function to be called with `WorldRunResults` after each world finished processing :param non_competitors: A list of agent types that will not be competing in the sabotage competition but will exist in the world :param non_competitor_params: parameters of non competitor agents :param verbose: Verbosity :param configs_only: If true, a config file for each :param compact: If true, compact logs will be created and effort will be made to reduce the memory footprint :param 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