scml.oneshot.helper

Attributes

ANY_LINE

Used to indicate any line

ANY_STEP

Used to indicate any time-step

INFINITE_COST

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

NO_COMMAND

A constant indicating no command is scheduled on a factory line

Classes

FactoryProfile

Defines all private information of a factory

FactoryState

AWIHelper

The Agent SCML2020World Interface for SCML2020 world allowing a single process per agent

Functions

is_system_agent(→ bool)

Checks whether an agent is a system agent or not

Module Contents

scml.oneshot.helper.ANY_LINE[source]

Used to indicate any line

scml.oneshot.helper.ANY_STEP[source]

Used to indicate any time-step

scml.oneshot.helper.INFINITE_COST[source]

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

scml.oneshot.helper.NO_COMMAND[source]

A constant indicating no command is scheduled on a factory line

class scml.oneshot.helper.FactoryProfile[source]

Defines all private information of a factory

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

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

property n_lines
property n_products
property n_processes
property processes: numpy.ndarray

The processes that have valid costs

property input_products: numpy.ndarray

The input products to all processes runnable (See processes )

property output_products: numpy.ndarray

The output products to all processes runnable (See processes )

class scml.oneshot.helper.FactoryState[source]
inventory: numpy.ndarray

An n_products vector giving current quantity of every product in storage

balance: int

Current balance in the wallet

commands: numpy.ndarray

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

inventory_changes: numpy.ndarray

Changes in the inventory in the last step

balance_change: int

Change in the balance in the last step

contracts: list[list[ContractInfo]]

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

property n_lines: int
property n_steps: int
property n_products: int
property n_processes: int
scml.oneshot.helper.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.helper.AWIHelper(owner: scml.oneshot.adapter.OneShotSCML2020Adapter)[source]

The Agent SCML2020World Interface for SCML2020 world allowing a single process per agent

request_negotiations(is_buy: bool, product: int, quantity: int | tuple[int, int], unit_price: int | tuple[int, int], time: int | tuple[int, int], controller: negmas.sao.SAOController | None = None, negotiators: list[negmas.sao.SAONegotiator] | None = None, partners: list[str] | None = None, extra: dict[str, Any] | None = None, copy_partner_id=True) bool[source]
request_negotiation(is_buy: bool, product: int, quantity: int | tuple[int, int], unit_price: int | tuple[int, int], time: int | tuple[int, int], partner: str, negotiator: negmas.sao.SAONegotiator, extra: dict[str, Any] | None = None) bool[source]
schedule_production(process: int, repeats: int, step: int | tuple[int, int] = ANY_STEP, line: int = ANY_LINE, override: bool = True, method: str = 'latest', partial_ok: bool = False) tuple[numpy.ndarray, numpy.ndarray][source]
order_production(process: int, steps: numpy.ndarray, lines: numpy.ndarray) None[source]
available_for_production(repeats: int, step: int | tuple[int, int] = ANY_STEP, line: int = ANY_LINE, override: bool = True, method: str = 'latest') tuple[numpy.ndarray, numpy.ndarray][source]
set_commands(commands: numpy.ndarray, step: int = -1) None[source]
cancel_production(step: int, line: int) bool[source]
property trading_prices: numpy.ndarray | None[source]

Returns the current trading prices of all products

property current_balance: float[source]
property exogenous_contract_summary[source]
__getattr__(attr)[source]
property inputs: numpy.ndarray[source]

Returns the number of inputs to every production process

property outputs: numpy.ndarray[source]

Returns the number of outputs to every production process

property my_input_products: numpy.ndarray[source]

Returns a list of products that are inputs to at least one process the agent can run

property my_output_products: numpy.ndarray[source]

Returns a list of products that are outputs to at least one process the agent can run

is_system(aid: str) bool[source]

Checks whether an agent is a system agent or not

Parameters:

aid – Agent ID

property state: scml.scml2020.common.FactoryState[source]

Receives the factory state

property profile: scml.scml2020.common.FactoryProfile[source]

Gets the profile (static private information) associated with the agent

property allow_zero_quantity: bool[source]

Does negotiations allow zero quantity?