bnelearn.bidder module

Bidder module

This module implements players / bidders / agents in games.

class bnelearn.bidder.Bidder(strategy: Strategy, player_position: Optional[Tensor] = None, batch_size: int = 1, valuation_size: int = 1, observation_size: int = 1, bid_size: int = 1, cuda: str = True, enable_action_caching: bool = False, risk: float = 1.0)[source]

Bases: Player

A player in an auction game. Has a distribution over valuations/types that is common knowledge. These valuations correspond to the ´n_items´ available.

Attributes:

batch_size: corresponds to the number of individual auctions. descending_valuations: if is true, the valuations will be returned

in decreasing order.

enable_action_caching: determines whether actions should be cached and

retrieved from memory, rather than recomputed as long as valuations haven’t changed.

TODO …

property cached_observations
property cached_valuations
get_action(observations=None, deterministic: bool = False)[source]

Calculate action from given observations, or retrieve from cache

get_utility(allocations, payments, valuations=None)[source]

For a batch of valuations, allocations, and payments of the bidder, return their utility.

Can handle multiple batch dimensions, e.g. for allocations a shape of ( outer_batch_size, inner_batch_size, n_items). These batch dimensions are kept in returned payoff.

get_welfare(allocations, valuations=None)[source]

For a batch of allocations return the player’s welfare.

If valuations are not specified, welfare is calculated for self.valuations.

Can handle multiple batch dimensions, e.g. for valuations a shape of (…, batch_size, n_items). These batch dimensions are kept in returned welfare.

class bnelearn.bidder.CombinatorialBidder(**kwargs)[source]

Bases: Bidder

Bidder in combinatorial auctions.

Note: Currently only set up for full LLG setting.

get_welfare(allocations, valuations: Optional[Tensor] = None) Tensor[source]

For a batch of allocations return the player’s welfare.

If valuations are not specified, welfare is calculated for self.valuations.

Can handle multiple batch dimensions, e.g. for valuations a shape of (…, batch_size, n_items). These batch dimensions are kept in returned welfare.

class bnelearn.bidder.Contestant(strategy: Strategy, player_position: Optional[Tensor] = None, batch_size: int = 1, valuation_size: int = 1, observation_size: int = 1, bid_size: int = 1, cuda: str = True, enable_action_caching: bool = False, risk: float = 1.0)[source]

Bases: Bidder

get_utility(winning_probabilities, payments, valuations=None)[source]

For a batch of valuations, allocations, and payments of the contestant, return their utility.

Can handle multiple batch dimensions, e.g. for allocations a shape of ( outer_batch_size, inner_batch_size, n_items). These batch dimensions are kept in returned payoff.

get_welfare(payments, valuations=None)[source]

For a batch of allocations return the player’s welfare.

If valuations are not specified, welfare is calculated for self.valuations.

Can handle multiple batch dimensions, e.g. for valuations a shape of (…, batch_size, n_items). These batch dimensions are kept in returned welfare.

class bnelearn.bidder.CrowdsourcingContestant(strategy: Strategy, player_position: int, batch_size: int, enable_action_caching: bool = False, crowdsourcing_values: bool = True, value_contest: bool = True)[source]

Bases: Bidder

get_utility(allocations, payments, ability=None)[source]

For a batch of valuations, allocations, and payments of the contestant, return their utility.

Can handle multiple batch dimensions, e.g. for allocations a shape of ( outer_batch_size, inner_batch_size, n_items). These batch dimensions are kept in returned payoff.

class bnelearn.bidder.MatrixGamePlayer(strategy, player_position=None, batch_size=1, cuda=True)[source]

Bases: Player

A player playing a matrix game

get_action()[source]

Chooses an action according to the player’s strategy.

get_utility(*outcome)[source]

get player’s utility for a batch of outcomes

class bnelearn.bidder.Player(strategy, player_position=None, batch_size=1, cuda=True)[source]

Bases: ABC

A player in a game, determined by her - strategy - utility function over outcomes

abstract get_action()[source]

Chooses an action according to the player’s strategy.

abstract get_utility(*args, **kwargs)[source]

Calculates player’s utility based on outcome of a game.

class bnelearn.bidder.ReverseBidder(efficiency_parameter=None, **kwargs)[source]

Bases: Bidder

Bidder that has reversed utility \(\cdot (-1)\) as valuations correspond to their costs and payments to what they get payed.

get_utility(allocations, payments, valuations=None)[source]

For reverse bidders, returns are inverted.