scml.oneshot.world ================== .. py:module:: scml.oneshot.world Attributes ---------- .. autoapisummary:: scml.oneshot.world.PLACEHOLDER_AGENT_PREFIX Classes ------- .. autoapisummary:: scml.oneshot.world.SCMLBaseWorld scml.oneshot.world.OneShotWorld scml.oneshot.world.SCML2020OneShotWorld scml.oneshot.world.SCML2021OneShotWorld scml.oneshot.world.SCML2022OneShotWorld scml.oneshot.world.SCML2023OneShotWorld scml.oneshot.world.SCML2024OneShotWorld Module Contents --------------- .. py:data:: PLACEHOLDER_AGENT_PREFIX :value: 'PlaceHolder__' .. py:class:: SCMLBaseWorld(catalog_prices: numpy.ndarray, profiles: list[scml.oneshot.common.OneShotProfile], agent_types: list[type[scml.oneshot.agent.OneShotAgent]], agent_params: list[dict[str, Any]], catalog_quantities: int | numpy.ndarray = 50, financial_report_period=5, bankruptcy_limit=0.0, penalize_bankrupt_for_future_contracts=True, penalties_scale: Literal['trading', 'catalog', 'unit', 'none'] = 'trading', exogenous_contracts: Collection[scml.oneshot.common.OneShotExogenousContract] = tuple(), exogenous_dynamic: bool = False, exogenous_force_max: bool = False, initial_balance: numpy.ndarray | tuple[int, int] | int = 1000, compact=True, no_logs=True, fast=True, n_steps=1000, time_limit=60 * 15, sync_calls=False, neg_n_steps=20, neg_time_limit=None, neg_hidden_time_limit=60, neg_step_time_limit=20, negotiation_speed=None, shuffle_negotiations=False, one_offer_per_step=False, publish_exogenous_summary=True, publish_trading_prices=True, publish_assets=False, publish_production_capacity=True, price_multiplier=0.0, price_range_fraction=0.0, wide_price_range=False, allow_zero_quantity: bool = False, trading_price_discount=0.9, signing_delay=0, force_signing=False, batch_signing=True, name: str | None = None, agent_name_reveals_position: bool = True, agent_name_reveals_type: bool = True, inventory_valuation_catalog=0, inventory_valuation_trading=0, perishable=True, horizon=0, one_time_per_negotiation=True, quantity_multiplier: float = 1.0, nullify_bankrupt_contracts: bool = False, debug: bool = False, verbose: bool = False, **kwargs) Bases: :py:obj:`negmas.TimeInAgreementMixin`, :py:obj:`negmas.World`\ [\ :py:obj:`scml.oneshot.awi.OneShotAWI`\ , :py:obj:`scml.oneshot.sysagents.DefaultOneShotAdapter`\ ] Implements the a generalized form of SCML-OneShot game which supports both oneshot and standard simulations :param catalog_prices: An n_products vector (i.e. n_processes+1 vector) giving the catalog price of all products :param profiles: An n_agents list of `OneShotFactoryProfile` objects specifying the private profile of the factory associated with each agent. :param agent_types: An n_agents list of strings/ `OneShotAgent` classes specifying the type of each agent :param agent_params: An n_agents dictionaries giving the parameters of each agent :param catalog_quantities: The quantities in the past for which catalog_prices are the average unit prices. This is used when updating the trading prices. If set to zero then the trading price will follow the market price and will not use the catalog_price (except for products that are never sold in the market for which the trading price will take the default value of the catalog price). If set to a large value (e.g. 10000), the price at which a product is sold will not affect the trading price :param financial_report_period: The number of steps between financial reports. If < 1, it is a fraction of n_steps :param exogenous_force_max: If true, exogenous contracts are forced to be signed independent of the setting of `force_signing` :param compact: If True, no logs will be kept and the whole simulation will use a smaller memory footprint :param n_steps: Number of simulation steps (can be considered as days). :param time_limit: Total time allowed for the complete simulation in seconds. :param neg_n_steps: Number of negotiation steps allowed for all negotiations. :param neg_time_limit: Total time allowed for a complete negotiation in seconds. :param neg_step_time_limit: Total time allowed for a single step of a negotiation. in seconds. :param negotiation_speed: The number of negotiation steps that pass in every simulation step. If 0, negotiations will be guaranteed to finish within a single simulation step :param signing_delay: The number of simulation steps to pass between a contract is concluded and signed :param name: The name of the simulations :param \*\*kwargs: Other parameters that are passed directly to `SCML2020World` constructor. .. py:attribute:: _verbose :value: False .. py:attribute:: _debug :value: False .. py:attribute:: agents :type: dict[str, scml.oneshot.sysagents.DefaultOneShotAdapter] .. py:attribute:: publish_assets :value: False .. py:attribute:: publish_production_capacity :value: True .. py:attribute:: perishable :value: True .. py:attribute:: horizon :value: 0 .. py:attribute:: price_range_fraction :value: 0.0 .. py:attribute:: nullify_bankrupt_contracts :value: False .. py:attribute:: inventory_valuation_catalog :value: 0 .. py:attribute:: inventory_valuation_trading :value: 0 .. py:attribute:: allow_zero_quantity :value: False .. py:attribute:: _profits :type: dict[str, list[float]] .. py:attribute:: _breach_levels :type: dict[str, list[float]] .. py:attribute:: _breaches_of :type: dict[str, list[bool]] .. py:attribute:: _inventory_input :type: dict[str, int] .. py:attribute:: _inventory_output :type: dict[str, int] .. py:attribute:: _productivity :type: dict[str, float] .. py:attribute:: _shortfall_quantity :type: dict[str, int] .. py:attribute:: _shortfall_penalty :type: dict[str, float] .. py:attribute:: _storage_cost :type: dict[str, float] .. py:attribute:: _disposal_cost :type: dict[str, float] .. py:attribute:: _penalized_quantity :type: dict[str, int] .. py:attribute:: _n_nullified :type: int :value: 0 .. py:attribute:: _nullified_quantity :type: int :value: 0 .. py:attribute:: _nullified_price :type: float :value: 0 .. py:attribute:: _activity :value: 0 .. py:attribute:: trading_price_discount :value: 0.9 .. py:attribute:: catalog_quantities :value: 50 .. py:attribute:: publish_exogenous_summary :value: True .. py:attribute:: price_multiplier :value: 0.0 .. py:attribute:: wide_price_range :value: False .. py:attribute:: publish_trading_prices :value: True .. py:attribute:: penalize_bankrupt_for_future_contracts :value: True .. py:attribute:: agent_disposal_cost :type: dict[str, list[float]] .. py:attribute:: agent_storage_cost :type: dict[str, list[float]] .. py:attribute:: agent_shortfall_penalty :type: dict[str, list[float]] .. py:attribute:: compact :value: True .. py:attribute:: quantity_multiplier :value: 1.0 .. py:attribute:: one_time_per_negotiation :value: True .. py:attribute:: exogenous_dynamic :value: False .. py:attribute:: penalties_scale :value: 'trading' .. py:attribute:: bankruptcy_limit :value: -0.0 .. py:attribute:: profiles .. py:attribute:: catalog_prices .. py:attribute:: process_inputs .. py:attribute:: process_outputs .. py:attribute:: n_products .. py:attribute:: n_processes .. py:attribute:: exogenous_force_max :value: False .. py:attribute:: financial_reports_period :value: 5 .. py:attribute:: controller_types .. py:attribute:: agent_types .. py:attribute:: agent_params .. py:attribute:: agent_unique_types .. py:attribute:: agent_n_contracts .. py:attribute:: suppliers :type: list[list[str]] .. py:attribute:: consumers :type: list[list[str]] .. py:attribute:: production_capacity :type: list[int] .. py:attribute:: agent_processes :type: dict[str, list[int]] .. py:attribute:: agent_inputs :type: dict[str, list[int]] .. py:attribute:: agent_outputs :type: dict[str, list[int]] .. py:attribute:: agent_consumers :type: dict[str, list[str]] .. py:attribute:: agent_suppliers :type: dict[str, list[str]] .. py:attribute:: agent_profiles :type: dict[str, scml.oneshot.common.OneShotProfile] .. py:attribute:: is_bankrupt :type: dict[str, bool] .. py:attribute:: exogenous_contracts :type: dict[int:list[Contract]] .. py:attribute:: _traded_quantity .. py:attribute:: _real_price .. py:attribute:: _sold_quantity .. py:attribute:: _trading_price .. py:attribute:: _betas .. py:attribute:: _betas_sum .. py:attribute:: _input_quantity .. py:attribute:: _input_price .. py:attribute:: _output_quantity .. py:attribute:: _output_price .. py:attribute:: exogenous_qout .. py:attribute:: exogenous_qin .. py:attribute:: exogenous_pout .. py:attribute:: exogenous_pin .. py:attribute:: exogenous_contracts_summary :value: [] .. py:attribute:: initial_balances .. py:attribute:: _max_n_lines .. py:attribute:: a2i .. py:attribute:: _current_issues :type: list[list[negmas.ContiguousIssue]] :value: [] .. py:attribute:: __contracts :type: dict[str, list[negmas.Contract]] .. py:attribute:: _agent_negotiations :type: dict[str, dict[str, dict[str, scml.oneshot.common.NegotiationDetails]]] .. py:method:: action_info_cols() -> list[tuple[str, type]] .. py:method:: extract_action_info(action: Any) -> list[int] .. py:method:: agreement_info_cols() -> list[tuple[str, type]] .. py:method:: extract_agreement_info(agreement: negmas.Outcome | None) -> list[int] .. py:method:: extra_neg_info(info: negmas.situated.NegotiationInfo) -> dict[str, Any] .. py:method:: replace_agents(config: dict, old_types: tuple[str | type[scml.oneshot.agent.OneShotAgent], Ellipsis] | list[str | type[scml.oneshot.agent.OneShotAgent]], types: tuple[str | type[scml.oneshot.agent.OneShotAgent], Ellipsis] | list[str | type[scml.oneshot.agent.OneShotAgent]], params: list[dict[str, Any]] | tuple[dict[str, Any], Ellipsis] | None = None) :classmethod: Replaces all agents of a given type by agents of a new type .. py:method:: generate(agent_types: tuple[str | type[scml.oneshot.agent.OneShotAgent], Ellipsis] | list[str | type[scml.oneshot.agent.OneShotAgent]] | type[scml.oneshot.agent.OneShotAgent] | str, agent_params: list[dict[str, Any]] | tuple[dict[str, Any], Ellipsis] | None = None, agent_processes: list[int] | None = None, n_steps: tuple[int, int] | int = (50, 200), n_processes: tuple[int, int] | int = 2, n_lines: numpy.ndarray | tuple[int, int] | int = 10, n_agents_per_process: numpy.ndarray | tuple[int, int] | int = (4, 8), process_inputs: numpy.ndarray | tuple[int, int] | int = 1, process_outputs: numpy.ndarray | tuple[int, int] | int = 1, production_costs: numpy.ndarray | tuple[int, int] | int = (1, 4), profit_means: numpy.ndarray | tuple[float, float] | float = (0.1, 0.2), profit_stddevs: numpy.ndarray | tuple[float, float] | float = 0.05, max_productivity: numpy.ndarray | tuple[float, float] | float = (0.8, 1.0), initial_balance: numpy.ndarray | tuple[int, int] | int | None = None, exogenous_supply_predictability: tuple[float, float] | float = (0.6, 0.9), exogenous_sales_predictability: tuple[float, float] | float = (0.6, 0.9), exogenous_control: tuple[float, float] | float = -1, cash_availability: tuple[float, float] | float = (1.5, 2.5), shortfall_penalty: tuple[float, float] | float = (0.2, 1.0), shortfall_penalty_dev: tuple[float, float] | float = (0.0, 0.1), disposal_cost: tuple[float, float] | float = (0.0, 0.2), disposal_cost_dev: tuple[float, float] | float = (0.0, 0.02), storage_cost: tuple[float, float] | float = (0.0, 0.02), storage_cost_dev: tuple[float, float] | float = 0, exogenous_price_dev: tuple[float, float] | float = (0.1, 0.2), price_multiplier: numpy.ndarray | tuple[float, float] | float = (1.5, 2.0), cost_increases_with_level=True, equal_exogenous_supply=False, equal_exogenous_sales=False, force_signing=True, profit_basis=np.max, random_agent_types: bool = False, penalties_scale: str | list[str] = 'trading', cap_exogenous_quantities: bool = True, exogenous_generation_method='profitable', perishable: bool | None = True, max_supply: numpy.ndarray | tuple[float, float] | float = (0.8, 1.0), **kwargs) -> dict[str, Any] :classmethod: Generates the configuration for a world :param agent_types: All agent types :param agent_params: Agent parameters used to initialize them :param n_steps: Number of simulation steps :param n_processes: Number of processes in the production chain :param n_lines: Number of lines per factory :param process_inputs: Number of input units per process :param process_outputs: Number of output units per process :param production_costs: Production cost per factory :param profit_means: Mean profitability per production level (i.e. process). :param profit_stddevs: Std. Dev. of the profitability of every level (i.e. process). :param max_productivity: Maximum possible productivity per level (i.e. process). :param max_supply: Maximum possible supply level to the market, :param initial_balance: The initial balance of all agents :param n_agents_per_process: Number of agents per process :param agent_processes: The process for each agent. If not `None` , it will override `n_agents_per_process` and must be a list/tuple of the same length as `agent_types` . Morevoer, `random_agent_types` must be False in this case :param cost_increases_with_level: If true, production cost will be higher for processes nearer to the final product. :param profit_basis: The statistic used when controlling catalog prices by profit arguments. It can be np.mean, np.median, np.min, np.max or any Callable[[list[float]], float] and is used to summarize production costs at every level. :param equal_exogenous_supply: If true, external supply will be distributed equally among all agents in the first layer :param equal_exogenous_sales: If true, external sales will be distributed equally among all agents in the last layer :param exogenous_supply_predictability: How predictable are exogenous supplies of each agent over time. 1.0 means that every agent will have the same quantity for all of its contracts over time. 0.0 means quantities per agent are completely random :param exogenous_sales_predictability: How predictable are exogenous supplies of each agent over time. 1.0 means that every agent will have the same quantity for all of its contracts over time. 0.0 means quantities per agent are completely random :param force_signing: Whether to force contract signatures (exogenous contracts are treated in the same way). :param exogenous_control: How much control does the agent have over exogenous contract signing. Only effective if force_signing is False and use_exogenous_contracts is True :param cap_exogenous_quantities: If True, all exogenous quantities in all contracts are capped to be no more than the number of lines :param cash_availability: The fraction of the total money needs of the agent to work at maximum capacity that is available as `initial_balance` . This is only effective if `initial_balance` is set to `None` . :param exogenous_control: How much control does the agent have over exogenous contract signing. Only effective if force_signing is False and use_exogenous_contracts is True :param disposal_cost: A range to sample mean-disposal costs for all factories from (only used if perishable is True) :param shortfall_penalty: A range to sample mean-shortfall penalty for all factories from :param storage_cost: A range to sample mean-storage costs fro all factories from (only used if perishable is False) :param disposal_cost_dev: A range to sample std. dev of disposal costs for all factories from :param shortfall_penalty_dev: A range to sample std. dev of shortfall penalty for all factories from :param storage_cost_dev: The standard deviation of storage cost relative to the mean price :param exogenous_price_dev: The standard deviation of exogenous contract prices relative to the mean price :param price_multiplier: A value to multiply with trading/catalog price to get the upper limit on prices for all negotiations :param random_agent_types: If True, the final agent types used by the generator will always be sampled from the given types. If False, this random sampling will only happen if len(agent_types) != n_agents. :param penalties_scale: What are `disposal_cost` and `shortfall_penalty` relative to. There are four options: `trading`, `catalog` mean trading and catalog prices of the product. `unit` means the unit price in the contract and `none` means the `storage-cost` and `shortfall_penalty` are absolute values (in money unit). If not given will be read through the AWI :param exogenous_generation_method: the generation method. This is only for compatibility with SCML2020World and is not used. :param perishable: If True, storage_cost is set to zero as there is no storage and if False, disposal_cost is set to zero as there is no disposal. If None, neither is overridden. :param \*\*kwargs: :returns: world configuration as a Dict[str, Any]. A world can be generated from this dict by calling OneShotWorld(**d) Remarks: - There are two general ways to use this generator: 1. Pass `random_agent_types = False`, and pass `agent_types`, `agent_processes` to control placement of each agent in each level of the production graph. 2. Pass `random_agent_types = True` and pass `agent_types`, `n_agents_per_process` to make the system randomly place the specified number of agents in each production level - Most parameters (i.e. `process_inputs` , `process_outputs` , `n_agents_per_process` , `costs` ) can take a single value, a tuple of two values, or a list of values. If it has a single value, it is repeated for all processes/factories as appropriate. If it is a tuple of two numbers $(i, j)$, each process will take a number sampled from a uniform distribution supported on $[i, j]$ inclusive. If it is a list of values, of the length `n_processes` , it is used as it is otherwise, it is used to sample values for each process. .. py:method:: type_name_for_logs(agent: scml.oneshot.agent.OneShotAgent | None) -> str | None .. py:property:: negotiated_contract_records :type: list[dict[str, Any]] .. py:property:: exogenous_contract_records :type: list[dict[str, Any]] .. py:method:: current_balance(agent_id: str) .. py:method:: add_financial_report(agent: scml.oneshot.sysagents.DefaultOneShotAdapter, reports_agent, reports_time) -> None Records a financial report for the given agent in the agent indexed reports and time indexed reports :param agent: The agent :param reports_agent: A dictionary of financial reports indexed by agent id :param reports_time: A dictionary of financial reports indexed by time Returns: .. py:property:: agent_contracts .. py:method:: _update_exogenous(s) .. py:method:: step_with(actions: dict[str, dict[str, negmas.SAOResponse]], init=False) -> bool Runs a simulation step for the agents given in keys passing the corresponding values as counter offers. :returns: False if this is the last negotiation. Remarks: - You must call this with `init=True` once at the beginning of every simulation to make sure that `init()` and other initialization code is called correctly. - Every step advances all negotiations one step. - Negotiators belonging to the given agents are never called as long as a corresponding action (response) is given in the agents dict. - The world MUST be created with `one_offer_per_step` passed as `True` (default is `False`). .. py:method:: simulation_step(stage=0) A single step of the simulation. :param stage: How many times so far was this method called within the current simulation step Remarks: - Using the stage parameter, it is possible to have `Operations` . `SimulationStep` several times with the list of operations while differentiating between these calls. .. py:method:: _breach_record(perpetrator, level, type_) -> dict[str, Any] .. py:method:: _adjust_contract_types(contract) .. py:method:: on_contract_signed(contract: negmas.Contract) -> bool Called to add a contract to the existing set of contract after it is signed :param contract: The contract to add :returns: True if everything went OK and False otherwise Remarks: - By default this function just adds the contract to the set of contracts maintaned by the world. - You should ALWAYS call this function when overriding it. .. py:method:: contract_record(contract: negmas.Contract) -> dict[str, Any] Converts a contract to a record suitable for permanent storage .. py:method:: breach_record(breach: negmas.Breach) -> dict[str, Any] Converts a breach to a record suitable for storage during the simulation .. py:method:: execute_action(action, agent, callback: Callable | None = None) -> bool Executes the given action by the given agent .. py:method:: contract_size(contract: negmas.Contract) -> float Returns an estimation of the **activity level** associated with this contract. Higher is better :param contract: Returns: .. py:method:: post_step_stats() Called at the end of the simulation step to update all stats Kept for backward compatibility and will be dropped. Override `update_stats` ins .. py:method:: pre_step_stats() Called at the beginning of the simulation step to prepare stats or update them Kept for backward compatibility and will be dropped. Override `update_stats` instead .. py:method:: welfare(include_bankrupt: bool = False) -> float Total welfare of all agents .. py:method:: relative_welfare(include_bankrupt: bool = False) -> float | None Total welfare relative to expected value. Returns None if no expectation is found in self.info .. py:method:: is_valid_contact(contract: negmas.Contract) -> bool Checks whether a signed contract is valid .. py:method:: scores(assets_multiplier: float = 0.0) -> dict[str, float] Scores of all agents given the asset multiplier. :param assets_multiplier: A multiplier to multiply the assets with. .. py:property:: winners The winners of this world (factory managers with maximum wallet balance .. py:method:: trading_prices_for(discount: float = 1.0, condition='executed') -> numpy.ndarray Calculates the prices at which all products traded using an optional discount factor :param discount: A discount factor to treat older prices less importantly (exponential discounting). :param condition: The condition for contracts to consider. Possible values are executed, signed, concluded, nullified :returns: an n_products vector of trading prices .. py:property:: trading_prices .. py:property:: stats_df :type: pandas.DataFrame Returns a pandas data frame with the stats .. py:property:: contracts_df :type: pandas.DataFrame Returns a pandas data frame with the contracts .. py:property:: system_agents :type: list[scml.oneshot.sysagents._StdSystemAgent] Returns the two system agents .. py:property:: system_agent_names :type: list[str] Returns the names two system agents .. py:property:: non_system_agents :type: list[scml.oneshot.sysagents.DefaultOneShotAdapter] Returns all agents except system agents .. py:property:: non_system_agent_names :type: list[str] Returns names of all agents except system agents .. py:property:: agreement_fraction :type: float Fraction of negotiations ending in agreement and leading to signed contracts .. py:attribute:: system_agent_ids .. py:attribute:: non_system_agent_ids .. py:method:: draw(steps: tuple[int, int] | int | None = None, what: Collection[str] = DEFAULT_EDGE_TYPES, who: Callable[[negmas.Agent], bool] | None = None, where: Callable[[negmas.Agent], int | tuple[float, float]] | None = None, together: bool = True, axs: Collection[matplotlib.axis.Axis] | None = None, ncols: int = 4, figsize: tuple[int, int] = (15, 15), **kwargs) -> tuple[matplotlib.axis.Axis, networkx.Graph] | tuple[list[matplotlib.axis.Axis], list[networkx.Graph]] .. py:method:: _request_negotiations(agent_id: str, controller: negmas.sao.SAOController | None = None, negotiators: list[negmas.sao.SAONegotiator] | None = None, extra: dict[str, Any] | None = None) -> bool Requests negotiations (used internally) :param agent_id: the agent requesting :param product: The product to negotiate about :param quantity: The minimum and maximum quantities. Passing a single value q is equivalent to passing (q,q) :param unit_price: The minimum and maximum unit prices. Passing a single value u is equivalent to passing (u,u) :param time: The minimum and maximum delivery step. Passing a single value t is equivalent to passing (t,t) :param controller: The controller to manage the complete set of negotiations :param negotiators: An optional list of negotiators to use for negotiating with the given partners (in the same order). :param extra: Extra information accessible through the negotiation annotation to the caller :param # consumer_starts: Whether the consumer or supplier sends the first offer in the negotiation :returns: `True` if the partner accepted and the negotiation is ready to start .. py:method:: _request_negotiation(agent_id: str, product: int, partner: str, negotiator: negmas.sao.SAONegotiator, extra: dict[str, Any] | None = None, is_buy: bool = True) -> negmas.situated.NegotiationInfo | None Requests a negotiation :param product: The product to negotiate about :param quantity: The minimum and maximum quantities. Passing a single value q is equivalent to passing (q,q) :param unit_price: The minimum and maximum unit prices. Passing a single value u is equivalent to passing (u,u) :param time: The minimum and maximum delivery step. Passing a single value t is equivalent to passing (t,t) :param partner: ID of the partner to negotiate with. :param negotiator: The negotiator to use for this negotiation (if the partner accepted to negotiate) :param extra: Extra information accessible through the negotiation annotation to the caller :param is_buy: whether the consumer starts the negotiation :returns: `True` if the partner accepted and the negotiation is ready to start .. py:method:: _make_issues(product) -> tuple[tuple[int, int], tuple[int, int], tuple[int, int]] Creates the negotiation agendas :param product: The product to be negotiated about :type product: int :returns: A tuple of minimum and maximum values for unit-price, time, and quantity in that order .. py:method:: _make_negotiations() .. py:method:: order_contracts_for_execution(contracts: Collection[negmas.Contract]) -> Collection[negmas.Contract] Orders the contracts in a specific time-step that are about to be executed .. py:method:: get_private_state(agent: negmas.Agent) -> dict Reads the private state of the given agent .. py:method:: _contract_record(contract) Converts a contract to a record suitable for permanent storage .. py:method:: start_contract_execution(contract: negmas.Contract) -> set[negmas.Breach] | None Tries to execute the contract :param contract: :returns: The set of breaches committed if any. If there are no breaches return an empty set :rtype: Set[Breach] Remarks: - You must call super() implementation of this method before doing anything - It is possible to return None which indicates that the contract was nullified (i.e. not executed due to a reason other than an execution exeception). .. py:method:: complete_contract_execution(contract: negmas.Contract, breaches: list[negmas.Breach], resolution: negmas.Contract) -> None Called after breach resolution is completed for contracts for which some potential breaches occurred. :param contract: The contract considered. :param breaches: The list of potential breaches that was generated by `_execute_contract`. :param resolution: The agreed upon resolution Returns: .. py:method:: plot_combined_stats(worlds: tuple[SCMLBaseWorld, Ellipsis] | SCMLBaseWorld, stats: str | tuple[str, Ellipsis] | None = None, pertype=False, makefig=False, title=True, ylabel=False, xlabel=False, legend=True, figsize=None, perishable: bool = False, **kwargs) :classmethod: Plots combined statistics of multiple worlds in a single plot :param stats: The statistics to plot. If `None`, some selected stats will be displayed :param pertype: combine agent-statistics per type :param use_sum: plot sum for type statistics instead of mean :param title: If given a title will be added to each subplot :param ylabel: If given, the ylabel will be added to each subplot :param xlabel: If given The xlabel will be added (Simulation Step) :param legend: If given, a legend will be displayed :param makefig: If given a new figure will be started :param figsize: Size of the figure to host the plot :param ylegend: y-axis of legend for cases with large number of labels :param legend_n_cols: number of columns in the legend .. py:method:: plot_stats(stats: str | tuple[str, Ellipsis] | None = None, pertype=False, use_sum=False, makefig=False, title=True, ylabel=False, xlabel=False, legend=True, figsize=None, ylegend=2.0, legend_ncols=8) Plots statistics of the world in a single plot :param stats: The statistics to plot. If `None`, some selected stats will be displayed :param pertype: combine agent-statistics per type :param use_sum: plot sum for type statistics instead of mean :param title: If given a title will be added to each subplot :param ylabel: If given, the ylabel will be added to each subplot :param xlabel: If given The xlabel will be added (Simulation Step) :param legend: If given, a legend will be displayed :param makefig: If given a new figure will be started :param figsize: Size of the figure to host the plot :param ylegend: y-axis of legend for cases with large number of labels .. py:class:: OneShotWorld(catalog_prices: numpy.ndarray, profiles: list[scml.oneshot.common.OneShotProfile], agent_types: list[type[scml.oneshot.agent.OneShotAgent]], agent_params: list[dict[str, Any]], catalog_quantities: int | numpy.ndarray = 50, financial_report_period=5, bankruptcy_limit=0.0, penalize_bankrupt_for_future_contracts=True, penalties_scale: Literal['trading', 'catalog', 'unit', 'none'] = 'trading', exogenous_contracts: Collection[scml.oneshot.common.OneShotExogenousContract] = tuple(), exogenous_dynamic: bool = False, exogenous_force_max: bool = False, initial_balance: numpy.ndarray | tuple[int, int] | int = 1000, compact=True, no_logs=True, fast=True, n_steps=1000, time_limit=60 * 15, sync_calls=False, neg_n_steps=20, neg_time_limit=None, neg_hidden_time_limit=60, neg_step_time_limit=20, negotiation_speed=None, shuffle_negotiations=False, one_offer_per_step=False, publish_exogenous_summary=True, publish_trading_prices=True, publish_assets=False, publish_production_capacity=True, price_multiplier=0.0, price_range_fraction=0.0, wide_price_range=False, allow_zero_quantity: bool = False, trading_price_discount=0.9, signing_delay=0, force_signing=False, batch_signing=True, name: str | None = None, agent_name_reveals_position: bool = True, agent_name_reveals_type: bool = True, inventory_valuation_catalog=0, inventory_valuation_trading=0, perishable=True, horizon=0, one_time_per_negotiation=True, quantity_multiplier: float = 1.0, nullify_bankrupt_contracts: bool = False, debug: bool = False, verbose: bool = False, **kwargs) Bases: :py:obj:`SCMLBaseWorld` Basic oneshot simulation .. py:class:: SCML2020OneShotWorld(catalog_prices: numpy.ndarray, profiles: list[scml.oneshot.common.OneShotProfile], agent_types: list[type[scml.oneshot.agent.OneShotAgent]], agent_params: list[dict[str, Any]], catalog_quantities: int | numpy.ndarray = 50, financial_report_period=5, bankruptcy_limit=0.0, penalize_bankrupt_for_future_contracts=True, penalties_scale: Literal['trading', 'catalog', 'unit', 'none'] = 'trading', exogenous_contracts: Collection[scml.oneshot.common.OneShotExogenousContract] = tuple(), exogenous_dynamic: bool = False, exogenous_force_max: bool = False, initial_balance: numpy.ndarray | tuple[int, int] | int = 1000, compact=True, no_logs=True, fast=True, n_steps=1000, time_limit=60 * 15, sync_calls=False, neg_n_steps=20, neg_time_limit=None, neg_hidden_time_limit=60, neg_step_time_limit=20, negotiation_speed=None, shuffle_negotiations=False, one_offer_per_step=False, publish_exogenous_summary=True, publish_trading_prices=True, publish_assets=False, publish_production_capacity=True, price_multiplier=0.0, price_range_fraction=0.0, wide_price_range=False, allow_zero_quantity: bool = False, trading_price_discount=0.9, signing_delay=0, force_signing=False, batch_signing=True, name: str | None = None, agent_name_reveals_position: bool = True, agent_name_reveals_type: bool = True, inventory_valuation_catalog=0, inventory_valuation_trading=0, perishable=True, horizon=0, one_time_per_negotiation=True, quantity_multiplier: float = 1.0, nullify_bankrupt_contracts: bool = False, debug: bool = False, verbose: bool = False, **kwargs) Bases: :py:obj:`OneShotWorld` Oneshot simulation as used in SCML 2020 competition .. py:class:: SCML2021OneShotWorld(*args, **kwargs) Bases: :py:obj:`SCML2020OneShotWorld` Oneshot simulation as used in SCML 2021 competition .. py:class:: SCML2022OneShotWorld(*args, **kwargs) Bases: :py:obj:`SCML2021OneShotWorld` Oneshot simulation as used in SCML 2022 competition .. py:class:: SCML2023OneShotWorld(*args, **kwargs) Bases: :py:obj:`SCML2020OneShotWorld` Oneshot simulation as used in SCML 2023 competition .. py:class:: SCML2024OneShotWorld(*args, **kwargs) Bases: :py:obj:`SCML2023OneShotWorld` Oneshot simulation as used in SCML 2024 competition