scml.oneshot.rl.helpers
Helpers for the observation and action managers.
Module Contents
Functions
|
|
|
|
|
Encodes offers from the given partner groups into |
|
Encodes offers from the given partner groups into |
|
Inverts |
|
Normalize the offers to values between 0 and 1 for both quantity and unit price |
|
Reverses |
|
Normalizes x between 0 and 1 given that it is sampled from a normal (mu, sigma). |
|
|
|
|
|
- scml.oneshot.rl.helpers.recover_offers(encoded: numpy.ndarray, awi: scml.oneshot.common.OneShotState | scml.oneshot.awi.OneShotAWI, n_suppliers: int, n_consumers: int, max_group_size: int, continuous: bool, n_prices: int) dict[str, negmas.outcomes.Outcome | None] [source]
- scml.oneshot.rl.helpers.read_offers(state: scml.oneshot.awi.OneShotAWI | scml.oneshot.common.OneShotState, n_suppliers: int, n_consumers: int, max_group_size: int, continuous: bool) list[tuple[int, int]] | list[tuple[float, float]] [source]
- scml.oneshot.rl.helpers.encode_offers_with_time(offers: Mapping[str, negmas.outcomes.Outcome | None], partner_groups: list[list[str]], min_price: int, max_price: int) list[tuple[int, int, int]] [source]
Encodes offers from the given partner groups into
n_partners
tuples of quantity, unit-price values.- Parameters:
offers – All received offers. Keys are sources. Sources not in the
partner_groups
will be ignoredpartner_groups – A list of lists of partner IDs each defining a group to be considered together
min_price – Minimum allowed price
max_price – Maximum allowed price
- Returns:
A list of quantity, unit-price tuples of length
len(partner_groups)
.
- scml.oneshot.rl.helpers.encode_offers_no_time(offers: Mapping[str, negmas.outcomes.Outcome | None], partner_groups: list[list[str]], min_price: int, max_price: int) list[tuple[int, int]] [source]
Encodes offers from the given partner groups into
n_partners
tuples of quantity, unit-price values.- Parameters:
offers – All received offers. Keys are sources. Sources not in the
partner_groups
will be ignoredpartner_groups – A list of lists of partner IDs each defining a group to be considered together
min_price – Minimum allowed price
max_price – Maximum allowed price
- Returns:
A list of quantity, unit-price tuples of length
len(partner_groups)
.
- scml.oneshot.rl.helpers.decode_offers_no_time(encoded: numpy.ndarray | list[tuple[int, int]] | list[tuple[float, float]], n_suppliers: int, n_consumers: int, suppliers: list[list[str]], consumers: list[list[str]], step: int, continuous: bool, min_buy_price: int, min_sell_price: int, max_buy_price: int = -1, max_sell_price: int = -1, max_buy_quantity: int = -1, max_sell_quantity: int = -1, n_prices: int | None = None) dict[str, negmas.outcomes.Outcome | None] [source]
Inverts
encode_offers_no_time
- Remarks:
max_* are only needed if continuous is True
- scml.oneshot.rl.helpers.normalize_offers_no_time(offers: list[tuple[int, int]], min_price: int, max_price: int, min_quantity: int, max_quantity: int, subtract_min_price: int = False) list[tuple[float, float]] [source]
Normalize the offers to values between 0 and 1 for both quantity and unit price
- scml.oneshot.rl.helpers.unnormalize_offers(offers: list[tuple[float, float]], min_price: int, max_price: int, min_quantity: int, max_quantity: int, add_min_price: bool = False) list[tuple[int, int]] [source]
Reverses
normalize_offers
converting quantities and prices in the range 0,1 to integers