scml.scml2020.common

Attributes

SYSTEM_SELLER_ID

ID of the system seller agent

SYSTEM_BUYER_ID

ID of the system buyer agent

COMPENSATION_ID

ID of the takeover agent

ANY_STEP

Used to indicate any time-step

ANY_LINE

Used to indicate any line

NO_COMMAND

A constant indicating no command is scheduled on a factory line

INFINITE_COST

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

QUANTITY

Index of quantity in negotiation issues

TIME

Index of time in negotiation issues

UNIT_PRICE

Index of unit price in negotiation issues

Classes

ExogenousContract

Represents a contract to be revealed at revelation_time to buyer and seller between them that is not agreed upon

FinancialReport

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

FactoryProfile

Defines all private information of a factory

Failure

A production failure

FactoryState

Functions

is_system_agent(→ bool)

Checks whether an agent is a system agent or not

Module Contents

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

ID of the system seller agent

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

ID of the system buyer agent

scml.scml2020.common.COMPENSATION_ID = 'COMPENSATOR'[source]

ID of the takeover agent

scml.scml2020.common.ANY_STEP[source]

Used to indicate any time-step

scml.scml2020.common.ANY_LINE[source]

Used to indicate any line

scml.scml2020.common.NO_COMMAND[source]

A constant indicating no command is scheduled on a factory line

scml.scml2020.common.INFINITE_COST[source]

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

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

Index of quantity in negotiation issues

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

Index of time in negotiation issues

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

Index of unit price in negotiation issues

scml.scml2020.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.scml2020.common.ExogenousContract[source]

Represents a contract to be revealed at revelation_time to buyer and seller between them that is not agreed upon through negotiation but is endogenously given

product: int[source]

Product

quantity: int[source]

Quantity

unit_price: int[source]

Unit price

time: int[source]

Delivery time

revelation_time: int[source]

Time at which to reveal the contract to both buyer and seller

seller: int[source]

Seller index in the agents array (-1 means “system”)

buyer: int[source]

Buyer index in the agents array (-1 means “system”)

class scml.scml2020.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.scml2020.common.FactoryProfile[source]

Defines all private information of a factory

__slots__ = ['costs'][source]
costs: numpy.ndarray[source]

An n_lines * n_processes array giving the cost of executing any process (INVALID_COST indicates infinity)

property n_lines[source]
property n_products[source]
property n_processes[source]
property processes: numpy.ndarray[source]

The processes that have valid costs

property input_products: numpy.ndarray[source]

The input products to all processes runnable (See processes )

property output_products: numpy.ndarray[source]

The output products to all processes runnable (See processes )

class scml.scml2020.common.Failure[source]

A production failure

__slots__ = ['is_inventory', 'line', 'step', 'process'][source]
is_inventory: bool[source]

True if the cause of failure was insufficient inventory. If False, the cause was insufficient funds. Note that if both conditions were true, only insufficient funds (is_inventory=False) will be reported.

line: int[source]

The line at which the failure happened

step: int[source]

The step at which the failure happened

process: int[source]

The process that failed to execute

class scml.scml2020.common.FactoryState[source]
inventory: numpy.ndarray[source]

An n_products vector giving current quantity of every product in storage

balance: int[source]

Current balance in the wallet

commands: numpy.ndarray[source]

n_steps * n_lines array giving the process scheduled on each line at every step for the whole simulation

inventory_changes: numpy.ndarray[source]

Changes in the inventory in the last step

balance_change: int[source]

Change in the balance in the last step

contracts: list[list[ContractInfo]][source]

The An n_steps list of lists containing the contracts of this agent by time-step

property n_lines: int[source]
property n_steps: int[source]
property n_products: int[source]
property n_processes: int[source]