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

Safe HaskellNone
LanguageHaskell2010

ProductMixAuction.LP.Bid

Contents

Description

Representation of bids and bidders in LP auctions.

Synopsis

Representation types

data Bid bid Source #

Represents a potentially-paired bid on an arbitrary number of goods.

Constructors

Bid 

Fields

Instances

Functor Bid Source # 

Methods

fmap :: (a -> b) -> Bid a -> Bid b #

(<$) :: a -> Bid b -> Bid a #

Read bid => Read (Bid bid) Source # 

Methods

readsPrec :: Int -> ReadS (Bid bid) #

readList :: ReadS [Bid bid] #

readPrec :: ReadPrec (Bid bid) #

readListPrec :: ReadPrec [Bid bid] #

Show bid => Show (Bid bid) Source # 

Methods

showsPrec :: Int -> Bid bid -> ShowS #

show :: Bid bid -> String #

showList :: [Bid bid] -> ShowS #

Generic (Bid bid) Source # 

Associated Types

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

Methods

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

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

ToJSON bid => ToJSON (Bid bid) Source # 

Methods

toJSON :: Bid bid -> Value

toEncoding :: Bid bid -> Encoding

toJSONList :: [Bid bid] -> Value

toEncodingList :: [Bid bid] -> Encoding

FromJSON bid => FromJSON (Bid bid) Source # 

Methods

parseJSON :: Value -> Parser (Bid bid)

parseJSONList :: Value -> Parser [Bid bid]

type Rep (Bid bid) Source # 

data BidValue Source #

The data stored for each good by a bid.

Constructors

BidValue 

Fields

  • _bv_fraction :: TradeOff

    Trade-off coefficient, a^i_j. For symmetric bids, this will be 1 for every good.

  • _bv_quantity :: Units

    Maximum quantity of this good requested by the bid, kappa^i_j. For non-generalised bids this will equal bid_quantity. For generalised bids this should be less than bid_quantity (otherwise the constraint is irrelevant).

  • _bv_price :: TweakedPrice

    Price bid for the good (originally an integer but potentially tweaked when rationing).

Instances

Eq BidValue Source # 
Ord BidValue Source # 
Read BidValue Source # 
Show BidValue Source # 
Generic BidValue Source # 

Associated Types

type Rep BidValue :: * -> * #

Methods

from :: BidValue -> Rep BidValue x #

to :: Rep BidValue x -> BidValue #

ToJSON BidValue Source # 

Methods

toJSON :: BidValue -> Value

toEncoding :: BidValue -> Encoding

toJSONList :: [BidValue] -> Value

toEncodingList :: [BidValue] -> Encoding

FromJSON BidValue Source # 

Methods

parseJSON :: Value -> Parser BidValue

parseJSONList :: Value -> Parser [BidValue]

Default BidValue Source # 

Methods

def :: BidValue

type Rep BidValue Source # 
type Rep BidValue = D1 (MetaData "BidValue" "ProductMixAuction.LP.Bid" "product-mix-auction-0.1.0.0-inplace" False) (C1 (MetaCons "BidValue" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_bv_fraction") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TradeOff)) ((:*:) (S1 (MetaSel (Just Symbol "_bv_quantity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Units)) (S1 (MetaSel (Just Symbol "_bv_price") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TweakedPrice)))))

Smart constructors

mkEmptyBid :: bid -> Bid bid Source #

The zero bid for no goods.

mkUnitBid :: bid -> Good -> Price -> Bid bid Source #

Make a bid for a single unit of a single good.

mkSingleBid :: bid -> Good -> Price -> Units -> Bid bid Source #

Make a non-paired bid, i.e. a simple bid on a single good.

mkSymmetricBid :: bid -> Units -> [(Good, Price)] -> Bid bid Source #

Make a symmetric bid on multiple goods with varying prices, but with a constant number of units.

mkAsymmetricBid :: bid -> Units -> [(Good, (TradeOff, Price))] -> Bid bid Source #

Make an asymmetric bid on multiple goods, where the quantity requested and the denominator of the fraction of quantity for each good are specified explicitly.

mkGeneralisedBid :: bid -> Units -> [(Good, (Units, Price))] -> Bid bid Source #

Make a symmetric generalised bid, which differentiates the number of units requested for each good (kappa^i_j) from the total number of units requested (k_i). Note that kappa^i_j must be less than or equal to k_i.

mkAsymmetricGeneralisedBid :: bid -> Units -> [(Good, (TradeOff, Units, Price))] -> Bid bid Source #

Make an asymmetric, generalised bid, which differentiates the number of units requested for each good (kappa^i_j) from the total number of units requested (k_i). Note that kappa^i_j must be less than or equal to k_i. The trade-off coefficient for each good (a^i_j) must be specified explicitly.

Properties of bids

bidName :: Show bid => Bid bid -> String Source #

An identifying name for this bid, which might be explicitly specified or derived from the label.

bidFraction :: Bid bid -> Good -> TradeOff Source #

Look up the denominator of the fraction of the total quantity that applies to this good (i.e. a_ij).

bidQuantityOf :: Bid bid -> Good -> Units Source #

Look up the quantity of a particular good requested by a bid (i.e. kappa^i_j).

bidDemandQuantity :: Bid bid -> Good -> Units Source #

The quantity of this good demanded by this bid, adjusted for asymmetric bids, and ignoring bidding on other goods.

bidValue :: Bid bid -> Good -> TweakedPrice Source #

Look up the price bid for a particular good (i.e. v^i_j).

isGeneralised :: Bid bid -> Bool Source #

Is this a generalised paired bid? (That is, is there a good for which the maximum quantity is less than the maximum quantity for the entire bid?)

isAsymmetric :: Bid bid -> Bool Source #

Is this an asymmetric bid? (That is, is there a good for which the trade-off coefficient is not 1?)

showBid :: Show bid => Bid bid -> String Source #

Pretty-print a bid.

Bidders

data Bidder bid Source #

A bidder is essentially just a collection of bids, as far as the program is concerned, associated together for reasons of presentation.

Constructors

Bidder 

Fields

Instances

Show bid => Show (Bidder bid) Source # 

Methods

showsPrec :: Int -> Bidder bid -> ShowS #

show :: Bidder bid -> String #

showList :: [Bidder bid] -> ShowS #

Generic (Bidder bid) Source # 

Associated Types

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

Methods

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

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

ToJSON bid => ToJSON (Bidder bid) Source # 

Methods

toJSON :: Bidder bid -> Value

toEncoding :: Bidder bid -> Encoding

toJSONList :: [Bidder bid] -> Value

toEncodingList :: [Bidder bid] -> Encoding

FromJSON bid => FromJSON (Bidder bid) Source # 

Methods

parseJSON :: Value -> Parser (Bidder bid)

parseJSONList :: Value -> Parser [Bidder bid]

type Rep (Bidder bid) Source # 
type Rep (Bidder bid) = D1 (MetaData "Bidder" "ProductMixAuction.LP.Bid" "product-mix-auction-0.1.0.0-inplace" False) (C1 (MetaCons "Bidder" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_bidder_name") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 BidderName)) (S1 (MetaSel (Just Symbol "_bidder_bids") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Bid bid]))))

Lenses

bid_label :: forall bid bid. Lens (Bid bid) (Bid bid) bid bid Source #

bid_name :: forall bid. Lens' (Bid bid) (Maybe String) Source #

bid_quantity :: forall bid. Lens' (Bid bid) Units Source #

bid_values :: forall bid. Lens' (Bid bid) (Map Good BidValue) Source #

bidder_name :: forall bid. Lens' (Bidder bid) BidderName Source #

bidder_bids :: forall bid bid. Lens (Bidder bid) (Bidder bid) [Bid bid] [Bid bid] Source #