scml.scml2020.common ==================== .. py:module:: scml.scml2020.common Attributes ---------- .. autoapisummary:: scml.scml2020.common.SYSTEM_SELLER_ID scml.scml2020.common.SYSTEM_BUYER_ID scml.scml2020.common.COMPENSATION_ID scml.scml2020.common.ANY_STEP scml.scml2020.common.ANY_LINE scml.scml2020.common.NO_COMMAND scml.scml2020.common.INFINITE_COST scml.scml2020.common.QUANTITY scml.scml2020.common.TIME scml.scml2020.common.UNIT_PRICE Classes ------- .. autoapisummary:: scml.scml2020.common.ExogenousContract scml.scml2020.common.FinancialReport scml.scml2020.common.FactoryProfile scml.scml2020.common.Failure scml.scml2020.common.FactoryState Functions --------- .. autoapisummary:: scml.scml2020.common.is_system_agent Module Contents --------------- .. 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:data:: COMPENSATION_ID :value: 'COMPENSATOR' ID of the takeover agent .. py:data:: ANY_STEP :value: -1 Used to indicate any time-step .. py:data:: ANY_LINE :value: -1 Used to indicate any line .. py:data:: NO_COMMAND :value: -1 A constant indicating no command is scheduled on a factory line .. py:data:: INFINITE_COST :value: 4611686018427387903 A constant indicating an invalid cost for lines incapable of running some process .. 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: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:: ExogenousContract 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 .. py:attribute:: product :type: int Product .. py:attribute:: quantity :type: int Quantity .. py:attribute:: unit_price :type: int Unit price .. py:attribute:: time :type: int Delivery time .. py:attribute:: revelation_time :type: int Time at which to reveal the contract to both buyer and seller .. py:attribute:: seller :type: int :value: -1 Seller index in the agents array (-1 means "system") .. py:attribute:: buyer :type: int :value: -1 Buyer index in the agents array (-1 means "system") .. 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:: FactoryProfile Defines all private information of a factory .. py:attribute:: __slots__ :value: ['costs'] .. py:attribute:: costs :type: numpy.ndarray An n_lines * n_processes array giving the cost of executing any process (INVALID_COST indicates infinity) .. py:property:: n_lines .. py:property:: n_products .. py:property:: n_processes .. py:property:: processes :type: numpy.ndarray The processes that have valid costs .. py:property:: input_products :type: numpy.ndarray The input products to all processes runnable (See `processes` ) .. py:property:: output_products :type: numpy.ndarray The output products to all processes runnable (See `processes` ) .. py:class:: Failure A production failure .. py:attribute:: __slots__ :value: ['is_inventory', 'line', 'step', 'process'] .. py:attribute:: is_inventory :type: bool 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. .. py:attribute:: line :type: int The line at which the failure happened .. py:attribute:: step :type: int The step at which the failure happened .. py:attribute:: process :type: int The process that failed to execute .. py:class:: FactoryState .. py:attribute:: inventory :type: numpy.ndarray An n_products vector giving current quantity of every product in storage .. py:attribute:: balance :type: int Current balance in the wallet .. py:attribute:: commands :type: numpy.ndarray n_steps * n_lines array giving the process scheduled on each line at every step for the whole simulation .. py:attribute:: inventory_changes :type: numpy.ndarray Changes in the inventory in the last step .. py:attribute:: balance_change :type: int Change in the balance in the last step .. py:attribute:: contracts :type: list[list[ContractInfo]] The An n_steps list of lists containing the contracts of this agent by time-step .. py:property:: n_lines :type: int .. py:property:: n_steps :type: int .. py:property:: n_products :type: int .. py:property:: n_processes :type: int