1 00:00:04,960 --> 00:00:06,620 So let's begin modeling this problem 2 00:00:06,620 --> 00:00:09,460 as a linear optimization problem. 3 00:00:09,460 --> 00:00:12,150 In terms of the framework that we have seen in the lectures, 4 00:00:12,150 --> 00:00:15,960 our objective is to maximize the revenue to Google. 5 00:00:15,960 --> 00:00:19,430 Our decision is for each advertiser and each query 6 00:00:19,430 --> 00:00:22,910 to decide the number of times that advertiser's ad will 7 00:00:22,910 --> 00:00:25,940 be displayed for that query. 8 00:00:25,940 --> 00:00:27,970 Our constraints are of two types. 9 00:00:27,970 --> 00:00:30,800 Our first constraint is that the average amount paid by each 10 00:00:30,800 --> 00:00:33,920 advertiser, based on the number of times Google displays 11 00:00:33,920 --> 00:00:38,580 their ad for each query, cannot exceed the budget of that 12 00:00:38,580 --> 00:00:40,430 advertiser. 13 00:00:40,430 --> 00:00:42,880 Our second constraint is that the total number of ads we 14 00:00:42,880 --> 00:00:46,510 display for a query cannot exceed our estimate 15 00:00:46,510 --> 00:00:49,570 of the number of requests that we expect to see for that 16 00:00:49,570 --> 00:00:51,990 query. 17 00:00:51,990 --> 00:00:54,240 Let's quickly review our problem data. 18 00:00:54,240 --> 00:00:56,570 We have the average price per display 19 00:00:56,570 --> 00:00:59,700 for each advertiser and each query. 20 00:00:59,700 --> 00:01:02,720 We have the budget of each advertiser. 21 00:01:02,720 --> 00:01:05,150 And we have estimates of the number 22 00:01:05,150 --> 00:01:07,830 of requests for each query. 23 00:01:07,830 --> 00:01:09,580 So let's now think about how to model 24 00:01:09,580 --> 00:01:12,490 all the pieces of our problem. 25 00:01:12,490 --> 00:01:15,700 First, how should we define our decision variables? 26 00:01:15,700 --> 00:01:19,240 Well, we should define them for each advertiser and each query. 27 00:01:19,240 --> 00:01:21,940 So for example, one of our decision variables 28 00:01:21,940 --> 00:01:23,070 will be x_A1. 29 00:01:26,510 --> 00:01:28,680 x_A1 is the number of times we will 30 00:01:28,680 --> 00:01:32,520 display AT&T's ad for query 1. 31 00:01:32,520 --> 00:01:38,740 Similarly, we can define x_A2 and x_A3. 32 00:01:38,740 --> 00:01:41,960 These are the numbers of times that we will display AT&T's ad 33 00:01:41,960 --> 00:01:44,700 for queries 2 and 3, respectively. 34 00:01:44,700 --> 00:01:47,039 Now, of course, we have three different advertisers, 35 00:01:47,039 --> 00:01:52,530 so we will have variables x_T1, x_T2, and x_T3. 36 00:01:55,120 --> 00:01:57,080 These variables represent the number of times 37 00:01:57,080 --> 00:02:00,580 that we display T-Mobile's ad for queries 1, 2, 38 00:02:00,580 --> 00:02:02,390 and 3, respectively. 39 00:02:02,390 --> 00:02:04,850 And, of course, our last advertiser's Verizon. 40 00:02:04,850 --> 00:02:11,970 So we will have variables x_V1, x_V2, and x_V3, which 41 00:02:11,970 --> 00:02:13,630 are the numbers of times that we display 42 00:02:13,630 --> 00:02:17,320 Verizon's ad for queries 1, 2, and 3, respectively. 43 00:02:19,880 --> 00:02:21,760 Now, how do we compute the revenue to Google, 44 00:02:21,760 --> 00:02:23,260 which is our objective? 45 00:02:23,260 --> 00:02:25,820 Well, we know the average price per display, 46 00:02:25,820 --> 00:02:28,850 and our decision variables tell us exactly how many times 47 00:02:28,850 --> 00:02:31,420 we'll display each ad for each query. 48 00:02:31,420 --> 00:02:34,680 So all we need to do is we need to multiply each decision 49 00:02:34,680 --> 00:02:37,950 variable with its corresponding average price per display 50 00:02:37,950 --> 00:02:39,610 and add them all up. 51 00:02:39,610 --> 00:02:56,550 If we did this, we would have 0.5*x_A1 + 0.5*x_A2 + 1.6*x_A3 52 00:02:56,550 --> 00:02:58,200 + 1*x_T1. 53 00:03:01,010 --> 00:03:02,220 And we can continue this. 54 00:03:02,220 --> 00:03:07,480 And the last term in our sum will be 5*x_V3. 55 00:03:10,850 --> 00:03:14,110 To get the constraints, we use a similar process. 56 00:03:14,110 --> 00:03:16,850 For instance, to get how much AT&T pays, 57 00:03:16,850 --> 00:03:20,100 we multiply the AT&T variables by their average prices 58 00:03:20,100 --> 00:03:22,210 per display and add them up. 59 00:03:22,210 --> 00:03:32,400 So we'd get 0.5*x_A1 + 0.5*x_A2 + 1.6*x_A3. 60 00:03:36,510 --> 00:03:38,510 Now, one of our constraints, as you will recall, 61 00:03:38,510 --> 00:03:43,410 is that this cannot exceed AT&T's budget, which is $170. 62 00:03:43,410 --> 00:03:49,170 So our model would have the constraint 0.5*x_A1 + 0.5*x_A2 63 00:03:49,170 --> 00:03:57,579 + 1.6*x_A3, is less than 170. 64 00:03:57,579 --> 00:04:00,330 We can repeat this to get the same kind of budget constraint 65 00:04:00,330 --> 00:04:02,890 for T-Mobile and Verizon. 66 00:04:02,890 --> 00:04:06,160 Now, to get the number of times query 2 is used, 67 00:04:06,160 --> 00:04:09,470 we add up the decision variables corresponding to query 2. 68 00:04:09,470 --> 00:04:12,900 So we have x_A2, the number of times 69 00:04:12,900 --> 00:04:15,880 AT&T is paired with query 2. 70 00:04:15,880 --> 00:04:19,110 We have x_T2, which is the number of times 71 00:04:19,110 --> 00:04:23,700 T-Mobile is paired with query 2, and x_V2, 72 00:04:23,700 --> 00:04:27,660 which is the number of times Verizon is paired with query 2. 73 00:04:27,660 --> 00:04:29,920 Now, one of our constraints is that this cannot exceed 74 00:04:29,920 --> 00:04:33,310 the estimated number of requests for query 2, which is 80. 75 00:04:33,310 --> 00:04:39,150 So our model would have the constraint x_A2 + x_T2 + x_V2 76 00:04:39,150 --> 00:04:42,530 all less than 80. 77 00:04:42,530 --> 00:04:44,560 We can do this for the other queries. 78 00:04:44,560 --> 00:04:47,350 So we can do this for query 1 and query 3. 79 00:04:47,350 --> 00:04:49,409 And this is all that we really need. 80 00:04:49,409 --> 00:04:52,290 So now, let's take this problem to LibreOffice 81 00:04:52,290 --> 00:04:54,650 and actually solve it.