AdWords-Placement-Problem-via-Online-Bipartite-Graph-Matching

Problem:

We are given a set of advertisers each of whom has a daily budget 𝐡𝑖. When a user performs a query, an ad request is placed online and a group of advertisers can then bid for that advertisement slot. The bid of advertiser 𝑖 for an ad request π‘ž is denoted as π‘π‘–π‘ž. We assume that the bids are small with respect to the daily budgets of the advertisers (i.e., for each 𝑖 and π‘ž, π‘π‘–π‘žβ‰ͺ𝐡𝑖). Moreover, each advertisement slot can be allocated to at most one advertiser and the advertiser is charged his bid from his/her budget. The objective is to maximize the amount of money received from the advertisers.

For this project, we make the following simplifying assumptions:

  1. For the optimal matching (used for calculating the competitive ratio), we will assume everyone’s budget is completely used. (optimal revenue = the sum of budgets of all advertisers)
  2. The bid values are fixed (unlike in the real world where advertisers normally compete by incrementing their bid by 1 cent).
  3. Each ad request has just one advertisement slot to display.

Datasets

You are provided with a small dataset called bidder_dataset.csv. This dataset contains information about the advertisers. There are four columns: advertiser ID, query that they bid on, bid value for that query, and their total budget (for all the keywords). The total budget is only listed once at the beginning of each advertiser’s list. In addition, the file queries.txt contains the sequence of arrivals of the keywords that the advertisers will bid on. These queries will arrive online and a fresh auctioning would be made for each keyword in this list.

Implementation

Algorithms:

  • Greedy:
  1. For each query π‘ž
    1. If all neighbors (bidding advertisers for π‘ž) have spent their full budgets.
      1. continue
    2. Else, match π‘ž to the neighbor with the highest bid.
  • MSVV: Let π‘₯𝑒 be the fraction of advertiser's budget that has been spent up and πœ“(π‘₯𝑒) = 1βˆ’π‘’(π‘₯π‘’βˆ’1).
  1. For each query π‘ž
    1. If all neighbors have spent their full budgets.
      1. continue
    2. Else, match π‘ž to the neighbor 𝑖 that has the largest π‘π‘–π‘žβˆ—πœ“(π‘₯𝑒) value.
  • Balance:
  1. For each query π‘ž
    1. If all neighbors have spent their full budgets.
      1. continue
    2. Else, match π‘ž to the neighbor with the highest unspent budget.

Output

Run adwords.py with the following command python adwords.py [greedy|msvv|balance]

Using Python with random.seed(0) for shuffling queries, the following was obtained.

command revenue competitive ratio
python adwords.py greedy 16800.5 0.9412
python adwords.py mssv 17714.7 0.9924
python adwords.py balance 12386.5 0.6939