In this article I will provide a general introduction to the benefits of price optimization. I will furthermore demonstrate how price optimization can be facilitated with mathematical programming. In previous articles we already provided an example on optimal pricing with linear demand functions, using Gekko in Python. This article takes a closer look at price optimization on a higher managerial abstraction level.

## Use case of price optimization in retail

Prices are a powerful lever for retail businesses to drive profits, revenues as well as customer loyalty, market penetration, an so on. They also influence a company’s supply chain operations and, thus, workforce scheduling and delivery times.

An important and fascinating aspect of pricing is understanding customers’ behavior with regard to price changes. Nowadays this involves analyzing large quantities of data via data science methods.

For example, causal analysis can estimate the effect of marketing campaigns over sales or profit, while forecasting methods can predict the actual demand the business will encounter in the near future.

However, even the best predictions extracted from the past, be it yesterday, the last week or the last year, are not enough to make reliable decisions for the future.

Indeed, once the best prediction and insights are in, a company can have thousands or million prices to set. For example, consider a retailer with a weekly pricing schedule and just 10 different pricing regions and 1000 articles in the assortment. She would then have 10000 prices to set each week.

As each pricing decision can influence other prices, the problem requires considering a huge amount of possible solutions, which cannot be handled manually.

Then, to have a modern and effective dynamic pricing solution, i.e. able to quickly react to changes in the market or the organization’s plans, pricing managers need reliable insights from past data as well as a *pricing optimizer* that finds the best combination of prices to reach their goals.

In the following I will present this use case for pricing optimization, implemented with mathematical programming:

**A pricing manager for a fashion retailer needs to set prices for the next week to maximize profit. She also worries about having too much left-over stock over the next weeks. **

As explained above, this is an example of dynamic pricing, where prices are updated frequently to react to changes in demand and other conditions like inventory. I will then build a pricing optimizer based on mathematical programming to generate good prices for the next week, according to the given goals.

The tool will provide quick and reliable price plans for each week, improving the efficiency and effectiveness of pricing decisions, as well as simulations of optimal pricing policies that can help clarify the relationship of pricing with other functions of the organization, like supply chain and inventory management, further improving communication among decision makers.

The example provided here is going to be very simple and easy to present but the same approach and technology is routinely applied at way more complicated and realistic scenarios.

## A mathematical program for optimal pricing decisions

In order to account for future profitability and the left-over stock , the optimization model will cover a four-weeks horizon. The first week in the horizon provides the prices for the next week, while the others provide an “educated guess” of what to expect for the near future. I then assume the pricing manager wants to minimize the left-over stock at the end of the 4th week.

After week 1, the model will be run again in week 2, covering up to week 5, in a “sliding-window” fashion, so that on week 2 the model can include new data such as the updated inventory values, newer demand forecasts and, if present, newer business-driven targets.

**Note:** In real-world setting I would use a more structured approach (a.k.a. “hierarchical”) where the a longer-term model e.g. a monthly model covering the next quarter, would provide the weekly model targets, e.g. on inventory, profit, margin etc…, to reach for the 4-week period.

The model will control these variables or decisions for each week and article:

- prices
- stock
- sales

and have the constraints:

- “stock flow”: the stock available at each week is either sold or becomes available for the next week
- “stock on sale”: on each week all the stock is available for sale, no stock withholding is allowed

And two objectives:

- maximize total profit
- minimize the 4th week’s left-over stock

These elements can be readily modeled in a mathematical program and optimized with general purpose algorithms.

A couple of further details on the example problem:

- for simplicity, I do not include inventory replenishment options within the 4 weeks horizon so the initial stock is all the stock available.
- Since the articles have different prices, I will use a uniform “discount notation” where prices are represented as a discount from the list price, and can range between 0% and 50%, with a 5% step. Smaller adjustments like rounding to ‘0.99’ can be handled outside the model by some rule-based post-processing.

## Inventory and price as two optimization objectives

I will solve the problem with a bi-objective approach, optimizing for profit and stock in two steps:

- “Max-Profit”: maximize profit,
- “Max-Profit/Min-Stock”:minimize the left-over stock while constraining the total profit to be
*near*the optimal value computed at step 1.

In practice, in the second step I will slightly relax the constraint on total profit, allowing up to a 2.5% loss w.r.t. the optimal value computed in the first step.

Indeed, forcing the total profit to stay too close to the optimum can significantly increase the complexity of the model and leaves little room for the left-over stock to be reduced. On the other hand, the “profit loss” is mostly theoretical as it would require perfect accuracy for the forecasts and the pricing model to actually achieve the optimum.

## Example of price optimization with small assortment

Consider three items: jeans, shirts and socks, with the data:

Article | List price [€] | Cost [€] | Initial stock |
---|---|---|---|

socks | 10 | 5 | 290 |

jeans | 25 | 15 | 250 |

shirts | 40 | 25 | 280 |

Here is the (randomly generated) demand curves and demand time series:

Demand time series (for selected discount levels):

I then implemented the bi-objective scheme in python with the open-source general-purpose solver PULP/CBC. Here are the results:

#### Key performance indicators of price optimization problem

Scenario | Step 1 “Max-Profit” | Step 2 ” Max-Profit / Min-Stock” | change [%] |
---|---|---|---|

Profit [€] | 5517 | 5381 | -2.5 |

Revenue [€] | 15305 | 16543 | +8.0 |

Left-over stock [units] | 199 | 88 | -56.0 |

#### Analysis of left-over stock resulting from pricing decisions

Article | Step 1 “Max-Profit” | Step 2 “Max-Profit / Min-Stock” | change [%] |
---|---|---|---|

socks | 104 | 34 | -67.6 |

jeans | 47 | 47 | 0.0 |

shirts | 47 | 7 | -86.3 |

#### Analysis of sold units as a result of discount decisions

The final solution achieves high profitability (97.5% of theoretical maximum) and with the minimum amount of left-over stock possible for that level of profit.

Compared to the purely profit-maximizing solution in the first step, the solution in the second step reduces the left-over stock by 50% by increasing discounts for socks and shirts to push their sales.

## Concluding remarks on price optimization use case

By using appropriate technology like mathematical programming, decision makers can find effective solutions for complex decision problems with competing targets. Indeed, as the number of possible solutions for these problems explodes, the probability of having surprisingly good solutions increases; the issue is then in using the right tool to quickly find them.

In this article I also touched on the topic of multi-objective optimization. If you are interested in multi-objective optimization you can find several examples implementing multi-objective optimization in Python here on this blog. Here is an overview of some references that might be of interest to you:

- Link:
*Large-scale price optimization for an online retail fasion retailer* - Link:
*Multi-objective linear optimization with PuLP in Python* - Link:
*Multi-objective linear optimization with weighted sub-problems using PuLP in Python* - Link:
*Scalarizing multi-objective optimization problems* - Link:
*Pricing with linear demand function using Gekko in Python*

Operations researcher/optimization consultant with experience in energy, retail, manufacturing, pricing and revenue management.

## Leave a Reply