Building dynamic pricing model using DecisionRules

In our previous article, we discussed the meaning and capabilities of dynamic pricing. This time, we explore implementing such models, detailing our showcase model's structure, which you can then modify to fit your specifications.

The dynamic pricing process

The dynamic pricing process has several parts

  • Figuring out which strategy is to be used ( can be dependent on the product, its category, market conditions or whether the item has a running promotion )
  • Calculating the price according to the chosen strategy
  • Performing a “smart rounding” that transforms the calculated prices to better looking ones

These are the main parts of the process, now we can take a look at how these concepts are used in our showcase model.

Workflow of the model

We have divided the model into several different steps where each has a separate purpose.

Get information about the product

In this step we gather all the information about the product that we will use for the decision about the pricing.  

Products

This Decision Table outputs all basic information about the products. 

For ease of implementation you can choose which product identifier you want to use as the condition and in the table you can store all the other necessary information you might need later for the calculation.

In our showcase model we use the EAN code to identify the product, and we store additional information like the name of the product, internal ID and the category to which it belongs, this data can then be used to by other parts of the process for example to set a default pricing strategy for an entire category of products so that they do not have to be managed individually

Key Value Items and Promotions

These tables allow you to explicitly specify which products are considered Key Value Items and set promoted prices individually.

Tip: Using the Row Time Validation feature of the decision tables, you can also design limited time promotions. You can set the specific time window in which the promo price is active, inside this window the system will consider the item to be promoted and use the promo price, but after the promotion expires, the product will automatically revert to using the original strategy assigned.

Category presets

This table allows you to set specific pricing strategies for entire categories of products. You can also choose to ignore the category restrictions, if you choose to, by specifying the input value strategyByCategory as false.

By default, if an item is Key Value, then the category preset is also ignored.

In any other case, if you have defined a preset strategy for the particular category it will be used in the evaluation.

Get information about the competition

For a robust dynamic pricing strategy, some information about the competitors pricing will be required. For our purposes some basic data will be sufficient, so we use a basic price of the product in our competing stores, possible promo price if some promotions are running and also information about whether the items are in stock or sold out.

We have prepared two ways to access data about competition. 

If you already have this data stored somewhere in your source database or you prefer to pass it directly, you can provide it to the input of the model and this data will then be available for strategies that take into account the competition's prices.

The other approach you can use is the data from the increasingly popular data scraping websites. If this data is accessible through the use of REST API, you can load it into DecisionRules and work with it the same way as if you had the data in the input.

Aggregate the data about competition

In a typical dynamic pricing strategy, that cares about the competition's prices, you want to work with some aggregate values rather than a list of prices across all competitors.

Therefore, we included a step that takes the data you have gathered about your competitors and extract some general information like Maximum, Minimum, Median price etc., that you can then use for evaluating your dynamic strategies.

Which of these values you use in your pricing strategy is entirely up to you, you can also define any other calculation that you would need for your purposes in this table.

Tip: DecisionRules can work directly with arrays using ARRAY functions.

Choosing a strategy

There are several variables that influence your choice of strategy, this will highly depend on how you want to structure your prices. In our model we work with the following variables

  • Promoted Item
  • Category of the item
  • Strategy specified on the input
  • Key Value Item (KVI)

An item that has an active promotion running usually has a set price associated with it, therefore for such items the model will bypass choosing a specific strategy and will instead give the specified promotion price. This price can either be set in the input of the model or in the Promotions table.

If you choose to structure your pricing strategies according to categories of the item ( for example low-end products might have different pricing strategy associated with them than high-end products ), you can specify the categories of the item in the Products table and then in the table Categories Strategy Presets, you can specify which pricing strategy is chosen for which category. Even though the model is prepared for this behaviour you do not need to use the feature if you don’t wish to.

If the item you are pricing does not have a promotion, and you want to give it a different strategy than the one associated with its category, you can always specify the particular pricing strategy on the input (this strategy is chosen only if the item is not promoted, and you set the strategyByCategory to false for it ).

You can specify a list of your key value items (KVI) that you want to treat differently. In our model we always want to keep the price of the KVI with at least a minimum markup over our warehouse total cost. Therefore, if an item is KVI and a pricing strategy sets its price too low it will be adjusted to the lowest price that includes the specified markup.

Whether an item is KVI can be set either in the input with the flag is KVI set to true, or you can set this flag in the table Key Value Items and store it there.

Markup limiting

For particular items ( in our case Key Value Items ) we might want to always keep the price above a minimal value, decided by our total cost with a predefined markup. This property can be decided again either in the input data or be set by the fact that the product is KVI.

If the markup limiting is executed then the system takes the price calculated with the chosen pricing strategy and the cost+markup and outputs the higher of these two.

Smart rounding settings and generating final prices

In the final step of the process the model takes the generated price and performs a rounding process that transforms the value into a better looking one according to some specified settings. Available settings are

  • Number of digits to round to, for example for an item costing less than $10 we might want to keep two decimal places to get prices like $5.99. However, if and item costs above $1.000 it might be better to omit decimal places from the final price
  • Setting favoured numbers which appear at the end of price tags. You might typically choose numbers like 0,5 and 9 to transform prices $3.13 to $3.10, $3.15 or $3.19
  • Allowing reduction of the calculated price. Here we decide if a calculated price can be lowered to get a better looking price or if we always choose a higher price tag.
  • Setting an acceptable price reduction. Here we decide if we allow a price reduction how much of a reduction is still acceptable. For example, for an item that costs $11 with an acceptable reduction of 5%, the price $9.99 is outside the acceptable range.

Example Pricing Strategies

The pricing strategies are arguably the most important part of the dynamic pricing model. In our showcase model we have prepared 8 strategies that allow you to take advantage of the most common types of pricing that different businesses around the world employ. 

In the previous article, we have highlighted these strategies and described what they want to achieve. Right now let’s take a look at two examples of implementation of these in DecisionRules ( all of these will be described in detail in next article )

Cost-plus

This strategy aims to set the lowest price feasible, it takes your total cost, represented by the warehouse.totalCost variable and adds a predefined margin. In DecisionRules the strategy look like this 

In the first column we can see that the product condition can be anything, since we apply this rule uniformly across all products.

The output of the strategy is “Cost-plus” in the strategy variable, which marks which strategy was used and price which get the value of totalCost increased by the margin , which is set in the rules variables

Relative Positioning

This strategy aims to follow the prices of your competitors and set them either higher or lower by a certain percentage

In the input of the rule we set the direction parameter which sets whether the price will be lower or higher than the competition.

On the output we then again get the strategy and in price we get the competition's price either increased or decreased by respective values set in the rules variables

Conclusion

In this article, we described how a dynamic pricing module might work, mainly in the context of DecisionRules. With this knowledge we will, in the next article, dive into the implementation of this model, and we will show it in practice using a showcase application for calculating the dynamic prices using the mentioned model.

More reading