18 #include "paal/auctions/winner_determination_in_MUCA/winner_determination_in_MUCA.hpp"
20 #include <boost/function_output_iterator.hpp>
21 #include <boost/range/algorithm/copy.hpp>
28 #include <unordered_map>
29 #include <unordered_set>
37 using Bidder = std::string;
38 using Item = std::string;
39 using Items = std::unordered_set<Item>;
41 using Bid = std::pair<Items, Value>;
42 using Bids = std::vector<Bid>;
45 const std::unordered_map<Bidder, Bids> bids {
47 {{
"ball",
"kite"}, 2},
50 {{
"ball",
"kite",
"umbrella"}, 5},
51 {{
"ball",
"kite",
"orange",
"umbrella"}, 6.75},
56 {{
"apple",
"orange"}, 4},
61 {{
"apple",
"umbrella"}, 5},
64 const std::vector<Bidder> bidders {
"John",
"Bob",
"Steve"};
65 const std::vector<Item> items {
"apple",
"ball",
"orange",
"kite",
"umbrella"};
66 auto get_bids = [&](
const Bidder& bidder) ->
const Bids& {
return bids.at(bidder); };
67 auto get_value = [](
const Bid& bid) {
return bid.second; };
68 auto get_items = [](
const Bid& bid) ->
const Items& {
return bid.first; };
70 bidders, items, get_bids, get_value, get_items
74 Value social_welfare = 0;
76 bidders, items, get_bids, get_value, get_items
80 boost::make_function_output_iterator([&](std::pair<Bidder, Items> p)
82 auto bidder = p.first;
83 auto& cur_items = p.second;
84 social_welfare += valuation.call<paal::auctions::value_query>(bidder, cur_items);
85 std::cout << bidder <<
" got bundle: ";
86 boost::copy(cur_items, std::ostream_iterator<Item>(std::cout,
", "));
87 std::cout << std::endl;
90 std::cout <<
"social welfare: " << social_welfare << 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
std::string Bidder
[Demand Query Auction Components Example]
void determine_winners_in_gamma_oracle_auction(GammaOracleAuction &&auction, OutputIterator result, PriceMap price, Epsilon epsilon)
detail
auto make_xor_bids_to_gamma_oracle_auction(Bidders &&bidders, Items &&items, GetBids get_bids, GetValue get_value, GetItems get_items, GetCopiesNum get_copies_num=GetCopiesNum{}) -> decltype(make_gamma_oracle_auction_components(std::forward< Bidders >(bidders), std::forward< Items >(items), detail::xor_bids_gamma_oracle< GetBids, GetValue, GetItems >(get_bids, get_value, get_items), 1, get_copies_num))
detail
Interfaces for creating auctions from xor bids valuations.
int main()
[Winner Determination In MUCA Example]