Practical data science and optimization: advertising problem


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.

 

t1

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.

 

t2

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

 

r1

 

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

 

t3

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?

 

How do you rate this article?

12


I_g_o_r
I_g_o_r

I am curious about science, technologies and their applications to solving real problems.


Practical data science & optimization in examples
Practical data science & optimization in examples

This blog gives readers practical examples of data science and optimization problems and their solutions using python scripts. These scripts can be used to solve real problems in business and life.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.