20 #include <unordered_map>
21 #include <unordered_set>
28 using Bidder = std::string;
29 using Item = std::string;
30 using Items = std::unordered_set<Item>;
32 using Bid = std::pair<Items, Value>;
33 using Bids = std::vector<Bid>;
34 namespace pa = paal::auctions;
36 std::unordered_map<Bidder, Bids> bids {
43 {{
"baby carrot",
"carrot"}, 4},
46 std::vector<Bidder> bidders {
"Pooh Bear",
"Rabbit"};
47 std::vector<Item> items {
"honey",
"baby carrot",
"carrot",
"jam"};
48 auto get_bids = [&](
Bidder bidder) ->
const Bids& {
return bids.at(bidder); };
49 auto get_value = [](
const Bid& bid) {
return bid.second; };
50 auto get_items = [](
const Bid& bid) ->
const Items& {
return bid.first; };
51 auto get_copies_num = [](Item item) {
return item ==
"baby carrot" ? 2 : 1; };
54 bidders, items, get_bids, get_value, get_items, get_copies_num
57 Items bundle {
"carrot",
"honey",
"baby carrot"};
59 std::cout <<
"pooh bear valuation: " <<
60 auction.call<pa::value_query>(
"Pooh Bear", bundle) << std::endl;
62 std::cout <<
"rabbit valuation: " <<
63 auction.call<pa::value_query>(
"Rabbit", bundle) << std::endl;
auto make_xor_bids_to_value_query_auction(Bidders &&bidders, Items &&items, GetBids get_bids, GetValue get_value, GetItems get_items, GetCopiesNum get_copies_num=GetCopiesNum{}) -> decltype(make_value_query_auction_components(std::forward< Bidders >(bidders), std::forward< Items >(items), detail::xor_bids_value_query< GetBids, GetValue, GetItems >(get_bids, get_value, get_items), get_copies_num))
detail
int main()
[Xor Bids Auctions Example]
std::string Bidder
[Demand Query Auction Components Example]
Interfaces for creating auctions from xor bids valuations.