scml.std.ufun

Module Contents

Classes

UtilityInfo

StdUFun

Calculates the utility function of a list of contracts or offers.

Attributes

UFunLimit

Information about one utility limit (either highest or lowest). See OnShotUFun.find_limit for details.

scml.std.ufun.UFunLimit[source]

Information about one utility limit (either highest or lowest). See OnShotUFun.find_limit for details.

class scml.std.ufun.UtilityInfo[source]
producible: int
total_input: int
total_output: int
shortfall_quantity: int
shortfall_penalty: float
remaining_quantity: int
disposal_cost: float
storage_cost: float
utility: float
class scml.std.ufun.StdUFun(ex_pin: int, ex_qin: int, ex_pout: int, ex_qout: int, input_product: int, input_agent: bool, output_agent: bool, production_cost: float, disposal_cost: float, storage_cost: float, shortfall_penalty: float, input_penalty_scale: float | None, output_penalty_scale: float | None, storage_penalty_scale: float | None, n_input_negs: int, n_output_negs: int, current_step: int, agent_id: str | None, time_range: tuple[int, int], inventory_in: int = 0, inventory_out: int = 0, input_qrange: tuple[int, int] = (0, 0), input_prange: tuple[int, int] = (0, 0), output_qrange: tuple[int, int] = (0, 0), output_prange: tuple[int, int] = (0, 0), force_exogenous: bool = True, n_lines: int = 10, normalized: bool = False, current_balance: int | float = float('inf'), suppliers: set[str] = set(), consumers: set[str] = set(), perishable=True, **kwargs)[source]

Bases: scml.oneshot.ufun.OneShotUFun

Calculates the utility function of a list of contracts or offers.

Parameters:
  • force_exogenous – Is the agent forced to accept exogenous contracts given through ex_* arguments?

  • ex_pin – total price of exogenous inputs for this agent

  • ex_qin – total quantity of exogenous inputs for this agent

  • ex_pout – total price of exogenous outputs for this agent

  • ex_qout – total quantity of exogenous outputs for this agent.

  • cost – production cost of the agent.

  • disposal_cost – disposal cost per unit of input/output.

  • shortfall_penalty – penalty for failure to deliver one unit of output.

  • input_agent – Is the agent an input agent which means that its input product is the raw material

  • output_agent – Is the agent an output agent which means that its output product is the final product

  • n_lines – Number of production lines. If None, will be read through the AWI.

  • input_product – Index of the input product. If None, will be read through the AWI

  • input_qrange – A 2-int tuple giving the range of input quantities negotiated. If not given will be read through the AWI

  • input_prange – A 2-int tuple giving the range of input unit prices negotiated. If not given will be read through the AWI

  • output_qrange – A 2-int tuple giving the range of output quantities negotiated. If not given will be read through the AWI

  • output_prange – A 2-int tuple giving the range of output unit prices negotiated. If not given will be read through the AWI

  • n_input_negs – How many input negotiations are allowed. If not given, it will be the number of suppliers as given by the AWI

  • n_output_negs – How many output negotiations are allowed. If not given, it will be the number of consumers as given by the AWI

  • current_step – Current simulation step. Needed only for ufun_range when returning best outcomes

  • normalized – If given the values returned by from_*, utility_range and __call__ will all be normalized between zero and one.

Remarks:
  • The utility function assumes that the agent will have to pay for all its input products but will receive money only for the output products it could generate and sell.

  • The utility function respects production capacity (n. lines). The agent cannot produce more than the number of lines it has.

  • disposal cost is paid for items bought but not produced only. Items consumed in production (i.e. sold) are not counted.