Safe Haskell | None |
---|---|
Language | Haskell2010 |
ProductMixAuction.BudgetConstraints.Intersect
Description
Exhaustive auction rates search through hyperplane intersections
- allCandidateRates :: Eq b => AuctionKind -> [Bid b] -> Set PriceVector
- allIntersections :: Eq b => AuctionKind -> Int -> [GoodPrice b] -> [Vector Double]
- allHyperplanes :: Eq b => [GoodPrice b] -> [HyperplaneType b]
- allIntersectionSystems :: AuctionKind -> Int -> [HyperplaneType b] -> [(Matrix Double, Vector Double)]
- solveSystems :: [(Matrix Double, Vector Double)] -> [Vector Double]
- roundPoints :: AuctionKind -> [Vector Double] -> [Vector Double]
- approxZeros :: [Vector Double] -> [Vector Double]
- removeSimilarPoints :: [Vector Double] -> [Vector Double]
- select :: Int -> [a] -> [[a]]
- data Hyperplane = H (Vector Double) Double
- ppHyperplanes :: [Hyperplane] -> String
- ppHyperplane :: Hyperplane -> String
- hyperplanesSystem :: [Hyperplane] -> (Matrix Double, Vector Double)
- data GoodPrice b = P !Int !Double b
- data HyperplaneType b
- toHyperplane :: AuctionKind -> Int -> HyperplaneType b -> Hyperplane
- epsilon :: RealFloat a => a
Documentation
allCandidateRates :: Eq b => AuctionKind -> [Bid b] -> Set PriceVector Source #
Return all the candidate auction rates for the given bids.
allIntersections :: Eq b => AuctionKind -> Int -> [GoodPrice b] -> [Vector Double] Source #
Given all the (i, p_i)
pairs of good number and price,
compute the resulting hyperplanes (both hods and flanges)
and find all the intersections of all choices of n
of
them.
allHyperplanes :: Eq b => [GoodPrice b] -> [HyperplaneType b] Source #
Return all the hyperplanes generated by the given
list of (i, p_i)
pairs, both hods and flanges.
The resulting list will then be used to pick dim
hyperplanes at a time and consider their intersection
by solving the corresponding linear system.
allIntersectionSystems :: AuctionKind -> Int -> [HyperplaneType b] -> [(Matrix Double, Vector Double)] Source #
Generate all the linear systems resulting from the intersection of the given number of hyperplanes taken from the given list.
solveSystems :: [(Matrix Double, Vector Double)] -> [Vector Double] Source #
map '(<>)' over the given systems to get solutions
roundPoints :: AuctionKind -> [Vector Double] -> [Vector Double] Source #
For standard auctions, all intersections should be non-negative integers, so round the points appropriately and remove any that are negative.
For budget-constrained auctions, remove points that are too close to each other, and round extremely small values to zero.
approxZeros :: [Vector Double] -> [Vector Double] Source #
Replace any extremely small value with a genuine zero.
removeSimilarPoints :: [Vector Double] -> [Vector Double] Source #
Rounding error may result in multiple points that are very close together, so we remove all but one point in each case.
select :: Int -> [a] -> [[a]] Source #
select n xs
returns all the possible combinations of n
elements
of xs
, modulo permutations (it doesn't return [1,2]
and [2, 1]
but rather just one of them, as in our case we don't care in which order
we put the hyperplane in the matrix, the system is equivalent whatever
the "order of the equations" is).
data Hyperplane Source #
corresponds to the hyperplane with equation
H
as ba_0*x_0 + ... + a_(n-1)*x_(n-1) = b
.
ppHyperplanes :: [Hyperplane] -> String Source #
ppHyperplane :: Hyperplane -> String Source #
hyperplanesSystem :: [Hyperplane] -> (Matrix Double, Vector Double) Source #
Return (A, b)
where Ax = b
is the linear system corresponding
to the intersection of all the given hyperplanes.
(i, p_i)
pair
data HyperplaneType b Source #
corresponds to the hyperplane with equation
Hod
i px_i = p
.
corresponds to the hyperplane with
equation Flange
i p_i j p_jx_ip_i = x_jp_j
(for budget-constrained auctions),
or x_i-p_i = x_j-p_j
(for standard auctions).
Instances
Eq b => Eq (HyperplaneType b) Source # | |
Show b => Show (HyperplaneType b) Source # | |
toHyperplane :: AuctionKind -> Int -> HyperplaneType b -> Hyperplane Source #
Build a Hyperplane
of the given type in a space of
the given dimension.