## Optimization

The Optimization panel allows to test, tweak and observe how different algorithms perform a function optimization in a 2-dimensional parameter space: "the canvas". The value (or reward) of the function at a specific position in parameter space is displayed by the amount of red, which can be painted on using the Paint Reward tool in the drawing options.
The canvas will display the process of optimization from a given starting position (provided by the "Drag me" drag-and-drop button. If no starting position is provided, a random position in parameter space will be selected.
The canvas displays different information in multiple layers, which can be toggled using the display options. These are:

- Samples: the original function value (reward), high colors correspond to high reward value
- Learned Model: the optimization history (lined path), current best parameters (green circles), visited parameter instances (black circles), and (optionally) additional model information (e.g. set of active particles)
- Model Info: representation of the reward function as elevation contour lines
- Legend: the current maximum value found (the maximum is always normalized to 1)

A yellow zone indicates the region of parameter space in which the function value is maximum or higher than a given Stop Criterion. The optimization process will stop after a set number of iterations has been performed, or when a sufficient function value is reached.
In Practice
The easiest way to test optimization is to:

1. Paint some reward (left-click) in the canvas
2. Click on "Optimize"

This should initialize the algorithm and start animating the exploration of the parameter space.
Options and Commands
The interface for optimization (the right-hand side of the Algorithm Options dialog) provides the following commands:

- Optimize: Initialize and start the optimization using the currently selected algorithm and options
- Stop/Start: pause or restart the optimization process (will not reset the iteration count)
- Clear: clear the current regression model (does NOT clear the data)

and the following options:

- Starting Position: (draggable) defines the starting position for the optimization process. Re-drag to remove
- Max Iterations: Maximum number of iterations to compute
- Stop Criterion: Target minimal value to be attained before stopping (range: [0, 1]).

All other options are algorithm-dependent and should be described in the help menu of the algorithm itself.
Generate Rewards
It is possible to generate a set of pre-constructed rewards by dragging and dropping a gaussian of fixed size (Var option) or a gradient from the center of the canvas to the dropped position. Alternatively a number of standard benchmark functions is proposed. Use the Set button to draw the benchmark function onto the canvas.