scml.oneshot.common =================== .. py:module:: scml.oneshot.common Attributes ---------- .. autoapisummary:: scml.oneshot.common.QUANTITY scml.oneshot.common.TIME scml.oneshot.common.UNIT_PRICE scml.oneshot.common.INFINITE_COST scml.oneshot.common.SYSTEM_SELLER_ID scml.oneshot.common.SYSTEM_BUYER_ID Classes ------- .. autoapisummary:: scml.oneshot.common.FinancialReport scml.oneshot.common.OneShotExogenousContract scml.oneshot.common.OneShotProfile scml.oneshot.common.OneShotState Functions --------- .. autoapisummary:: scml.oneshot.common.is_system_agent Module Contents --------------- .. py:data:: QUANTITY :value: 0 Index of quantity in negotiation issues .. py:data:: TIME :value: 1 Index of time in negotiation issues .. py:data:: UNIT_PRICE :value: 2 Index of unit price in negotiation issues .. py:data:: INFINITE_COST :value: 4611686018427387903 A constant indicating an invalid cost for lines incapable of running some process .. py:data:: SYSTEM_SELLER_ID :value: 'SELLER' ID of the system seller agent .. py:data:: SYSTEM_BUYER_ID :value: 'BUYER' ID of the system buyer agent .. py:function:: is_system_agent(aid: str) -> bool Checks whether an agent is a system agent or not :param aid: Agent ID :returns: True if the ID is for a system agent. .. py:class:: FinancialReport A report published periodically by the system showing the financial standing of an agent .. py:attribute:: __slots__ :value: ['agent_id', 'step', 'cash', 'assets', 'breach_prob', 'breach_level', 'is_bankrupt', 'agent_name'] .. py:attribute:: agent_id :type: str Agent ID .. py:attribute:: step :type: int Simulation step at the beginning of which the report was published. .. py:attribute:: cash :type: int Cash in the agent's wallet. Negative numbers indicate liabilities. .. py:attribute:: assets :type: int Value of the products in the agent's inventory @ catalog prices. .. py:attribute:: breach_prob :type: float Number of times the agent breached a contract over the total number of contracts it signed. .. py:attribute:: breach_level :type: float Sum of the agent's breach levels so far divided by the number of contracts it signed. .. py:attribute:: is_bankrupt :type: bool Whether the agent is already bankrupt (i.e. incapable of doing any more transactions). .. py:attribute:: agent_name :type: str Agent name for printing purposes .. py:method:: __str__() .. py:class:: OneShotExogenousContract Exogenous contract information .. py:attribute:: __slots__ :value: ['quantity', 'unit_price', 'product', 'seller', 'buyer', 'time', 'revelation_time'] .. py:attribute:: quantity :type: int Contract quantity .. py:attribute:: unit_price :type: int Contract unit price .. py:attribute:: product :type: int Product index .. py:attribute:: seller :type: str Seller ID (when passing contrtacts to the constructor of SCML2020OneShotWorld, you can also pass an interged index referring to the agent's index in the `agent_types` list) .. py:attribute:: buyer :type: str Buyer ID (when passing contrtacts to the constructor of SCML2020OneShotWorld, you can also pass an interged index referring to the agent's index in the `agent_types` list) .. py:attribute:: time :type: int Simulation step at which the contract is exceucted .. py:attribute:: revelation_time :type: int Simulation step at which the contract is revealed to its owner. Should not exceed `time` and the default `generate()` method sets it to time .. py:class:: OneShotProfile Defines all private information of a factory .. py:attribute:: cost :type: float The cost of production .. py:attribute:: input_product :type: int The index of the input product (x for $L_x$ factories) .. py:attribute:: n_lines :type: int Number of lines for this factory .. py:attribute:: shortfall_penalty_mean :type: float A positive number specifying the average penalty for selling too much. .. py:attribute:: disposal_cost_mean :type: float A positive number specifying the average penalty buying too much. .. py:attribute:: shortfall_penalty_dev :type: float A positive number specifying the std. dev. of penalty for selling too much. .. py:attribute:: disposal_cost_dev :type: float A positive number specifying the std. dev. penalty buying too much. .. py:attribute:: storage_cost_mean :type: float A positive number specifying the average cost for keeping inventory for one step. This is only used if the products are not `perishable`. .. py:attribute:: storage_cost_dev :type: float A positive number specifying the std. dev. cost for keeping inventory for one step. This is only used if the products are not `perishable`. .. py:property:: level .. py:property:: output_product .. py:property:: process .. py:method:: random(input_product: int, oneshot: bool) -> OneShotProfile :classmethod: .. py:class:: OneShotState State of a one-shot agent .. py:attribute:: exogenous_input_quantity :type: int Exogenous input quantity for the current step .. py:attribute:: exogenous_input_price :type: int Exogenous input unit price for the current step .. py:attribute:: exogenous_output_quantity :type: int Exogenous output quantity for the current step .. py:attribute:: exogenous_output_price :type: int Exogenous output unit price for the current step .. py:attribute:: disposal_cost :type: float Current unit disposal cost .. py:attribute:: shortfall_penalty :type: float Current unit shortfall penalty .. py:attribute:: current_balance :type: int Current balance of the agent. .. py:attribute:: total_sales :type: int Total quantity registered as sales today using `awi.register_sale`. .. py:attribute:: total_supplies :type: int Total quantity registered as supplies today using `awi.register_supply`. .. py:attribute:: total_future_sales :type: int Total quantity registered as sales in the future using `awi.register_sale`. .. py:attribute:: total_future_supplies :type: int Total quantity registered as supplies in the future using `awi.register_supply`. .. py:attribute:: n_products :type: int Number of products in the production chain. .. py:attribute:: n_processes :type: int Number of processes in the production chain. .. py:attribute:: n_competitors :type: int Number of other factories on the same production level. .. py:attribute:: all_suppliers :type: list[list[str]] A list of all suppliers by product. .. py:attribute:: all_consumers :type: list[list[str]] A list of all consumers by product. .. py:attribute:: production_capacities :type: list[int] A list of total production capacity per production level. .. py:attribute:: bankrupt_agents :type: list[str] list of bankrupt agents .. py:attribute:: catalog_prices :type: list[float] A list of the catalog prices (by product). .. py:attribute:: price_multiplier :type: float The multiplier multiplied by the trading/catalog price when the negotiation agendas are created to decide the maximum and lower quantities. .. py:attribute:: is_exogenous_forced :type: bool exogenous contracts always forced or can the agent decide not to sign them. .. py:attribute:: current_step :type: int Current simulation step (inherited from `negmas.situated.AgentWorldInterface` ). .. py:attribute:: n_steps :type: int Number of simulation steps (inherited from `negmas.situated.AgentWorldInterface` ). .. py:attribute:: relative_simulation_time :type: float Fraction of the simulation completed (inherited from `negmas.situated.AgentWorldInterface`). .. py:attribute:: profile :type: OneShotProfile Gives the agent profile including its production cost, number of production lines, input product index, mean of its delivery penalties, mean of its disposal costs, standard deviation of its shortfall penalties and standard deviation of its disposal costs. See `OneShotProfile` for full description. This information is private information and no other agent knows it. .. py:attribute:: n_lines :type: int The number of production lines in the factory (private information). .. py:attribute:: is_first_level :type: bool Is the agent in the first production level (i.e. it is an input agent that buys the raw material). .. py:attribute:: is_last_level :type: bool Is the agent in the last production level (i.e. it is an output agent that sells the final product). .. py:attribute:: is_middle_level :type: bool Is the agent neither a first level nor a last level agent .. py:attribute:: my_input_product :type: int The input product to the factory controlled by the agent. .. py:attribute:: my_output_product :type: int The output product from the factory controlled by the agent. .. py:attribute:: level :type: int The production level which is numerically the same as the input product. .. py:attribute:: my_suppliers :type: list[str] A list of IDs for all suppliers to the agent (i.e. agents that can sell the input product of the agent). .. py:attribute:: my_consumers :type: list[str] A list of IDs for all consumers to the agent (i.e. agents that can buy the output product of the agent). .. py:attribute:: my_partners :type: list[str] A list of IDs for all negotiation partners of the agent (in the order suppliers then consumers). .. py:attribute:: penalties_scale :type: Literal['trading', 'catalog', 'unit', 'none'] The scale at which to calculate disposal cost/delivery penalties. "trading" and "catalog" mean trading and catalog prices. "unit" means the contract's unit price while "none" means that disposal cost/shortfall penalty are absolute. .. py:attribute:: n_input_negotiations :type: int Number of negotiations with suppliers. .. py:attribute:: n_output_negotiations :type: int Number of negotiations with consumers. .. py:attribute:: trading_prices :type: list[float] The trading prices of all products. This information is only available if `publish_trading_prices` is set in the world. .. py:attribute:: exogenous_contract_summary :type: list[tuple[int, int]] A list of n_products lists each giving the total quantity and average price of exogenous contracts for a product. This information is only available if `publish_exogenous_summary` is set in the world. .. py:attribute:: reports_of_agents :type: dict[str, dict[int, FinancialReport]] Gives all past financial reports of a given agent. See `FinancialReport` for details. .. py:attribute:: current_input_outcome_space :type: negmas.outcomes.DiscreteCartesianOutcomeSpace The current issues for all negotiations to buy the input product of the agent. If the agent is at level zero, this will be empty. This is exactly the same as current_input_outcome_space.issues .. py:attribute:: current_output_outcome_space :type: negmas.outcomes.DiscreteCartesianOutcomeSpace The current issues for all negotiations to buy the output product of the agent. If the agent is at level n_products - 1, this will be empty. This is exactly the same as current_output_outcome_space.issues .. py:attribute:: current_negotiation_details :type: dict[str, dict[str, NegotiationDetails]] Details on all current negotiations separated into "buy" and "sell" dictionaries. .. py:attribute:: sales :type: dict[str, int] Today's sales per customer so far. .. py:attribute:: supplies :type: dict[str, int] Today supplies per supplier so far. .. py:attribute:: needed_sales :type: int Today's needed sales as of now (exogenous input - exogenous output - total sales so far). .. py:attribute:: needed_supplies :type: int Today needed supplies as of now (exogenous output - exogenous input - total supplies). .. py:attribute:: perishable :type: bool :value: True Is this a perishable domain (oneshot) of not (std) .. py:attribute:: allow_zero_quantity :type: bool :value: False Does this world allow zero quantity in negotiated offers .. py:attribute:: storage_cost :type: float :value: 0.0 Current unit storage cost. Only used in standard worlds where products are not perishable .. py:property:: running_buy_states :type: dict[str, negmas.sao.common.SAOState] All running buy negotiations as a mapping from partner ID to current negotiation state .. py:property:: current_sell_states :type: dict[str, negmas.sao.common.SAOState] All running sell negotiations as a mapping from partner ID to current negotiation state .. py:property:: current_states :type: dict[str, negmas.sao.common.SAOState] All running negotiations as a mapping from partner ID to current negotiation state .. py:property:: current_buy_nmis :type: dict[str, negmas.sao.SAONMI] All running buy negotiations as a mapping from partner ID to current negotiation nmi .. py:property:: current_sell_nmis :type: dict[str, negmas.sao.SAONMI] All running sell negotiations as a mapping from partner ID to current negotiation nmi .. py:property:: current_nmis :type: dict[str, negmas.sao.SAONMI] All running negotiations as a mapping from partner ID to current negotiation state .. py:property:: current_buy_offers :type: dict[str, negmas.outcomes.Outcome] All current buy negotiations as a mapping from partner ID to current offer .. py:property:: current_sell_offers :type: dict[str, negmas.outcomes.Outcome] All current sell negotiations as a mapping from partner ID to current offer .. py:property:: current_offers :type: dict[str, negmas.outcomes.Outcome] All current negotiations as a mapping from partner ID to current offer .. py:method:: random(oneshot: bool | None = None) -> OneShotState :classmethod: