# Node Description

# Tuning Loop Start

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. the Objective Function is set in the ‘Tuning Loop End’ node.

There are several ‘Optimization Methods’ available in the Tuning Loop:

● **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 Start node is to define the set of Input Parameters that will be used to tune the Market Simulation. The user defines these Input Parameters within the Configuration Dialog. Only a very few Input Parameters should be defined to avoid statistical over-fitting. The Tuning Loop Start node then converts these Input Parameters into KNIME Workflow ‘Flow Variables’. The Flow Variables then need to override the Configuration Parameters in downstream nodes. This is done by opening the Configuration Dialog of the downstream node, clicking on the ‘Flow Variables’ tab at the top of the Dialog Box, and then selecting the Configuration Parameter to override. Alternatively, the Flow Variables can be converted into a data table using a KNIME *Variable to Table* node.

*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

#### No Input

The Input Parameters for the Tuning Loop Start node can be introduced with an upstream table or added directly within the Configuration Dialog.

## Node

#### Configuration

The Input Parameter ‘xInput’ has been defined within the Tuning Loop Start node.

The Brute Force algorithm requires Input Parameters have a Start Value, a Stop Value, and a Step Size. If ‘Is Integer’ is checked then the Output Flow Variable will always be rounded to the nearest integer.

## Outputs

#### Flow Variable

The Input Parameters get pushed out of the Tuning Loop Start node as Flow Variables. Flow Variables can be used by any downstream node to override the original user-defined configuration.

#### Objective Function

Here, the Input Parameter ‘xInput’ Flow Variable is used within a Java Snippet. But it doesn’t have to be, as Flow Variables can be used in any node that has a Configuration Dialog. The ‘xInput’ is used to calculate a ‘yFunction’ output value which is used as the Objective Function. In this Tuning Loop, the goal is to minimize the yFunction Objective Function.

# #2 Hill Climb

## Inputs

#### Input Parameters

Here, the Input Tuning Parameters for the Tuning Loop Start node can be introduced with an upstream table.

The Hill Climb algorithm requires Input Parameters to have a Start, a Stop, and a Step. Other columns, such as the Max Value and Min Value, are ignored.

## Node

#### Configuration

No Input Parameters have been defined within the Tuning Loop Start node. The Search Strategy (Hill Climb) has been defined, but the Starting Adjustment Percentage is ignored (that is only used by the Parameter Funnel algorithm).

## Outputs

#### Flow Variable

The Input Parameters get pushed out of the Tuning Loop Start node as Flow Variables. Flow Variables can be used by any downstream node to override the original user-defined configuration.

#### Objective Function

As above, the Input Parameter ‘xInput’ Flow Variable is used within a Java Snippet to calculate a ‘yFunction’ Objective Function that is to be minimized.

# #3 Parameter Funnel

## Inputs

#### Input Parameters

Multiple Input Parameters can be defined. Here an ‘aInput’ and ‘bInput’ are both converted into Flow Variables within the Tuning Loop.

The Parameter Funnel algorithm requires Input Parameters to have a Start Value, a Max Value, and Min Value. The algorithm is not limited by a Stop Value, and the Step Size is not fixed but rather determined by the Adjustment Percentage from the Configuration Dialog.

## Node

#### Configuration

The required Input Parameters are shown in the table. The Starting Adjustment Percentage is used as a sort-of dynamically changing Step Size that is unbounded by the Stop Value.