# NAME

Algorithm::SpiralSearch - Function Optimization of Two Parameters

# SYNOPSIS

``````  use Algorithm::SpiralSearch;

my \$lbx   = 0;
my \$ubx   = 1000;
my \$lby   = 0;
my \$uby   = 1000;
my \$iters = 50;
my (\$x, \$y) = spiral_search(\$lbx, \$ubx, \$lby, \$uby, \$iters, \&f, 'MAX');

sub f {
my (\$p1, \$p2) = @_;
my \$ret = simulator(\$p1, \$p2, ...);
return \$ret;
}``````

# DESCRIPTION

A spiral search is a method used to optimize a two-parameter, relatively, well-behaved function. Boundary conditions, the maximum number of iterations, a reference to a function, and an indicator to maximize or minimize the function are passed to the spiral_search function. spiral_search() returns the optimal point in the function passed to it. It's an elegant optimization algorithm, but is not well-suited for most applications. SETI uses the spiral search in huntingfor strong radio signals. Spiral search is most effective in situations where function evaluations are expensive and where there's a small amount of random noise within the search space. The algorithm is of order O(n).

# METHODS

## Search Methods

spiral_search(\$lowerBound_x, \$upperBound_x, \$lowerBound_y, \$upperBound_y, \$iterations, \&function, \$MAX_or_MIN)

Initiates the spiral search. The first four parameters define the search space plane. Spiral search is of order O(n), so the number of iterations defines how many refinements the algorithm should take into account. The greater the numberof iterations, the more accurate the findings.

The sixth parameter should be a reference to a function for which the parameters will be plugged into. This function should return only one value - a scalar output indicative of the accuracy of the inputs. The last input parameter shouldbe either one of the two strings 'MAX' or 'MIN', each corresponding to how spiral_search will optimize its given function. spiral_search returns a pair of parameters that are approximately optimal with respect to the given function.

# AUTHOR

Sean Mostafavi, <seanm@undersea.net>