In this post we consider how to optimize advertisement campaigns on the following example.

A company has a budget of $10,000 to run an advertisement campaign for a week. There are five sites where company wants to place advertisements. Table below shows all options available.

From past campaigns it was determined that a probability that a visitor clicks on an advertisement on the main page is 0.01 and probability that a visitor who clicked on the advertisement on the main page buys the advertised product is 0.01. A probability that a visitor clicks on an advertisement on the topic page is 0.01 and probability that a visitor who clicked on the advertisement on the topic page buys the advertised product is 0.03. How the company should allocate the budget among the available advertisement options if the company does not want to advertise on a main page for more than 4 days.

To solve this problem, we need first to estimate numbers of customers from each advertisement. The table below shows the estimates based on the probabilities to click and buy.

Let x[i], i=1,5 are numbers of days to advertise on the main pages of sites with index i, i=1,5 and x[i+5] are numbers of days to advertise on the topic pages of sites with index i, i=1,5.

We want to maximize the company profit, which is proportional to a number of customers z=100*x1+200*x2+500*x3+300*x4+100*x5+30*x6+45*x7+75*x8+60*x9+15*x10.

There are following restrictions:

1000*x1+1200*x2+2500*x3+1500*x4+700*x5+100*x6+190*x7+300*x8+200*x9+110*x10<=10000

x[i] <=4 i=1,5

x[i+5}<=7

Now we can solve this problem using the code below. Copy this code into a file ads.py and run it.

from scipy.optimize import linprog

obj=[-100,-200,-500,-300,-100,-30,-45,-75,-60,-15]

lhs_ineq=[[1000,1200,2500,1500,700,100,190,300,200,110],

[1,0,0,0,0,0,0,0,0,0],

[0,1,0,0,0,0,0,0,0,0],

[0,0,1,0,0,0,0,0,0,0],

[0,0,0,1,0,0,0,0,0,0],

[0,0,0,0,1,0,0,0,0,0],

[0,0,0,0,0,1,0,0,0,0],

[0,0,0,0,0,0,1,0,0,0],

[0,0,0,0,0,0,0,1,0,0],

[0,0,0,0,0,0,0,0,1,0],

[0,0,0,0,0,0,0,0,0,1]]

rhs_ineq=[10000,4,4,4,4,4,7,7,7,7,7]

integ=[1,1,1,1,1,1,1,1,1,1]

opt=linprog(c=obj,A_ub=lhs_ineq,b_ub=rhs_ineq,integrality=integ,method="highs")

print(opt)

Solution

The optimal solution is to run the advertisement campaign according to the table below.

Question:

Suppose that the company does not want that on the same day two advertisements (on the main and on the topic page) to be placed on a single site. How this will change the optimal solution above?