scml.oneshot.common

Attributes

QUANTITY

Index of quantity in negotiation issues

TIME

Index of time in negotiation issues

UNIT_PRICE

Index of unit price in negotiation issues

INFINITE_COST

A constant indicating an invalid cost for lines incapable of running some process

SYSTEM_SELLER_ID

ID of the system seller agent

SYSTEM_BUYER_ID

ID of the system buyer agent

Classes

FinancialReport

A report published periodically by the system showing the financial standing of an agent

OneShotExogenousContract

Exogenous contract information

OneShotProfile

Defines all private information of a factory

OneShotState

State of a one-shot agent

Functions

is_system_agent(→ bool)

Checks whether an agent is a system agent or not

Module Contents

scml.oneshot.common.QUANTITY = 0[source]

Index of quantity in negotiation issues

scml.oneshot.common.TIME = 1[source]

Index of time in negotiation issues

scml.oneshot.common.UNIT_PRICE = 2[source]

Index of unit price in negotiation issues

scml.oneshot.common.INFINITE_COST[source]

A constant indicating an invalid cost for lines incapable of running some process

scml.oneshot.common.SYSTEM_SELLER_ID = 'SELLER'[source]

ID of the system seller agent

scml.oneshot.common.SYSTEM_BUYER_ID = 'BUYER'[source]

ID of the system buyer agent

scml.oneshot.common.is_system_agent(aid: str) bool[source]

Checks whether an agent is a system agent or not

Parameters:

aid – Agent ID

Returns:

True if the ID is for a system agent.

class scml.oneshot.common.FinancialReport[source]

A report published periodically by the system showing the financial standing of an agent

__slots__ = ['agent_id', 'step', 'cash', 'assets', 'breach_prob', 'breach_level', 'is_bankrupt', 'agent_name'][source]
agent_id: str[source]

Agent ID

step: int[source]

Simulation step at the beginning of which the report was published.

cash: int[source]

Cash in the agent’s wallet. Negative numbers indicate liabilities.

assets: int[source]

Value of the products in the agent’s inventory @ catalog prices.

breach_prob: float[source]

Number of times the agent breached a contract over the total number of contracts it signed.

breach_level: float[source]

Sum of the agent’s breach levels so far divided by the number of contracts it signed.

is_bankrupt: bool[source]

Whether the agent is already bankrupt (i.e. incapable of doing any more transactions).

agent_name: str[source]

Agent name for printing purposes

__str__()[source]

Return str(self).

class scml.oneshot.common.OneShotExogenousContract[source]

Exogenous contract information

__slots__ = ['quantity', 'unit_price', 'product', 'seller', 'buyer', 'time', 'revelation_time'][source]
quantity: int[source]

Contract quantity

unit_price: int[source]

Contract unit price

product: int[source]

Product index

seller: str[source]

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)

buyer: str[source]

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)

time: int[source]

Simulation step at which the contract is exceucted

revelation_time: int[source]

Simulation step at which the contract is revealed to its owner. Should not exceed time and the default generate() method sets it to time

class scml.oneshot.common.OneShotProfile[source]

Defines all private information of a factory

cost: float[source]

The cost of production

input_product: int[source]

The index of the input product (x for $L_x$ factories)

n_lines: int[source]

Number of lines for this factory

shortfall_penalty_mean: float[source]

A positive number specifying the average penalty for selling too much.

disposal_cost_mean: float[source]

A positive number specifying the average penalty buying too much.

shortfall_penalty_dev: float[source]

A positive number specifying the std. dev. of penalty for selling too much.

disposal_cost_dev: float[source]

A positive number specifying the std. dev. penalty buying too much.

storage_cost_mean: float[source]

A positive number specifying the average cost for keeping inventory for one step. This is only used if the products are not perishable.

storage_cost_dev: float[source]

A positive number specifying the std. dev. cost for keeping inventory for one step. This is only used if the products are not perishable.

property level[source]
property output_product[source]
property process[source]
classmethod random(input_product: int, oneshot: bool) OneShotProfile[source]
class scml.oneshot.common.OneShotState[source]

State of a one-shot agent

exogenous_input_quantity: int[source]

Exogenous input quantity for the current step

exogenous_input_price: int[source]

Exogenous input unit price for the current step

exogenous_output_quantity: int[source]

Exogenous output quantity for the current step

exogenous_output_price: int[source]

Exogenous output unit price for the current step

disposal_cost: float[source]

Current unit disposal cost

shortfall_penalty: float[source]

Current unit shortfall penalty

current_balance: int[source]

Current balance of the agent.

total_sales: int[source]

Total quantity registered as sales today using awi.register_sale.

total_supplies: int[source]

Total quantity registered as supplies today using awi.register_supply.

total_future_sales: int[source]

Total quantity registered as sales in the future using awi.register_sale.

total_future_supplies: int[source]

Total quantity registered as supplies in the future using awi.register_supply.

n_products: int[source]

Number of products in the production chain.

n_processes: int[source]

Number of processes in the production chain.

n_competitors: int[source]

Number of other factories on the same production level.

all_suppliers: list[list[str]][source]

A list of all suppliers by product.

all_consumers: list[list[str]][source]

A list of all consumers by product.

production_capacities: list[int][source]

A list of total production capacity per production level.

bankrupt_agents: list[str][source]

list of bankrupt agents

catalog_prices: list[float][source]

A list of the catalog prices (by product).

price_multiplier: float[source]

The multiplier multiplied by the trading/catalog price when the negotiation agendas are created to decide the maximum and lower quantities.

is_exogenous_forced: bool[source]

exogenous contracts always forced or can the agent decide not to sign them.

current_step: int[source]

Current simulation step (inherited from negmas.situated.AgentWorldInterface ).

n_steps: int[source]

Number of simulation steps (inherited from negmas.situated.AgentWorldInterface ).

relative_simulation_time: float[source]

Fraction of the simulation completed (inherited from negmas.situated.AgentWorldInterface).

profile: OneShotProfile[source]

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.

n_lines: int[source]

The number of production lines in the factory (private information).

is_first_level: bool[source]

Is the agent in the first production level (i.e. it is an input agent that buys the raw material).

is_last_level: bool[source]

Is the agent in the last production level (i.e. it is an output agent that sells the final product).

is_middle_level: bool[source]

Is the agent neither a first level nor a last level agent

my_input_product: int[source]

The input product to the factory controlled by the agent.

my_output_product: int[source]

The output product from the factory controlled by the agent.

level: int[source]

The production level which is numerically the same as the input product.

my_suppliers: list[str][source]

A list of IDs for all suppliers to the agent (i.e. agents that can sell the input product of the agent).

my_consumers: list[str][source]

A list of IDs for all consumers to the agent (i.e. agents that can buy the output product of the agent).

my_partners: list[str][source]

A list of IDs for all negotiation partners of the agent (in the order suppliers then consumers).

penalties_scale: Literal['trading', 'catalog', 'unit', 'none'][source]

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.

n_input_negotiations: int[source]

Number of negotiations with suppliers.

n_output_negotiations: int[source]

Number of negotiations with consumers.

trading_prices: list[float][source]

The trading prices of all products. This information is only available if publish_trading_prices is set in the world.

exogenous_contract_summary: list[tuple[int, int]][source]

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.

reports_of_agents: dict[str, dict[int, FinancialReport]][source]

Gives all past financial reports of a given agent. See FinancialReport for details.

current_input_outcome_space: negmas.outcomes.DiscreteCartesianOutcomeSpace[source]

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

current_output_outcome_space: negmas.outcomes.DiscreteCartesianOutcomeSpace[source]

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

current_negotiation_details: dict[str, dict[str, NegotiationDetails]][source]

Details on all current negotiations separated into “buy” and “sell” dictionaries.

sales: dict[str, int][source]

Today’s sales per customer so far.

supplies: dict[str, int][source]

Today supplies per supplier so far.

needed_sales: int[source]

Today’s needed sales as of now (exogenous input - exogenous output - total sales so far).

needed_supplies: int[source]

Today needed supplies as of now (exogenous output - exogenous input - total supplies).

perishable: bool = True[source]

Is this a perishable domain (oneshot) of not (std)

allow_zero_quantity: bool = False[source]

Does this world allow zero quantity in negotiated offers

storage_cost: float = 0.0[source]

Current unit storage cost. Only used in standard worlds where products are not perishable

property running_buy_states: dict[str, negmas.sao.common.SAOState][source]

All running buy negotiations as a mapping from partner ID to current negotiation state

property current_sell_states: dict[str, negmas.sao.common.SAOState][source]

All running sell negotiations as a mapping from partner ID to current negotiation state

property current_states: dict[str, negmas.sao.common.SAOState][source]

All running negotiations as a mapping from partner ID to current negotiation state

property current_buy_nmis: dict[str, negmas.sao.SAONMI][source]

All running buy negotiations as a mapping from partner ID to current negotiation nmi

property current_sell_nmis: dict[str, negmas.sao.SAONMI][source]

All running sell negotiations as a mapping from partner ID to current negotiation nmi

property current_nmis: dict[str, negmas.sao.SAONMI][source]

All running negotiations as a mapping from partner ID to current negotiation state

property current_buy_offers: dict[str, negmas.outcomes.Outcome][source]

All current buy negotiations as a mapping from partner ID to current offer

property current_sell_offers: dict[str, negmas.outcomes.Outcome][source]

All current sell negotiations as a mapping from partner ID to current offer

property current_offers: dict[str, negmas.outcomes.Outcome][source]

All current negotiations as a mapping from partner ID to current offer

classmethod random(oneshot: bool | None = None) OneShotState[source]