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

Safe HaskellNone
LanguageHaskell2010

ProductMixAuction.LP.Core

Contents

Description

Describes the basic structure of auctions and implements the translation into a linear programme. This does not include features that require multiple LP runs, such as the TQSS.

Synopsis

Core auction representation

data Auction bid Source #

Represents an auction that can be translated directly into a single run of a linear program.

Constructors

Auction 

Fields

data TotalSizeLimit Source #

Limit on the total quantity allocated by an auction, for use implementing a TQSS.

Constructors

FixedLimit Units

Limit the total quantity allocated to a constant.

TQSSLimit [Step Units]

Limit the total quantity allocated by the given TQSS steps.

mkAuction :: Supply Units -> [Bid bid] -> Auction bid Source #

Smart constructor for auctions, given a description of the supply curves and a list of bids, using sensible defaults for the other fields.

defaultPreferences :: Supply Units -> [Good] Source #

By default, the preference permutation for the supply lists the goods in reverse order, so that the highest good is most preferred.

auctionBidLabels :: Auction bid -> [bid] Source #

List labels of bids in the auction.

auctionGoodLabels :: Auction bid -> [Good] Source #

List labels of goods in the auction, in no particular order.

lookupBid :: Eq bid => bid -> Auction bid -> Maybe (Bid bid) Source #

Look up a bid in the auction by its label.

showAuction :: Show bid => Auction bid -> String Source #

Render an auction in a vaugely human-readable format.

mapAuction :: Ord bid' => (bid -> bid') -> Auction bid -> Auction bid' Source #

Change the representation of bid labels in an auction. Requires the codomain to have an Ord instance, hence not a Functor.

Results

data AuctionResult bid Source #

Results from a single run of the LP, including a price for each good and a quantity value for each primal variable.

Constructors

AuctionResult 

Fields

Instances

data AVar bid Source #

Variables used in the linear program corresponding to an auction.

Constructors

AllocVar bid Good

x^i_j, the amount of good j allocated to bid i

ExtraAllocVar Good

x^0_j, the amount of good j allocated to the "extra" bid

StepVar Good Int

y^q_j, the amount of good j allocated using step q of the supply curve

TQSSStepVar Int

t_l, the total amount allocated using step l of the TQSS

Instances

Eq bid => Eq (AVar bid) Source # 

Methods

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

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

Ord bid => Ord (AVar bid) Source # 

Methods

compare :: AVar bid -> AVar bid -> Ordering #

(<) :: AVar bid -> AVar bid -> Bool #

(<=) :: AVar bid -> AVar bid -> Bool #

(>) :: AVar bid -> AVar bid -> Bool #

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

max :: AVar bid -> AVar bid -> AVar bid #

min :: AVar bid -> AVar bid -> AVar bid #

Show bid => Show (AVar bid) Source # 

Methods

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

show :: AVar bid -> String #

showList :: [AVar bid] -> ShowS #

Solving a single auction LP

runAuctionCore :: Goodly bid => String -> Auction bid -> IO (AuctionResult bid) Source #

Convert the auction description to a linear program, solve it using GLPK and return the results.

Utilities

type Goodly x = (Ord x, Show x, Read x) Source #

Constraints that must be satisfied by the bid label types.

data AuctionException Source #

Errors that can be thrown when solving an auction

Constructors

GLPKFailed ReturnCode

LP solver failed to produce a result, with the given return code

SupplyCurveDecreasing Good

Good with the given label has a decreasing supply curve

TQSSDecreasing

TQSS step function is decreasing

TQSSEmpty

TQSS has no steps

TQSSMinAboveMax Units Units

Lower bound of TQSS search exceeds upper bound

TQSSGoodMissing Good

Single-good TQSS refers to a good not in the auction

TQSSBadLambda

Non-vertical auction with a non-zero supply scale lambda

TQSSFirstStepNonZero

First TQSS step has a non-zero price

TQSSFirstStepTooSmall Units Units

First TQSS step smaller than initial auction size

TQSSNormalisedNotHorizontal

Normalised prices used with a non-horizontal TQSS

MaxProfitComplexBid

Maximising profitability used with a generalised or asymmetric bid

MaxProfitNotHorizontal

Maximising profitability used with a non-horizontal TQSS

MaxProfitTQSS

Maximising profitability used with a TQSS

MaxProfitNoSolution

No solution when maximising profitability

Lenses

auction_supply :: forall bid. Lens' (Auction bid) (Supply Units) Source #

auction_bids :: forall bid. Lens' (Auction bid) [Bid bid] Source #

auction_scale :: forall bid. Lens' (Auction bid) ScaleFactor Source #

auction_preferences :: forall bid. Lens' (Auction bid) [Good] Source #

auction_constraints :: forall bid. Lens' (Auction bid) [AdditionalConstraint bid] Source #

auction_size_limit :: forall bid. Lens' (Auction bid) (Maybe TotalSizeLimit) Source #

auction_tweak_supply :: forall bid. Lens' (Auction bid) Bool Source #

auction_verbosity :: forall bid. Lens' (Auction bid) Verbosity Source #

ar_prices :: forall bid. Lens' (AuctionResult bid) (Map Good Price) Source #

ar_quantities :: forall bid bid. Lens (AuctionResult bid) (AuctionResult bid) (Map (AVar bid) Units) (Map (AVar bid) Units) Source #

ar_normalised_price :: forall bid. Lens' (AuctionResult bid) (Maybe Price) Source #