# Node Description

# Tuning Loop End

Market Simulation is designed to reproduce all of the dynamics of a Market. Hence any observation about a real-world Market can be used to help tune the Market Simulation so that it can make better predictions.

For example, if the Price and Market Share of the Competitor Products in a Market are known, then these measurements can be compared to a Market Simulation model. The Input Parameters of the Market Simulation that define the Vertical Differentiation and Horizontal Differentiation of Products in the Market can then be tuned.

Alternatively, if the precise Quantity Sold of Competitor Products is not known, then the Product Elasticity may be know. Product Elasticity is often calculated for eCommerce Products where a Competitor publishes their Prices but not how much Quantity they’ve sold. Instead, the Competitor will publish the fact that their Product is Out-of-Stock. When these Out-of-Stock events occur, the user can calculate how much additional Quantity they’ve sold themselves. This Product Elasticity can then be incorporated into a Tuning Loop.

The Feature Differentiation nodes, Product Generation node, and Simulate Market node can be placed between a ‘Tuning Loop Start’ node and a ‘Tuning Loop End’ node. A ‘Quantity Error’ representing the difference between the actual Quantity Sold and the simulated Quantity Sold can be calculated by the Simulate Market node. The Tuning Loop will then automatically adjust the Input Parameters to minimize the ‘Quantity Error’ and improve the accuracy of the predictions.

The Tuning Loop may also be used to optimize the sales of Products. For example, a Tuning Loop might be set up to find the Profit Maximizing Price (or Revenue Maximizing Price) of a Product. The Objective Function can be customized to suit the other goals of the user. For example, the user may wish to find a Profit Maximizing Price that does not decrease the amount of Quantity Sold.

There are several ‘Optimization Methods’ available in the Tuning Loop (the Optimization Method is set in the ‘Tuning Loop Start’ node):

● **Parameter Funnel**: (default) The Parameter Funnel algorithm will start by alternatively raising and lowering the Input Parameters by the ‘Starting Adjustment Percentage’. For example, if the ‘Starting Adjustment Percentage’ is 20% then the Search Strategy will try raising and lowering each Input Parameter by 20% (relative to their Maximum Value and Minimum Value). The Input Parameters than improve the Objective Function will be kept. When no more improvement is possible, the Parameter Funnel algorithm will halve the ‘Adjustment Percentage’ and continue, so that now each Input Parameter will be altered by plus/minus 10%. Halving the ‘Adjustment Percentage’ is the same as incrementing the ‘Tuning Adjustment Depth’. Reducing the ‘Adjustment Percentage’ from 20% to 10% will increase the ‘Adjustment Depth’ from 1 to 2. Tuning will stop after a user-defined ‘Number of Tuning Adjustment’ improvements, or after the Adjustment Depth has reached the ‘Maximum Depth of Tuning Adjustments’.

● **Brute Force**: The Brute Force algorithm will test all possible combinations of Input Parameters and return the overall best results. The Brute Force algorithm will initially set the Input Parameter to be equal to the Start Value, then increment by Step Size until the Stop Value is reached.

● **Hill Climb**: The Hill Climb algorithm will initially set each Input Parameter to a random value between the Start Value and the Stop Value. The Hill Climb algorithm will then test each of the direct neighbors by incrementing and decrementing the Input Parameter by the Step Size. The best combination among the each of the neighbors then becomes the new start point for the next iteration. If no neighbor improves the Objective Function the Hill Climb algorithm terminates.

The specific role of the Tuning Loop End node is to determine whether the adjusted Input Parameters improves the Objective Function. The Objective Function is a Flow Variable that has been calculated by the user within the Tuning Loop and represents the tuning goal. For example, if the goal of the Tuning Loop is to improve the accuracy of the Market Simulation, then the Objective Function would be set to minimize the (weighted) ‘Quantity Error’ of all Products in the Market. Alternatively, if the goal of the Tuning Loop is to maximize the Profit of all Products sold by the Store, then the Objective Function would be set to sum the Product Profits then find the maximum.

*This Community Node documentation 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.*

# Downloads

# #1 Brute Force

## Inputs

#### Objective Function

The ‘xInput’ Input Parameter is used in the Java Snippet found within the Tuning Loop to calculate a ‘yFunction’ output value. This yFunction is used as the Objective Function of the Tuning Loop.

#### Flow Variable

The Tuning Loop End node will maximize (or minimize) the yFunction Flow Variable calculated in the Tuning Loop.

## Outputs

#### Optimized Value

The Input Parameters and the maximized Objective Function are set in the Output Tuning Parameters.

#### Iteration Results

The ‘Output Iteration Results’ lists all of the detailed Output Tuning Parameter test results calculated at each iteration in the Tuning Loop.

The Brute Force algorithm takes 41 steps from the Start Value to the Stop Value to find the global maximum.

# #2 Hill Climb

## Inputs

#### Objective Function

As above, the ‘xInput’ Input Parameter is used to calculate a ‘yFunction’ output value which is used as the Objective Function.

## Outputs

#### Optimized Value

The Input Parameters and the maximized Objective Function are set in the Output Tuning Parameters.

#### Iteration Results

The Hill Climb algorithm got to the final result in 26 steps rather than in the 41 steps required by the Brute Force algorithm.

But as the Hill Climb algorithm can start at any random point between the Start Value and Stop Value, it can peak at a local maximum that is different to the global maximum reached by the Brute Force algorithm.

# #3 Parameter Funnel

## Inputs

#### Objective Function

The ‘aInput’ and ‘bInput’ are used together to calculate a ‘yFunction’ Objective Function.

But in this case, many more Flow Variables have also been calculated within the Tuning Loop.

## Node

#### Output Variables

The ‘Advanced’ tab in the Tuning Loop End node allows these additional Flow Variables to also be included in the Output Iteration Results.