product-mix-auction-0.1.0.0: A single-round sealed-bid auction for multiple goods

Safe HaskellNone
LanguageHaskell2010

ProductMixAuction.LP

Contents

Description

This is the main module for solving standard Product-Mix Auctions using linear programming, possibly involving multiple runs of the LP solver for some features. See Core for translating and running basic auctions using a single LP solver iteration.

Synopsis

Inputs

data AuctionInput bid Source #

Inputs for a Product-Mix Auction to be solved using linear programming. This supports advanced features that may require multiple iterations of the LP solver, unlike Auction, which represents the data provided for a single iteration.

Constructors

AuctionInput 

Fields

Instances

Show bid => Show (AuctionInput bid) Source # 
Generic (AuctionInput bid) Source # 

Associated Types

type Rep (AuctionInput bid) :: * -> * #

Methods

from :: AuctionInput bid -> Rep (AuctionInput bid) x #

to :: Rep (AuctionInput bid) x -> AuctionInput bid #

(ToJSONKey bid, ToJSON bid) => ToJSON (AuctionInput bid) Source # 

Methods

toJSON :: AuctionInput bid -> Value

toEncoding :: AuctionInput bid -> Encoding

toJSONList :: [AuctionInput bid] -> Value

toEncodingList :: [AuctionInput bid] -> Encoding

(Ord bid, FromJSONKey bid, FromJSON bid) => FromJSON (AuctionInput bid) Source # 

Methods

parseJSON :: Value -> Parser (AuctionInput bid)

parseJSONList :: Value -> Parser [AuctionInput bid]

Default (AuctionInput bid) Source # 

Methods

def :: AuctionInput bid

type Rep (AuctionInput bid) Source # 
type Rep (AuctionInput bid) = D1 (MetaData "AuctionInput" "ProductMixAuction.LP" "product-mix-auction-0.1.0.0-inplace" False) (C1 (MetaCons "AuctionInput" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_ac_supply") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Supply Units))) (S1 (MetaSel (Just Symbol "_ac_bidders") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Bidder bid]))) ((:*:) (S1 (MetaSel (Just Symbol "_ac_scale") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ScaleFactor)) ((:*:) (S1 (MetaSel (Just Symbol "_ac_tqss") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe (TQSS TQSSTable)))) (S1 (MetaSel (Just Symbol "_ac_demand_curves") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [DemandCurveType]))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_ac_ration") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 RationingOptions)) ((:*:) (S1 (MetaSel (Just Symbol "_ac_preferences") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Good])) (S1 (MetaSel (Just Symbol "_ac_constraints") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [AdditionalConstraint (BidderName, bid)])))) ((:*:) (S1 (MetaSel (Just Symbol "_ac_verbosity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Verbosity)) ((:*:) (S1 (MetaSel (Just Symbol "_ac_maximise") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Maximise)) (S1 (MetaSel (Just Symbol "_ac_shuffle") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Shuffle)))))))

data Maximise Source #

Constructors

MaxEfficiency

A standard LP auction, in which efficiency is maximised

MaxProfit

An auction in which the auctioneer's profit is maximised, not solved using an LP

Instances

Bounded Maximise Source # 
Enum Maximise Source # 
Eq Maximise Source # 
Show Maximise Source # 
Generic Maximise Source # 

Associated Types

type Rep Maximise :: * -> * #

Methods

from :: Maximise -> Rep Maximise x #

to :: Rep Maximise x -> Maximise #

ToJSON Maximise Source # 

Methods

toJSON :: Maximise -> Value

toEncoding :: Maximise -> Encoding

toJSONList :: [Maximise] -> Value

toEncodingList :: [Maximise] -> Encoding

FromJSON Maximise Source # 

Methods

parseJSON :: Value -> Parser Maximise

parseJSONList :: Value -> Parser [Maximise]

Default Maximise Source # 

Methods

def :: Maximise

Arbitrary Maximise Source # 
type Rep Maximise Source # 
type Rep Maximise = D1 (MetaData "Maximise" "ProductMixAuction.LP" "product-mix-auction-0.1.0.0-inplace" False) ((:+:) (C1 (MetaCons "MaxEfficiency" PrefixI False) U1) (C1 (MetaCons "MaxProfit" PrefixI False) U1))

data Shuffle Source #

Constructors

NoShuffle

Keep order of bid labels as in input

ShuffleBids

Randomize the order of bid labels (across all bidders)

Instances

Bounded Shuffle Source # 
Enum Shuffle Source # 
Eq Shuffle Source # 

Methods

(==) :: Shuffle -> Shuffle -> Bool #

(/=) :: Shuffle -> Shuffle -> Bool #

Show Shuffle Source # 
Generic Shuffle Source # 

Associated Types

type Rep Shuffle :: * -> * #

Methods

from :: Shuffle -> Rep Shuffle x #

to :: Rep Shuffle x -> Shuffle #

ToJSON Shuffle Source # 

Methods

toJSON :: Shuffle -> Value

toEncoding :: Shuffle -> Encoding

toJSONList :: [Shuffle] -> Value

toEncodingList :: [Shuffle] -> Encoding

FromJSON Shuffle Source # 

Methods

parseJSON :: Value -> Parser Shuffle

parseJSONList :: Value -> Parser [Shuffle]

Default Shuffle Source # 

Methods

def :: Shuffle

type Rep Shuffle Source # 
type Rep Shuffle = D1 (MetaData "Shuffle" "ProductMixAuction.LP" "product-mix-auction-0.1.0.0-inplace" False) ((:+:) (C1 (MetaCons "NoShuffle" PrefixI False) U1) (C1 (MetaCons "ShuffleBids" PrefixI False) U1))

mkAuctionInput :: Ord bid => Supply Units -> [Bidder bid] -> Maybe (TQSS TQSSTable) -> AuctionInput bid Source #

Given a supply of goods and some bidders, create an auction input with sensible defaults.

flattenBidders :: [Bidder bid] -> [Bid (BidderName, bid)] Source #

Flatten a list of bidders to produce a list of bids annotated with the bidder name.

Outputs

data AuctionOutput bid Source #

Outputs from running a Product-Mix Auction.

Constructors

AuctionOutput 

Fields

Instances

Eq bid => Eq (AuctionOutput bid) Source # 

Methods

(==) :: AuctionOutput bid -> AuctionOutput bid -> Bool #

(/=) :: AuctionOutput bid -> AuctionOutput bid -> Bool #

Show bid => Show (AuctionOutput bid) Source # 
Generic (AuctionOutput bid) Source # 

Associated Types

type Rep (AuctionOutput bid) :: * -> * #

Methods

from :: AuctionOutput bid -> Rep (AuctionOutput bid) x #

to :: Rep (AuctionOutput bid) x -> AuctionOutput bid #

(Ord bid, ToJSONKey bid, ToJSON bid) => ToJSON (AuctionOutput bid) Source # 

Methods

toJSON :: AuctionOutput bid -> Value

toEncoding :: AuctionOutput bid -> Encoding

toJSONList :: [AuctionOutput bid] -> Value

toEncodingList :: [AuctionOutput bid] -> Encoding

(Ord bid, FromJSONKey bid, FromJSON bid) => FromJSON (AuctionOutput bid) Source # 

Methods

parseJSON :: Value -> Parser (AuctionOutput bid)

parseJSONList :: Value -> Parser [AuctionOutput bid]

Default (AuctionOutput bid) Source # 

Methods

def :: AuctionOutput bid

(Arbitrary bid, Ord bid) => Arbitrary (AuctionOutput bid) Source # 

Methods

arbitrary :: Gen (AuctionOutput bid)

shrink :: AuctionOutput bid -> [AuctionOutput bid]

type Rep (AuctionOutput bid) Source # 

Running auctions

runAuction :: Goodly bid => AuctionInput bid -> IO (AuctionOutput bid) Source #

Run a Product-Mix Auction as specified by the inputs, and produce the corresponding outputs.

Lenses

ac_supply :: forall bid. Lens' (AuctionInput bid) (Supply Units) Source #

ac_bidders :: forall bid. Lens' (AuctionInput bid) [Bidder bid] Source #

ac_scale :: forall bid. Lens' (AuctionInput bid) ScaleFactor Source #

ac_tqss :: forall bid. Lens' (AuctionInput bid) (Maybe (TQSS TQSSTable)) Source #

ac_ration :: forall bid. Lens' (AuctionInput bid) RationingOptions Source #

ac_preferences :: forall bid. Lens' (AuctionInput bid) [Good] Source #

ac_verbosity :: forall bid. Lens' (AuctionInput bid) Verbosity Source #

ac_maximise :: forall bid. Lens' (AuctionInput bid) Maximise Source #

ao_prices :: forall bid. Lens' (AuctionOutput bid) (Map Good Price) Source #

ao_bid_allocations :: forall bid bid. Lens (AuctionOutput bid) (AuctionOutput bid) (Map (BidderName, bid) (Map Good Units)) (Map (BidderName, bid) (Map Good Units)) Source #

ao_good_allocations :: forall bid. Lens' (AuctionOutput bid) (Map Good Units) Source #

ao_tqss_total_supply :: forall bid. Lens' (AuctionOutput bid) (Maybe Units) Source #

ao_normalised_price :: forall bid. Lens' (AuctionOutput bid) (Maybe Price) Source #

ao_tqss_points :: forall bid. Lens' (AuctionOutput bid) (Maybe [TQSSPoint]) Source #

ao_demand_curves :: forall bid. Lens' (AuctionOutput bid) (Map Good [DemandCurve]) Source #

ao_profit :: forall bid. Lens' (AuctionOutput bid) (Maybe Price) Source #