Safe Haskell | None |
---|---|
Language | Haskell2010 |
ProductMixAuction.LP.Rationing
Description
Implements different strategies for rationing (sharing limited quantities of goods between multiple marginal bidders).
- type RationingStrategy bid = Auction bid -> AuctionResult bid -> IO (Map bid (Map Good Units))
- rationNoRationing :: Ord bid => RationingStrategy bid
- rationLinearDemand :: Goodly bid => Maybe RationingSteps -> Maybe (Map Good Int) -> RationingStrategy bid
- rationLinearDemandPreferPairedBids :: Goodly bid => Maybe RationingSteps -> Maybe (Map Good Int) -> RationingStrategy bid
- data RationingMode
- newtype RationingSteps = RationingSteps {}
- data RationingOptions = RationingOptions {}
- noRationing :: RationingOptions
- linearDemand :: Maybe RationingSteps -> RationingOptions
- linearDemandPreferPairedBids :: Maybe RationingSteps -> RationingOptions
- runRationingOptions :: Goodly bid => RationingOptions -> RationingStrategy bid
- goodAllocations :: ScaleFactor -> Map bid (Map Good Units) -> Map Good Units
- bidderAllocations :: Ord bidder => ScaleFactor -> Map (bidder, bid) (Map Good Units) -> Map bidder (Map Good Units)
- bidAllocations :: Ord bid => ScaleFactor -> Map bid (Map Good Units) -> Map bid (Map Good Units)
- filterAllocs :: Ord bid => Map bid (Map Good Units) -> Map bid (Map Good Units)
- ro_mode :: Lens' RationingOptions RationingMode
- ro_steps :: Lens' RationingOptions (Maybe RationingSteps)
Rationing strategies
type RationingStrategy bid = Auction bid -> AuctionResult bid -> IO (Map bid (Map Good Units)) Source #
A rationing strategy takes an auction and the results of solving its LP (in particular, the auction prices), and computes a possibly-fairer allocation of goods. It may not change the prices.
rationNoRationing :: Ord bid => RationingStrategy bid Source #
Rationing strategy A: let the linear programme do what it will do, and don't do anything about it.
The LP solver may make arbitrary choices as to which marginal bids receive goods and which do not. There is no guarantee of fairness between bids, but this is simple and fast.
rationLinearDemand :: Goodly bid => Maybe RationingSteps -> Maybe (Map Good Int) -> RationingStrategy bid Source #
Rationing strategy D: tweak marginal bids to approximate a linear demand around the bid price, then re-run the auction to find adjusted allocations.
rationLinearDemandPreferPairedBids :: Goodly bid => Maybe RationingSteps -> Maybe (Map Good Int) -> RationingStrategy bid Source #
Rationing strategy D(i): tweak multiply-marginal bids to approximate a linear demand around the bid price, re-run the auction to find adjusted allocations, then reallocate to treat equally bids that are marginal on single goods.
This is the default strategy.
First-order representation
data RationingMode Source #
Enumeration of supported choices of rationing strategy.
Constructors
LinearDemandPreferPairedBids | |
LinearDemand | See |
NoRationing | See |
Instances
Eq RationingMode Source # | |
Show RationingMode Source # | |
Generic RationingMode Source # | |
ToJSON RationingMode Source # | |
FromJSON RationingMode Source # | |
Default RationingMode Source # | |
type Rep RationingMode Source # | |
newtype RationingSteps Source #
Number of steps to use in rationing strategies that use a step-wise approximation of linear demand.
Constructors
RationingSteps | |
Fields |
Instances
Eq RationingSteps Source # | |
Num RationingSteps Source # | |
Ord RationingSteps Source # | |
Show RationingSteps Source # | |
Generic RationingSteps Source # | |
ToJSON RationingSteps Source # | |
FromJSON RationingSteps Source # | |
Default RationingSteps Source # | |
type Rep RationingSteps Source # | |
data RationingOptions Source #
First-order representation of a choice of rationing strategy and any required parameters.
Constructors
RationingOptions | |
Fields
|
Instances
Eq RationingOptions Source # | |
Show RationingOptions Source # | |
Generic RationingOptions Source # | |
ToJSON RationingOptions Source # | |
FromJSON RationingOptions Source # | |
Default RationingOptions Source # | |
type Rep RationingOptions Source # | |
runRationingOptions :: Goodly bid => RationingOptions -> RationingStrategy bid Source #
Translate the first-order representation into the appropriate rationing strategy.
Summarising allocations
goodAllocations :: ScaleFactor -> Map bid (Map Good Units) -> Map Good Units Source #
Calculate the total allocation to each good, rounded to the appropriate scale. All goods are included.
bidderAllocations :: Ord bidder => ScaleFactor -> Map (bidder, bid) (Map Good Units) -> Map bidder (Map Good Units) Source #
Calculate the total allocation of each good to each bidder, rounded to the appropriate scale. Unsuccessful bidders are excluded from the map.
bidAllocations :: Ord bid => ScaleFactor -> Map bid (Map Good Units) -> Map bid (Map Good Units) Source #
Round the allocations to the appropriate scale and exclude unsuccessful bids from the map.
filterAllocs :: Ord bid => Map bid (Map Good Units) -> Map bid (Map Good Units) Source #
Make sure that every allocation to a bid is non-zero and unsuccessful bids are excluded from the map.
Lenses
ro_mode :: Lens' RationingOptions RationingMode Source #
ro_steps :: Lens' RationingOptions (Maybe RationingSteps) Source #