Price bundling using Genetic Algorithm in R

Himanshu Bhardwaj
4 min readMay 7, 2020

A non-linear optimization to get optimum price bundles

Bundling products is a way to get the customers more purchases than they would have without bundling. Deciding bundle prices to optimize revenue is the goal of business while making a price bundle. In this paper, a method of obtaining optimal bundle prices using Genetic Algorithm (GA) to maximize revenue is presented. In the model, it is assumed that consumers make their decision based on the concept of consumer surplus. An example of Cable Company bundling Internet, TV, and Cell phone services is taken into consideration to prepare a price bundle model and optimized by GA. The result indicates that GA can be used as an effective optimizer to get optimal price bundles.

Price bundle Model

Let the company offers the following products or combination of products.

1. Internet services (P1)

2. TV services (P2)

3. Cell phone services (P3)

4. Internet plus TV services (P4)

5. TV plus Cell phone services (P5)

6. Internet plus Cell phone services (P6)

7. Internet plus TV plus Cell phone services (P7)

Let the company estimated monetary values that a consumers attaches to its products for n consumers. Let Cij be the value that a consumer i attaches with the product j and let company set Pj price for the product j.

The consumer surplus Sij of consumer i for the product j can be calculated as

Sij = Cij- Pj

Consumer will buy that product for which Sij is maximum. Let the maximum value is attained at j = l. Therefore, the Ri revenue from a consumer will be equal to Pl.

Total revenue of the company will be

Revenue R= sum (Ri)

Our goal is to maximize the the revenue R.

To maximize Revenue R we have chosen Genetic algorithm technique. R will be served as objective function that will be maximized by changing the prices of the products.

Genetic Algorithm to optimize revenue

Data set

A table of customer value is prepared for Internet, TV, and Cell phone services as shown in table-1. In order to obtain the customer value of “Internet plus TV services” simply the amount of Internet and TV services will be added. Similarly, the customer values of “Internet plus Cell phone services”, “TV plus Cell phone services”, and “Internet plus TV plus Cell phone services” are calculated by just adding the corresponding amounts. The total revenue is calculated as per the algorithm presented section -2. The revenue of the company will be the objective (fitness) function of the firm to be maximized.

Data set: Values that customers assigned for different products

A typical genetic algorithm requires a genetic representation of the solution domain, which is nothing but the set of prices of the products and combination of products in the case under considerations.

Flow chart of GA

Two experiments of GA with different parameters were conducted whose details and results are shown below.

Experiment 1:

Result of experiment 1

Experiment 2

Result of experiment 2

The used in R for the above work is given below.

#Load Customer data
Customer <- read.csv(file.csv, sep = ",", header = T)
#Price <- c(35.0,75.0,64.0,75.0,82.0,92.0,100.0)
attach(Customer)
library(matrixStats)
Func <- function(x)
{
MarketSur <- cbind(Internet-x[1],TV-x[2],Cell.Phone-x[3],
Internet+TV-x[4], Internet+Cell.Phone-x[5],
TV+Cell.Phone-x[6], Internet+TV+Cell.Phone-x[7])
MaxSur <- rowMaxs(MarketSur)
Prod <- function(MarketSur)
{
s <- dim(MarketSur)
Mt <- vector("numeric", s[1])
for(i in 1:s[1]){
if(max(MarketSur[i,])<0)
{
Mt[i] <- 0
}
else
{
Mt[i] <- which.max(MarketSur[i,])
}

}
return(Mt)
}
Bt <- Prod(MarketSur)
Rev <- vector("numeric",77)
#Rev <- x[Bt]
for(i in 1:77){
if(Bt[i] == 0)
{
Rev[i] = 0
}
else{
Rev[i] = x[Bt[i]]
}
}
Pen <-vector("numeric",12)
Pen[1] <- x[1]-x[4]
Pen[2] <- x[1]-x[5]
Pen[3] <- x[1]-x[7]
Pen[4] <- x[2]-x[4]
Pen[5] <- x[2]-x[6]
Pen[6] <- x[2]-x[7]
Pen[7] <- x[3]-x[5]
Pen[8] <- x[3]-x[6]
Pen[9] <- x[3]-x[7]
Pen[10] <- x[4]-x[7]
Pen[11] <- x[5]-x[7]
Pen[12] <- x[6]-x[7]
for(i in 1:12)
{
if(Pen[i]>0)
{
Pen[i] <- Pen[i]
}
else
{
Pen[i] <- 0
}
}
TotalRev <- sum(Rev) - 500*sum(Pen,na.rm=F)
return(TotalRev)
}

#GAmodel <- rbga.bin(size = 7, popSize = 200, iters = 100, mutationChance = 0.01,
#elitism = T, evalFunc = EvalFunc)
## calculate the optimum solution using Genetic Algorithm
#numvar <- 7
#resultGA <- GA(EvalFunc, optimType="MAX", numVar, numPopulation=20,
#maxIter=100, rangeVar, Pm, Pc)
L <- c(30,30,30,30,30,30,30)
U <- c(100,100,100,100,100,100,100)
suggestedValue <-c(50,35,65,71,71,71,85)
GA <- ga(type = "real-valued", fitness = Func,
lower = L, upper = U,
popSize = 2000, maxiter = 500)
summary(GA)
plot(GA)

--

--