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 namespace pa = paal::auctions;
35 std::unordered_map<Bidder, Bid> bids {
36 {
"Pooh Bear", {{
"honey"}, 10}},
37 {
"Rabbit", {{
"baby carrot",
"carrot"}, 2}},
39 std::vector<Bidder> bidders {
"Pooh Bear",
"Rabbit"};
40 std::vector<Item> items {
"honey",
"baby carrot",
"carrot",
"jam"};
41 auto get_value = [&](
Bidder bidder) {
return bids.at(bidder).second; };
42 auto get_items = [&](
Bidder bidder) ->
const Items& {
return bids.at(bidder).first; };
43 auto get_copies_num = [](Item item) {
return item ==
"baby carrot" ? 2 : 1; };
46 bidders, items, get_value, get_items, get_copies_num
49 Items bundle {
"carrot",
"honey",
"jam"};
51 std::cout <<
"pooh bear valuation: " <<
52 auction.call<pa::value_query>(
"Pooh Bear", bundle) << std::endl;
54 std::cout <<
"rabbit valuation: " <<
55 auction.call<pa::value_query>(
"Rabbit", bundle) << std::endl;
auto make_single_minded_to_value_query_auction(Bidders &&bidders, Items &&items, GetValue get_value, GetItems get_items, GetCopiesNum get_copies_num=GetCopiesNum{}) -> decltype(make_xor_bids_to_value_query_auction(std::forward< Bidders >(bidders), std::forward< Items >(items), detail::get_bids(), get_value, get_items, get_copies_num))
detail
Interfaces for creating auctions from single minded valuations.
std::string Bidder
[Demand Query Auction Components Example]
int main()
[Single Minded Auctions Example]