Workflow Overview

In previous workflows, such as in the Building Blocks workflow BB-113 Commodity Competitive Loop, the Product Price was changed to maximize profitability. But what if you wanted to maximize another KPI (Key Performance Indicator) such as Revenue or Market Share?

This workflow shows a more flexible way to use a Recursive Loop to optimize Market KPIs.

The Market used in this loop is based upon the BB-101 Simple Monopoly, but the Recursive Loop itself is very powerful and can be adapted to any number of situations.

This Building Blocks example assumes you have already downloaded the open-source KNIME analytics platform and installed the free Market Simulation (Community Edition) plugin. If not, start by returning to Getting Started.

Maximize Revenue

This Monopoly Market comprises of one Competitor selling one Product.

The Competitor wishes to maximize their Revenue KPI. A Recursive Loop is set up to test whether raising Price by 2% or lowering Price by 2% will result in more Revenue.

The loop is continued until neither raising nor lowering Price improves the KPI.


Simple Products can be defined using a single Customer Distributions node.

Product Array

The Sprockets Products and its associated WTP Matrix is generated by the Customer Distributions node.

WTP Matrix

Both the Product Array and the WTP Matrix is passed to a Market Simulation node.

Simulate Market

The ‘Simulate Market’ node is another Market Simulation node that can be used as an alternative to the ‘Profit Engine’ node.


The Simulate Market node can be used to model a wider range of Markets where the actual number of Customers in the real-world is different to the number of Virtual Customers in the simulation.


The Simulate Market node:

  • Runs Faster
  • Tracks Quantity Error (for tuning)


But the Profit Engine:

  • Makes a Demand Curve
  • Sets Profit Maximizing Prices


The ‘Recursive Loop Start’ node returns the more optimized Prices from the last iteration and re-injects them into the next iteration.


The original Product Price is used as the input to the Recursive Loop Start node.


The improved Price calculated from the last iteration is returned to the beginning of the next iteration.

Change Price

The Price is then increased by 2% and decreased by 2%. These results are then compared with the ‘No Change’ Price.

Increase Price

A math formula is used to increase Price by 2%. A similar math formula is used at the bottom branch of the loop to decrease Price by 2%.

Test Price

The new Prices are tested by secondary ‘Simulate Market’ nodes.


All results are collected and compared:

  • Increase Price
  • No Change in Price
  • Decrease Price


Decreasing Price would improve Quantity sold. Increasing Price would improve Profit. Maintaining the current iteration Price would maximize Revenue.

Optimize What?

The ‘Sorter’ node can be configured to sort by the most important KPI.


In this case, maximizing Revenue is the most important so the Price that results in the highest Revenue is sorted to the top.

Loop End

The ‘Recursive Loop End’ node collects the results and passes the best Price back to the ‘Recursive Loop Start’ node.


The loop is configured to run up to 100 times or until the Revenue Maximizing Price is equal to ‘No Change’.

Loop Results

At each loop iteration, the Product Price drops from $150 to $147 to $144.06 all the way down to $86.94. The expected Quantity, Revenue, and Profit are all calculated.


Line Charts

The trends from the Recursive Loop can then be plotted using the ‘Line Chart’ node.

Price Trend

The Price is decreasing by 2% each iteration.

Profit Trend

The decreasing Price iterates past the Profit Maximizing Price which occurs at $106.40. Recall that the ‘Profit Engine’ node used the Demand Curve to identify $105 as the Profit Maximizing Price.

Revenue Trend

Revenue increases steadily until it reaches the Revenue Maximizing Price of $86.94.