
How to optimize the pricing of a chain of company-owned stores with bread and confectionery products
Stores are located on streets, in shopping centers, and in kiosks at stations and stops—where people gather. Setting the right prices is critical to maintaining the competitiveness and profitability of the bakery, because it directly affects sales volume, gross margin, and how the bakery is perceived by customers. Traditional, intuitive pricing can lead to various pricing errors that may result in loss of margin or market share. Therefore, data-science methods are increasingly used to create pricing scenarios (variants of pricing strategies) and assess their potential impact on key business metrics. Data-driven analyses make it possible to test different assumptions “dry”—for example, by simulating an increase or decrease in the prices of selected products—before they are implemented in real stores. This allows pricing decisions to be adjusted to market reactions and helps avoid costly mistakes. In this paper, we present how to use historical data, statistical modeling, and analytical tools to develop pricing strategies and how to evaluate their effects on sales, margin, price indices, and the company’s price image. We also discuss the impact of pricing policy on customer perception and brand positioning, as well as linking pricing decisions with inventory management (replenishment) and store supply optimization.
Historical data and demand analysis
Data-science methods for pricing are based on collected historical data describing sales volume over time in the context of specific prices. Historical sales data from individual stores and products make it possible to identify seasonality in demand, upward or downward trends, and sales responses to earlier price changes or promotional activities. Time-series analysis (e.g., statistical methods such as ARMA or ARIMA models) or machine-learning techniques (e.g., forecasting models) enable demand forecasting for upcoming periods based on past patterns. For such forecasts to be reliable, data must be accurate, complete, and up-to-date—missing or outdated historical information can lead to incorrect demand predictions. In practice, companies integrate sales data with external, so-called contextual data (e.g., information on competitor prices or macroeconomic indicators, days of the week, or current promotions run by the bakery) to better understand the market context. For example, including competitor prices helps assess whether a sales decline was the result of a price being too high relative to the market, or a consequence of a general drop in demand. Historical data analysis is the starting point for modeling the price–sales relationship—before planning new pricing scenarios, one must understand past relationships between price and sales volume for key products. Predictive models are based on various contextual information. Thus, we may observe that the highest sales of bread occur on Mondays, Wednesdays, and Fridays. We may also observe that sweets sell best on Saturdays. We may also notice that the appearance of a new bakery nearby significantly reduced turnover in our store. Contextual factors often have very strong predictive power; therefore, collecting contextual data is very important when determining future demand. Demand directly affects product prices. As we remember, price is the relation between demand and supply. The more products on the market, the lower the price. Thus, the opening of a new bakery nearby increases supply, which makes it necessary to lower the price; otherwise our goods will not be sold.
Price elasticity and demand modeling
One of the most important concepts in price analysis is price elasticity of demand, which describes how sensitive sales volume is to a price change. Put simply: price elasticity tells us by what percentage sales volume will change when a product’s price rises or falls by a given percentage. If sales clearly drop after a price increase, demand for that product is highly price-elastic; if a price change hardly affects volume, demand is inelastic. In practice, elasticity is calculated as the ratio of the percentage change in sales volume to the percentage change in price. For example, a 10
Demand modeling involves building a function or model that predicts the sales level depending on price and other factors (e.g., day of week, weather, store location, promotional activity). Such a model—whether a simple econometric model or a complex machine-learning model—is then used to simulate different pricing scenarios and predict their effects. Put simply, there are services or products for which demand is rigid. Regardless of the price, customers will be willing to buy. The most spectacular example of rigid demand is funeral services. On the other hand, there are products whose price elasticity is extremely high. An example is ice cream. If a scoop of ice cream costs 5 PLN, that price will be seen in all confectioneries in town. Raising the price of a scoop to 6 PLN will cause a drastic drop in sales. With many stores and a large assortment, one can conduct elasticity tests. For instance, we can increase the prices of selected products by a small amount and check how customers react in the medium term, e.g., a week. It is very important to run the experiment over several days because customers who are used to shopping at a given store usually buy without looking at the price. Customers must become aware of the price change. Only then will it be possible to observe the reaction. It should be mentioned that such an experiment costs money because raising prices causes sales to fall. The drop in sales will certainly affect the bakery’s profitability. Unfortunately, research costs something, and we can later compensate for lost revenue by introducing an effective price management system for the entire assortment. A mistake often made by novice analysts is omitting store location information in the experiment. Wealthier customers react differently to price changes than customers with limited means; children react differently than adults. Therefore, a school sweets shop will have different elasticity for the same products than a shop located far from the city center.
Pricing scenarios and simulations
With context-based demand models and product elasticities estimated through experiments, one can proceed to designing pricing scenarios—i.e., sets of assumptions about how to change the prices of selected products or categories—and simulate their effects. A price simulation means “testing” different price variants in a computer without immediately introducing them in stores. Historical sales data, demand models, and defined business goals and constraints (e.g., target margin, maximum allowable volume decline, price position versus competitors) are used as inputs. Advanced algorithms (often supported by artificial intelligence) can then simulate demand, revenue, and margin for each pricing scenario. There is an analogy to A/B tests, but the difference is that a pricing simulation happens in a virtual environment, whereas A/B price tests mean real price changes in selected stores or channels.
In practice, simulations often use statistical methods such as:
-
Bootstrapping: resampling with replacement from historical data to estimate variability of outcomes.
-
Monte Carlo: repeated random sampling to obtain a probability distribution for given parameters.
Thanks to these techniques, uncertainty in forecasts and natural demand variability can be accounted for—for example, instead of a single sales forecast for a given price, we obtain a distribution of possible outcomes together with an estimate of risk (cross-validation method). Advanced analytics platforms offer so-called sandboxes or digital twins of the market that reproduce the behavior of the store network and customers in response to price changes. This allows, for example, testing a scenario of raising the prices of all sweet snacks by 5
In the cloud, a virtual market can be built with the following modules:
-
AWS Supply Chain & Digital Twins – AWS has no ready-made “retail pricing twin,” but provides components (AWS IoT TwinMaker, AWS Forecast, SageMaker) to build your own sales-and-pricing sandboxes.
-
Microsoft Azure Digital Twins – a general platform for building digital twins; used in retail to model store behavior and the supply chain.
-
Google Cloud Platform (Vertex AI + BigQuery) – no off-the-shelf “pricing sandbox,” but one can build a custom environment: data in BigQuery, elasticity models in Vertex AI, and simulations and optimizations in Python (e.g., with Gurobi or Pyomo).
If we do not want to use the cloud, we can build such a simulation on a personal laptop. Here are the most important Python frameworks one can use:
-
mesa – a framework for agent-based simulations (e.g., modeling customer behaviors in response to price changes).
-
anylogic (commercial, but with a free Personal Edition) – often used in retail for “market simulation” (a hybrid of agent-based and system dynamics).
-
pandapower / networkx – libraries for modeling networks and flows that can be adapted to model goods flows and demand.
Pricing policy and financial results
Every price change immediately translates into the basic financial results of the store network. Total revenue is the product of price and units sold, while gross margin depends on the difference between selling price and product cost. Pricing policy is thus a continuous balance between sales volume and unit margin. Lowering prices can increase demand (which raises turnover but reduces margin per unit), while raising prices can improve product margin but risks a drop in sales volume. The optimal decision depends on the elasticity of demand discussed earlier: for highly elastic products even a small price increase can trigger a large sales decline, potentially lowering total profit; for inelastic products, it is possible to raise the price without significant loss of volume, which translates into higher profit. Scenario analyses make it possible to estimate the net effect of such changes—for example, whether a 5
Incorrect pricing decisions quickly affect financial results—overly aggressive markdowns can excessively reduce margin, while prices that are too high can limit turnover. Therefore, it is crucial to test decisions ex ante (using the simulations described) and implement a coherent, data-driven pricing strategy that balances sales and margin objectives.
The impact of prices on customer perception and brand
Pricing policy affects not only hard financial indicators—it also shapes the company’s price image in the eyes of customers. Price image is the general perception of the price level and value offered by a given store network, going beyond the objective prices on the shelf. Customers form an opinion about whether a bakery is “cheap,” “affordable,” or “expensive (premium)” based on their shopping experiences, observation of prices of key products, and marketing communications. This perception is influenced by, among other things, product quality, the frequency and depth of promotions, overall brand positioning versus competitors, and the way prices are communicated (e.g., whether the store emphasizes low prices in advertising or the uniqueness of quality). A bakery chain may want to be seen as offering good value for money—then maintaining attractive prices on basic products, such as bread and rolls, is crucial to building trust. Indeed, certain necessities serve as Key Value Items (KVIs) that most strongly influence a customer’s perception of the entire store’s prices. If a basic loaf is significantly more expensive than at competitors, many customers may consider the entire network expensive—even if other products are priced close to the market. Therefore, retailers often identify a list of such items and deliberately keep their prices as low as possible to protect a positive store price image. On the other hand, when building a higher-quality image, the company can communicate the uniqueness of its confectionery and maintain somewhat higher prices—provided that customers perceive those prices as justified by high quality. That is, so-called prestige products have a significantly higher degree of price rigidity.
Promotions and events versus the store’s price index
A price index compares a store’s average price level to the market or a selected competitor. It is a useful internal tool but does not capture the full complexity of how consumers perceive prices. Two chains can have similar price indices, similar average basket prices, and yet differ in perception—for example, if one regularly organizes promotions and communicates deals, runs events and various promotional activities. Customers may regard such a bakery as more favorable in terms of price. In reality, customer perception results not only from the level of prices but also from their context: associations with quality, service, shopping experience, interior design, and store location. A positive price image provides significant benefits—the offer is perceived as good value for money, customers visit more readily, and remain loyal. Such a positive image may even allow the company to maintain slightly higher prices than competitors, because customers feel that better quality or other benefits stand behind the prices. Conversely, a negative image discourages purchases and may force costly promotions to reduce prices in order to win back customers. Consequently, pricing decisions must be made with their impact on the brand in mind—not only on current results but also on the company’s long-term market perception.
Tools and methods for price analysis
In practice, implementing a data-science approach to pricing policy relies on a set of analytical tools and methods. The foundation is appropriate infrastructure for collecting and processing data—most often data warehouses and SQL databases connected to Business Intelligence (BI) tools for reporting (such as Tableau or Power BI) and analytical environments (e.g., Python with the Pandas, scikit-learn, and SciPy libraries, or R with statistical packages) used by analysts. In these environments a range of methods is applied, including:
-
Statistical and econometric analysis – e.g., regression models to quantify the impact of price on sales, time-series models to forecast trends and seasonality of sales, and statistical tests to assess the significance of observed changes.
-
Machine learning (ML) – more complex algorithms (such as random forests, gradient boosting models, neural networks) are used to forecast demand, segment stores by sales patterns and price sensitivity, or detect hidden relationships (e.g., product groups with similar reaction to price changes). ML models can automatically learn from transactional data, identifying, for instance, groups of stores with similar customer profiles or products frequently purchased together.
-
Price elasticity analysis – methods of calculating demand elasticity based on data (as described earlier). In practice, one may fit a log-linear demand model where the coefficient on the price variable is the elasticity measure, or use panel regression (combining data from many stores and periods) for greater reliability. It is also important to visualize results—for example, a demand curve showing how sales decline as price increases—which facilitates communication with business decision-makers.
-
Scenario (what-if) analysis – tools that allow simulating the outcomes of different pricing decisions. This is often implemented in spreadsheets or BI applications as interactive dashboards: the user changes assumptions (e.g., +10
-
Mathematical optimization – using optimization algorithms to determine the best prices under given criteria. I mean operations-research methods for determining the best decision while meeting a set of constraints. In practice, this is a family of problems like linear programming. It may take the form of directly solving a profit-maximization task (e.g., with linear or nonlinear programming, if we have an analytical demand function) or using heuristic and search methods (e.g., genetic algorithms, simulated annealing) for complex problems. In retail pricing, artificial intelligence is increasingly used for this—specialized pricing engines combine ML models (estimating demand and elasticity) with algorithms that optimize prices under many constraints simultaneously. An example could be an engine that recommends new prices for dozens of products to maximize total margin while satisfying conditions such as “maintain price competitiveness of key products against competitor A” and “do not allow the predicted volume decline to exceed 10
-
Market price monitoring – specialized tools for automatically tracking competitor prices (so-called pricing intelligence). In e-commerce, bots that collect prices from competitor websites are commonplace, but traditional store networks also use price reports and companies that monitor market prices. Thanks to this, one always knows how the offer is positioned relative to other players. These data feed models (e.g., allowing competitor reactions to be included in elasticity analysis) and are used directly by managers for decisions. Regular monitoring also facilitates promotion planning and identification of products whose prices can be increased more safely. For example, a monitoring system may show that competitors have raised the prices of yeast buns—which creates room for an analogous increase. Conversely, if our product is the most expensive on the market, these data signal a risk of sales decline and may prompt a correction. Such information helps avoid situations in which the company unknowingly offers goods that are too expensive or too cheap—and also makes it possible to test different pricing scenarios and adjust strategy based on market reactions rather than purely internal assumptions.
-
Basket analyses and price indices – techniques for comparing prices of entire groups of products. The chain can select a representative product basket (e.g., the 10 most popular bakery items) and regularly compare its total cost in its own stores and at competitors, calculating a price index. Basket analysis can also be applied internally across different stores—for instance, comparing the price level of the basket in neighborhood stores vs shopping centers. This allows assessment of the consistency of pricing policy and detection of any unjustified discrepancies. Price indices also provide a simple message for management (e.g., “our prices are on average 5
-
A/B tests and pricing experiments – in brick-and-mortar retail, conducting an A/B test (where one group of customers sees a different price than another) is more difficult than online, but possible at some scale. For example, the chain can reduce the price of a cookie by 15
As can be seen, the toolkit is broad—from traditional data analysis to artificial-intelligence algorithms. It is important, however, that the team responsible for pricing policy understands both analytical methods and the business context. Only then will analysis results translate into accurate pricing decisions aligned with company goals.
Recommendation system in e-commerce vs price-optimization system
These two areas naturally complement each other. Recommendations answer the question of what to show the customer, while price optimization answers at what price to offer it. Combining both components increases revenue and margin while improving the user experience.
Recommendations based on transactional data, searches, or on-site behavior (Collaborative Filtering models, Factorization Machines, DeepFM) generate dynamic lists of products most likely to be purchased. However, the effectiveness of these suggestions also depends on price. Even the best-matched product may remain in an abandoned cart if its price is perceived as unattractive. This is where the price-optimization system comes in, based on estimating price elasticity of demand and linear or mixed-integer programming algorithms.
On the one hand, the recommendation module provides the pricing system with information about customer preferences and contextual baskets. This enables more granular optimization: the same product’s price can differ depending on the segment or the customer’s behavioral history. On the other hand, the results of price optimization—e.g., set price levels or promotion boundaries—become additional inputs to the recommendation algorithm, so that the system does not promote products with low margin or outside the price-image strategy.
Technically, integration takes place in the data and model layer. Data on price elasticity, price indices, and margin forecasts can be stored in a warehouse (BigQuery, Snowflake) and then streamed in real time to the recommendation engine. Machine-learning models can be extended with price features, such as current price, discount, or position relative to competitors. Optimization systems (Pyomo, Gurobi, OR-Tools) generate recommended price levels, which are used as constraints in the recommendation module—for example, “show Top-10 products, but only those that meet the margin and price-index criteria.”
The synergy effect is that the customer receives a personalized offer at an attractive price, and the company controls both conversion and profitability. This combination of recommendations with price optimization becomes the foundation of modern e-commerce systems, where the exposure decision and the pricing decision are solved simultaneously within one data-driven process.