scml.scml2019.world =================== .. py:module:: scml.scml2019.world Classes ------- .. autoapisummary:: scml.scml2019.world.Factory scml.scml2019.world.SCML2019World Module Contents --------------- .. py:class:: Factory Represents a factory within an SCML world. It is only accessed by the SCML2020World so it need not be made public. .. py:attribute:: initial_storage :type: dataclasses.InitVar[Dict[int, int]] Initial storage .. py:attribute:: initial_wallet :type: dataclasses.InitVar[float] :value: 0.0 Initial Wallet .. py:attribute:: id :type: str :value: '' Object name .. py:attribute:: profiles :type: List[ManufacturingProfile] :value: [] A list of profiles used to initialize the factory .. py:attribute:: max_storage :type: int :value: 9223372036854775807 Maximum storage allowed in this factory .. py:attribute:: min_storage :type: int :value: 0 Minimum allowed storage per product .. py:attribute:: min_balance :type: int | float :value: 0 Minimum allowed balance .. py:attribute:: initial_balance :type: float :value: 0.0 Initial balance of the factory .. py:attribute:: _commands :type: numpy.ndarray The production command currently running .. py:attribute:: _line_schedules :type: numpy.ndarray .. py:attribute:: _storage :type: Dict[int, int] Mapping from product index to the amount available in the inventory .. py:attribute:: _total_storage :type: int :value: 0 Total storage .. py:attribute:: _wallet :type: float :value: 0 Money available for purchases .. py:attribute:: _hidden_money :type: float :value: 0 Amount of money hidden by the agent .. py:attribute:: _hidden_storage :type: Dict[int, int] Mapping from product index to the amount hidden by the agent .. py:attribute:: _loans :type: float :value: 0.0 The total money owned as loans .. py:attribute:: _n_lines :type: int The number of lines in the factory, will be set using the `profiles` input .. py:attribute:: _jobs :type: Dict[Tuple[int, int], Job] The jobs waiting to be run on the factory indexed by (time, line) tuples .. py:attribute:: _next_step :type: int :value: 0 Current simulation step .. py:attribute:: _carried_updates :type: FactoryStatusUpdate Carried updates from last executed command .. py:attribute:: _world :type: negmas.situated.World :value: None .. py:method:: attach_to_world(world) .. py:method:: __post_init__(initial_storage: Dict[int, int], initial_wallet=0.0) .. py:property:: hidden_money :type: float .. py:property:: hidden_storage :type: Dict[int, int] .. py:property:: n_lines :type: int .. py:property:: jobs :type: Dict[Tuple[int, int], Job] .. py:property:: commands :type: numpy.ndarray .. py:property:: line_schedules :type: numpy.ndarray .. py:property:: wallet :type: float .. py:property:: storage :type: Dict[int, int] .. py:property:: loans :type: float .. py:property:: total_storage :type: int .. py:property:: balance :type: float The total balance of the factory .. py:property:: total_balance :type: float total balance including hidden money .. py:property:: next_step :type: int .. py:method:: add_loan(total: float) -> None .. py:method:: receive(payment: float) -> None .. py:method:: pay(payment: float) -> None .. py:method:: transport_to(product: int, quantity: int) -> None .. py:method:: buy(product: int, quantity: int, price: float) -> None .. py:method:: sell(product: int, quantity: int, price: float) -> None .. py:method:: transport_from(product: int, quantity: int) -> None .. py:method:: hide_funds(amount: float) -> None .. py:method:: hide_product(product: int, quantity: int) -> None .. py:method:: unhide_funds(amount: float) -> None .. py:method:: unhide_product(product: int, quantity: int) -> None .. py:method:: schedule(job: Job, override=False) -> None Schedules the given job at its `time` and `line` optionally overriding whatever was already scheduled :param job: :param override: :returns: Success/failure .. py:method:: _apply_updates(updates: FactoryStatusUpdate) -> None .. py:method:: step() -> List[ProductionReport] .. py:method:: _run(profile: ManufacturingProfile, override=True) -> None running is executed at the beginning of the step t :param profile: the profile to start giving both the line and process :param override: If true, override any running processes paying cancellation cost for these processes Remarks: - The output of a process that runs from step t to step t + n - 1 will only be in storage at step t + n .. py:method:: _pause(line: int) -> None pausing is executed at the end of the step :param line: the line on which the process is running :returns: The status updated for all times that need to be updated to cancel the command if it is not None. If None is returned then scheduling failed. :rtype: Optional[Dict[int, FactoryStatusUpdate]] Remarks: - Not implemented yet - pausing when nothing is running is not an error and will return an empty status update .. py:method:: _resume(line: int) -> None resumption is executed at the end of the step (starting next step count down) :param line: the line on which the process is running :returns: The status updated for all times that need to be updated to cancel the command if it is not None. If None is returned then scheduling failed. :rtype: Optional[Dict[int, FactoryStatusUpdate]] Remarks: - Not implemented yet - resuming when nothing is paused is not an error and will return an empty status update .. py:method:: _stop(line: int) -> None stopping is executed at the beginning of the current step :param line: the line on which the process is running :returns: The status updated for all times that need to be updated to cancel the command if it is not None. If None is returned then scheduling failed. :rtype: Optional[Dict[int, FactoryStatusUpdate]] Remarks: - stopping when nothing is running is not an error and will just return an empty schedule .. py:method:: _step_line(line: int) -> ProductionReport Steps the line to the time-step `t` assuming that it is already stepped to time-step t-1 given the storage :param line: the line to step :returns: ProductionReport .. py:class:: SCML2019World(products: Collection[scml.scml2019.common.Product], processes: Collection[scml.scml2019.common.Process], factories: List[scml.scml2019.common.Factory], consumers: List[scml.scml2019.consumers.Consumer], miners: List[scml.scml2019.miners.Miner], factory_managers: Optional[List[scml.scml2019.factory_managers.builtins.FactoryManager]] = None, n_steps=100, time_limit=60 * 90, mechanisms: Optional[Dict[str, Dict[str, Any]]] = None, neg_n_steps=20, neg_time_limit=2 * 60, neg_step_time_limit=60, negotiation_speed=21, no_bank=False, minimum_balance=0, interest_rate=0.1, interest_max=0.3, installment_interest=0.2, interest_time_increment=0.02, balance_at_max_interest=None, loan_installments=1, no_insurance=False, premium=0.03, premium_time_increment=0.03, premium_breach_increment=0.001, max_allowed_breach_level=None, breach_processing=BreachProcessing.VICTIM_THEN_PERPETRATOR, breach_penalty_society=0.1, breach_penalty_society_min=0.0, breach_penalty_victim=0.0, breach_move_max_product=True, initial_wallet_balances: Optional[int] = None, money_resolution=0.5, default_signing_delay=0, transportation_delay: int = 0, transfer_delay: int = 0, start_negotiations_immediately=False, catalog_profit=0.15, avg_process_cost_is_public=True, catalog_prices_are_public=True, strip_annotations=True, financial_reports_period=10, ignore_negotiated_penalties=False, prevent_cfp_tampering=False, default_price_for_products_without_one=1, compensation_fraction=0.5, compact=False, log_folder=None, log_to_file: bool = False, log_to_screen: bool = False, log_file_level=logging.DEBUG, log_screen_level=logging.ERROR, log_file_name: str = 'log.txt', log_ufuns: bool = False, log_negotiations: bool = False, save_mechanism_state_in_contract=False, save_signed_contracts: bool = True, save_cancelled_contracts: bool = True, save_negotiations: bool = True, save_resolved_breaches: bool = True, save_unresolved_breaches: bool = True, ignore_agent_exceptions: bool = False, ignore_contract_execution_exceptions: bool = False, name: str | None = None, **kwargs) Bases: :py:obj:`negmas.situated.TimeInAgreementMixin`, :py:obj:`negmas.situated.World` The `SCML2020World` class running a simulation of supply chain management. .. py:attribute:: compact :value: False .. py:attribute:: prevent_cfp_tampering :value: False .. py:attribute:: ignore_negotiated_penalties :value: False .. py:attribute:: compensation_fraction :value: 0.5 .. py:attribute:: save_mechanism_state_in_contract :value: False .. py:attribute:: default_price_for_products_without_one :value: 1 .. py:attribute:: agents :type: Dict[str, scml.scml2019.agent.SCML2019Agent] .. py:attribute:: strip_annotations :value: True .. py:attribute:: minimum_balance :value: 0 .. py:attribute:: money_resolution :value: 0.5 .. py:attribute:: transportation_delay :value: 0 .. py:attribute:: breach_penalty_society :value: 0.1 .. py:attribute:: breach_move_max_product :value: True .. py:attribute:: breach_penalty_society_min :value: 0.0 .. py:attribute:: penalties :value: 0.0 .. py:attribute:: financial_reports_period :value: 10 .. py:attribute:: max_allowed_breach_level :value: None .. py:attribute:: catalog_profit :value: 0.15 .. py:attribute:: loan_installments :value: 1 .. py:attribute:: breach_penalty_victim :value: 0.0 .. py:attribute:: avg_process_cost_is_public :value: True .. py:attribute:: catalog_prices_are_public :value: True .. py:attribute:: initial_wallet_balances :value: None .. py:attribute:: products :type: List[scml.scml2019.common.Product] :value: [] .. py:attribute:: processes :type: List[scml.scml2019.common.Process] :value: [] .. py:attribute:: factory_managers :type: List[scml.scml2019.factory_managers.builtins.FactoryManager] :value: [] .. py:attribute:: miners :type: List[scml.scml2019.miners.Miner] :value: [] .. py:attribute:: consumers :type: List[scml.scml2019.consumers.Consumer] :value: [] .. py:attribute:: factories .. py:attribute:: _report_receivers :type: Dict[str, Set[scml.scml2019.agent.SCML2019Agent]] .. py:attribute:: f2a :type: Dict[str, scml.scml2019.agent.SCML2019Agent] .. py:attribute:: a2f :type: Dict[str, scml.scml2019.common.Factory] .. py:attribute:: __interested_agents :type: List[List[scml.scml2019.agent.SCML2019Agent]] .. py:attribute:: n_new_cfps :value: 0 .. py:attribute:: __n_nullified :value: 0 .. py:attribute:: __n_bankrupt :value: 0 .. py:attribute:: _transport :type: Dict[int, List[Tuple[scml.scml2019.agent.SCML2019Agent, int, int]]] .. py:attribute:: _transfer :type: Dict[int, List[Tuple[scml.scml2019.agent.SCML2019Agent, float]]] .. py:attribute:: transfer_delay :value: 0 .. py:attribute:: _n_production_failures :value: 0 .. py:attribute:: bank .. py:attribute:: insurance_company .. py:attribute:: traders .. py:method:: join(x: negmas.situated.Agent, simulation_priority: int = 0) Add an agent to the world. :param x: The agent to be registered :param simulation_priority: The simulation priority. Entities with lower priorities will be stepped first during Returns: .. py:method:: save_config(file_name: str) -> None Saves the config of the world as a yaml file :param file_name: Name of file to save the config to Returns: .. py:method:: assign_managers(factory_managers=Iterable[Union[str, Type[FactoryManager], FactoryManager]], params: Optional[Iterable[Dict[str, Any]]] = None) -> None Assigns existing factories to new factory managers created from the given types and parameters or manager objects. :param factory_managers: An iterable of `FactoryManager` objects type names or `FactoryManager` types to assign to :param params: parameters of the newly created managers Remarks: - factories are assigned in the same order they exist in the local `factories` attribute cycling through the input managers or types/params - If a `FactoryManager` object is given instead of a type or a string in the `factory_managers` collection, and the number of `factory_managers` is less than the number of factories in the world causing this object to cycle for more than one factory, it is assigned to the first such factory but then deep copies of it with new ids and names are assigned to the rest of the factories. That ensures that each manager has exactly one factory and that all factories are assigned exactly one unique manager. .. py:method:: random_small(n_production_levels: int = 1, n_factories: int = 10, factory_kwargs: Dict[str, Any] = None, miner_kwargs: Dict[str, Any] = None, consumer_kwargs: Dict[str, Any] = None, **kwargs) :classmethod: .. py:method:: chain_world(n_intermediate_levels=0, n_miners=5, n_factories_per_level=5, n_consumers: Union[int, Tuple[int, int], List[int]] = 5, n_steps=100, n_lines_per_factory=10, n_max_assignable_factories=None, log_file_name: str = None, agent_names_reveal_type: bool = False, negotiator_type: str = DEFAULT_NEGOTIATOR, miner_type: Union[str, Type[scml.scml2019.miners.Miner]] = ReactiveMiner, consumer_type: Union[str, Type[scml.scml2019.consumers.Consumer]] = JustInTimeConsumer, max_storage: int = sys.maxsize, default_manager_params: Dict[str, Any] = None, miner_kwargs: Dict[str, Any] = None, consumption: Union[int, Tuple[int, int]] = (0, 5), consumer_kwargs: Dict[str, Any] = None, negotiation_speed: Optional[int] = 21, manager_types: Sequence[Type[scml.scml2019.factory_managers.builtins.FactoryManager]] = (GreedyFactoryManager, ), manager_params: Optional[Sequence[Dict[str, Any]]] = None, n_default_per_level: int = 0, default_factory_manager_type: Type[scml.scml2019.factory_managers.builtins.FactoryManager] = GreedyFactoryManager, randomize: bool = True, initial_wallet_balances=1000, process_cost: Union[float, Tuple[float, float]] = (1.0, 5.0), process_time: Union[int, Tuple[int, int]] = 1, interest_rate=float('inf'), interest_max=float('inf'), shared_profile_per_factory=False, **kwargs) :classmethod: Creates a very small world in which only one raw material and one final product. The production graph is a series with `n_intermediate_levels` intermediate levels between the single raw material and single final product :param n_max_assignable_factories: The maximum number of factories assigned to managers other than the default :param randomize: If true, the factory assignment is randomized :param n_default_per_level: The number of `GreedyFactoryManager` objects guaranteed at every level :param default_factory_manager_type: The `FactoryManager` type to use as the base for default_factory_managers. You can specify how many of this type exist at every level by specifying `n_default_per_level`. If `n_default_per_level` is zero, this parameter has no effect. :param manager_types: A sequence of factory manager types to control the factories. :param manager_params: An optional sequence of dictionaries giving the parameters to pass to `manager_types`. :param consumer_type: Consumer type to use for all consumers :param miner_type: Miner type to use for all miners :param consumption: Consumption schedule :param n_intermediate_levels: The number of intermediate products :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 process_cost: The range of process costs. A uniform distribution will be used :param process_time: The range of process times. A uniform distribution will be used :param log_file_name: File name to store the logs :param agent_names_reveal_type: If true, agent names will start with a snake_case version of their type name :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 default_manager_params: keyword arguments to be used for constructing factory managers :param consumer_kwargs: keyword arguments to be used for constructing consumers :param miner_kwargs: keyword arguments to be used for constructing miners :param negotiation_speed: The number of negotiation steps per simulation step. None means infinite :param interest_max: Maximum interest rate :param interest_rate: Minimum interest rate :param initial_wallet_balances: initial wallet balances for all factories :param shared_profile_per_factory: If true, all lines in the same factory will have the same profile costs :param kwargs: Any other parameters are just passed to the world constructor :returns: SCML2019World ready to run Remarks: - Every production level n has one process only that takes n steps to complete .. py:method:: random(n_raw_materials: Union[int, Tuple[int, int]] = (5, 10), raw_material_price: Union[float, Tuple[float, float]] = (1.0, 30.0), n_final_products: Union[int, Tuple[int, int]] = (3, 5), n_production_levels: Union[int, Tuple[int, int]] = (3, 5), n_products_per_level: Union[int, Tuple[int, int]] = (3, 5), n_processes_per_level: Union[int, Tuple[int, int]] = (6, 10), n_inputs_per_process: Union[int, Tuple[int, int]] = (2, 5), bias_toward_last_level_products: float = 0.0, quantity_per_input: Union[int, Tuple[int, int]] = (1, 10), input_step: Union[float, Tuple[float, float]] = 0.0, quantity_per_output: Union[int, Tuple[int, int]] = (1, 1), output_step: Union[float, Tuple[float, float]] = 1.0, process_relative_cost: Union[float, Tuple[float, float]] = (0.05, 0.4), n_outputs_per_process: Union[int, Tuple[int, int]] = (1, 1), n_lines: Union[int, Tuple[int, int]] = (3, 5), lines_are_similar: bool = False, n_processes_per_line: Union[int, Tuple[int, int]] = None, cost_for_line: Union[float, Tuple[float, float]] = (5.0, 50.0), n_production_steps: Union[int, Tuple[int, int]] = (2, 10), max_storage: Union[int, Tuple[int, int]] = 2000, n_factories: Union[int, Tuple[int, int]] = 20, n_consumers: Union[int, Tuple[int, int]] = 5, n_products_per_consumer: Union[int, Tuple[int, int]] = None, n_miners: Union[int, Tuple[int, int]] = 5, n_products_per_miner: Optional[Union[int, Tuple[int, int]]] = None, factory_manager_types: Union[Type[scml.scml2019.factory_managers.builtins.FactoryManager], List[Type[scml.scml2019.factory_managers.builtins.FactoryManager]]] = GreedyFactoryManager, consumer_types: Union[Type[scml.scml2019.consumers.Consumer], List[Type[scml.scml2019.consumers.Consumer]]] = JustInTimeConsumer, miner_types: Union[Type[scml.scml2019.miners.Miner], List[Type[scml.scml2019.miners.Miner]]] = ReactiveMiner, negotiator_type=DEFAULT_NEGOTIATOR, initial_wallet_balance: Union[float, Tuple[float, float]] = 1000, factory_kwargs: Dict[str, Any] = None, miner_kwargs: Dict[str, Any] = None, consumer_kwargs: Dict[str, Any] = None, **kwargs) :classmethod: Creates a random SCML scenario with adjustable parameters. :param n_raw_materials: Number of raw materials. Can be a value or a range. :param raw_material_price: Catalog prices for raw materials. Can be a value or a range. :param n_final_products: Number of final products. Can be a value or a range. :param n_production_levels: How deep is the production graph (number of intermediate products). Can be a value or :param a range.: :param n_products_per_level: How many intermediate products per intermediate level. Can be a value or a range. :param n_processes_per_level: Number of processes in intermediate levels. Can be a value or a range. :param n_inputs_per_process: Number of inputs per process. Can be a value or a range. :param bias_toward_last_level_products: How biased are production processes toward using products from the last :param level below them: :type level below them: 0 means not bias, 1 means only sample from this last level :param quantity_per_input: How many items are needed for each input to a process. Can be a value or a range. :param input_step: When are inputs consumed during the production process. Can be a value or a range. Default 0 :param quantity_per_output: How many items are produced per output. Can be a value or a range. :param output_step: When are outputs created during the production process. Can be a value or a range. Default 1 :param process_relative_cost: Intrinsic relative cost of processes [Outputs will be produced :param at a cost of sum: :type at a cost of sum: input costs) * (1 + process_relative_cost :param n_outputs_per_process: Number of outputs per process. Can be a value or a range. :param n_lines: Number of lines per factory. Can be a value or a range. :param lines_are_similar: If true then all lins of the same factory will have the same production processes. :param n_processes_per_line: Number of processes that can be run on each line per factory. Can be a value or a :param range.: :param cost_for_line: Cost for running a process on a line. Can be a value or a range. :param n_production_steps: Number of production steps per line. Can be a value or a range. :param max_storage: Maximum storage per factory. Can be a value or a range. :param n_factories: Number of factories. Can be a value or a range. :param n_consumers: Number of consumers. Can be a value or a range. :param n_products_per_consumer: Number of products per miner. If None then all final products will be assigned to :param every customer. Can be a value or a range.: :param n_miners: Number of miners. Can be a value or a range. :param n_products_per_miner: Number of products per miner. If None then all raw materials will be assigned to every :param miner. Can be a value or a range.: :param factory_manager_types: A callable for creating factory managers for the factories :param consumer_types: A callable for creating `Consumer` objects :param miner_types: A callable for creating `Miner` objects :param negotiator_type: A string that can be `eval`uated to a negotiator. :param initial_wallet_balance: The initial balance of all wallets :param factory_kwargs: keyword arguments to be used for constructing factory managers :param consumer_kwargs: keyword arguments to be used for constructing consumers :param miner_kwargs: keyword arguments to be used for constructing miners :param \*\*kwargs: :returns: `SCML2019World` The random world generated Remarks: - Most parameters accept either a single value or a 2-valued tuple. In the later case, it will sample a value within the range specified by the tuple (low, high) inclusive. For example the number of lines (n_lines) follows this pattern .. py:method:: _update_dynamic_product_process_info() Updates the catalog prices of all products based on the prices of their inputs .. py:method:: set_consumers(consumers: List[scml.scml2019.consumers.Consumer]) .. py:method:: set_miners(miners: List[scml.scml2019.miners.Miner]) .. py:method:: set_factory_managers(factory_managers: Optional[List[scml.scml2019.factory_managers.builtins.FactoryManager]]) .. py:method:: set_processes(processes: Collection[scml.scml2019.common.Process]) .. py:method:: set_products(products: Collection[scml.scml2019.common.Product]) .. py:method:: order_contracts_for_execution(contracts: Collection[negmas.situated.Contract]) Orders the contracts in a specific time-step that are about to be executed .. py:method:: execute_action(action: negmas.situated.Action, agent: negmas.situated.Agent, callback: Callable[[negmas.situated.Action, bool], Any] = None) -> bool Executes the given action by the given agent .. py:method:: get_private_state(agent: negmas.situated.Agent) -> scml.scml2019.common.FactoryState Reads the private state of the given agent .. py:method:: receive_financial_reports(agent: scml.scml2019.agent.SCML2019Agent, receive: bool, agents: Optional[List[str]]) Registers interest/disinterest in receiving financial reports .. py:method:: simulation_step(stage) A step of SCML simulation .. 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:: post_step_stats() Saves relevant stats .. py:method:: start_contract_execution(contract: negmas.situated.Contract) -> Set[negmas.situated.Breach] 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:: _move_product(buyer: scml.scml2019.agent.SCML2019Agent, seller: scml.scml2019.agent.SCML2019Agent, product_id: int, quantity: int, money: float) Moves as much product and money between the buyer and seller .. py:method:: complete_contract_execution(contract: negmas.situated.Contract, breaches: List[negmas.situated.Breach], resolution: Optional[negmas.situated.Contract]) The resolution can either be None or a contract with the following items: The issues can be any or all of the following: immediate_quantity: int immediate_unit_price: float later_quantity: int later_unit_price: int later_penalty: float later_time: int .. py:method:: _move_product_force(buyer: scml.scml2019.agent.SCML2019Agent, seller: scml.scml2019.agent.SCML2019Agent, product_id: int, quantity: int, money: float) Moves as much product and money between the buyer and seller .. py:method:: register_interest(agent: scml.scml2019.agent.SCML2019Agent, products: List[int]) -> None .. py:method:: unregister_interest(agent: scml.scml2019.agent.SCML2019Agent, products: List[int]) -> None .. py:method:: make_bankrupt(agent: scml.scml2019.agent.SCML2019Agent, amount: float, beneficiary: negmas.situated.Agent, contract: Optional[negmas.situated.Contract]) -> None Marks the agent as bankrupt .. py:method:: nullify_contract(contract: negmas.situated.Contract) .. py:method:: evaluate_insurance(contract: negmas.situated.Contract, agent: scml.scml2019.agent.SCML2019Agent, t: int = None) -> Optional[float] Can be called to evaluate the premium for insuring the given contract against breachs committed by others :param agent: The agent buying the contract :param contract: hypothetical contract :param t: time at which the policy is to be bought. If None, it means current step .. py:method:: buy_insurance(contract: negmas.situated.Contract, agent: scml.scml2019.agent.SCML2019Agent) -> bool Buys insurance for the contract by the premium calculated by the insurance company. Remarks: The agent can call `evaluate_insurance` to find the premium that will be used. .. py:method:: _process_annotation(annotation: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]] Processes an annotation stripping any extra information not allowed if necessary. Will return None if the annotation is suspecious .. py:method:: run_negotiation(caller: negmas.situated.Agent, issues: Collection[negmas.outcomes.Issue], partners: Collection[negmas.situated.Agent], negotiator: negmas.Negotiator, ufun: negmas.UtilityFunction = None, caller_role: str = None, roles: Collection[str] = None, annotation: Optional[Dict[str, Any]] = None, mechanism_name: str = None, mechanism_params: Dict[str, Any] = None) -> Optional[Tuple[negmas.situated.Contract, negmas.NegotiatorMechanismInterface]] Runs a negotiation until completion :param caller: The agent requesting the negotiation :param partners: A list of partners to participate in the negotiation. Note that the caller itself may not be in this list which makes it possible for an agent to request a negotaition that it does not participate in. If that is not to be allowed in some world, override this method and explicitly check for these kinds of negotiations and return False. If partners is passed as a single string/`Agent` or as a list containing a single string/`Agent`, then he caller will be added at the beginning of the list. This will only be done if `roles` was passed as None. :param negotiator: The negotiator to be used in the negotiation :param preferences: The utility function. Only needed if the negotiator does not already know it :param caller_role: The role of the caller in the negotiation :param issues: Negotiation issues :param annotation: Extra information to be passed to the `partners` when asking them to join the negotiation :param partners: A list of partners to participate in the negotiation :param roles: The roles of different partners. If None then each role for each partner will be None :param mechanism_name: Name of the mechanism to use. It must be one of the mechanism_names that are supported by the :param `World` or None which means that the `World` should select the mechanism. If None: :param then `roles` and `my_role`: :param must also be None: :param mechanism_params: A dict of parameters used to initialize the mechanism object :returns: A Tuple of a contract and the nmi of the mechanism used to get it in case of success. None otherwise .. py:method:: run_negotiations(caller: negmas.situated.Agent, issues: Union[List[negmas.outcomes.Issue], List[List[negmas.outcomes.Issue]]], partners: List[List[negmas.situated.Agent]], negotiators: List[negmas.Negotiator], ufuns: List[negmas.UtilityFunction] = None, caller_roles: List[str] = None, roles: Optional[List[Optional[List[str]]]] = None, annotations: Optional[List[Optional[Dict[str, Any]]]] = None, mechanism_names: Optional[Union[str, List[str]]] = None, mechanism_params: Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] = None, all_or_none: bool = False) -> List[Tuple[negmas.situated.Contract, negmas.NegotiatorMechanismInterface]] Requests to run a set of negotiations simultaneously. Returns after all negotiations are run to completion :param caller: The agent requesting the negotiation :param partners: A list of list of partners to participate in the negotiation. Note that the caller itself may not be in this list which makes it possible for an agent to request a negotaition that it does not participate in. If that is not to be allowed in some world, override this method and explicitly check for these kinds of negotiations and return False. If partners[i] is passed as a single string/`Agent` or as a list containing a single string/`Agent`, then he caller will be added at the beginning of the list. This will only be done if `roles` was passed as None. :param issues: Negotiation issues :param negotiators: The negotiator to be used in the negotiation :param ufuns: The utility function. Only needed if the negotiator does not already know it :param caller_roles: The role of the caller in the negotiation :param annotations: Extra information to be passed to the `partners` when asking them to join the negotiation :param partners: A list of partners to participate in the negotiation :param roles: The roles of different partners. If None then each role for each partner will be None :param mechanism_names: Name of the mechanism to use. It must be one of the mechanism_names that are supported by the :param `World` or None which means that the `World` should select the mechanism. If None: :param then `roles` and `my_role`: :param must also be None: :param mechanism_params: A dict of parameters used to initialize the mechanism object :param all_of_none: If True, ALL partners must agree to negotiate to go through. :returns: contract (None for failure) and nmi (The mechanism info [None if the partner refused the negotiation]) :rtype: A list of tuples each with two values .. py:method:: request_negotiation_about(req_id: str, caller: negmas.situated.Agent, issues: List[negmas.outcomes.Issue], partners: List[negmas.situated.Agent], roles: List[str] = None, annotation: Optional[Dict[str, Any]] = None, mechanism_name: str = None, mechanism_params: Dict[str, Any] = None, group=None) Requests to start a negotiation with some other agents :param req_id: An ID For the request that is unique to the caller :param caller: The agent requesting the negotiation :param partners: A list of partners to participate in the negotiation. Note that the caller itself may not be in this list which makes it possible for an agent to request a negotaition that it does not participate in. If that is not to be allowed in some world, override this method and explicitly check for these kinds of negotiations and return False. If partners is passed as a single string/`Agent` or as a list containing a single string/`Agent`, then he caller will be added at the beginning of the list. This will only be done if `roles` was passed as None. :param issues: Negotiation issues :param annotation: Extra information to be passed to the `partners` when asking them to join the negotiation :param partners: A list of partners to participate in the negotiation :param roles: The roles of different partners. If None then each role for each partner will be None :param mechanism_name: Name of the mechanism to use. It must be one of the mechanism_names that are supported by the :param `World` or None which means that the `World` should select the mechanism. If None: :param then `roles` and `my_role`: :param must also be None: :param mechanism_params: A dict of parameters used to initialize the mechanism object :param group: An identifier for the group to which the negotiation belongs. This is not not used by the system. :returns: None. The caller will be informed by a callback function `on_neg_request_accepted` or `on_neg_request_rejected` about the status of the negotiation. .. py:property:: winners The winners of this world (factory managers with maximum wallet balance .. py:method:: on_event(event: negmas.events.Event, sender: negmas.events.EventSource) -> None Called whenever an event is raised for which the `SCML2020World` is registered asa listener :param event: The event :param sender: The sender :returns: None .. py:method:: contract_record(contract: negmas.situated.Contract) -> Dict[str, Any] Converts a contract to a record suitable for permanent storage .. py:method:: breach_record(breach: negmas.situated.Breach) -> Dict[str, Any] Converts a breach to a record suitable for storage during the simulation .. py:method:: contract_size(contract: negmas.situated.Contract) -> float Returns an estimation of the **activity level** associated with this contract. Higher is better :param contract: Returns: