# Pattern Search (Hooke and Jeeves)¶

An implementation of well-known Hooke and Jeeves Pattern Search [11] for single-objective optimization which makes use of exploration and pattern moves in an alternating manner. For now, we like to refer to Wikipedia for more information such as pseudo code and visualizations in the search space.

[1]:

from pymoo.algorithms.so_pattern_search import PatternSearch
from pymoo.factory import get_problem
from pymoo.optimize import minimize

problem = get_problem("ackley", n_var=30)

algorithm = PatternSearch()

res = minimize(problem,
algorithm,
seed=1,
verbose=False)

print("Best solution found: \nX = %s\nF = %s" % (res.X, res.F))

Best solution found:
X = [-9.27771855e-14 -2.97851640e-14 -1.26925499e-15  8.91408665e-14
-1.19684856e-14 -6.66560896e-14  8.11832539e-14 -8.68501150e-14
6.93977971e-14 -8.47269999e-14 -1.22541465e-13  1.15618649e-13
5.49523346e-14  4.71786414e-14 -8.61731588e-14 -6.07986908e-14
1.00688146e-13 -3.36770408e-14  3.38081544e-14  8.86496611e-14
-5.67424639e-14  7.34497267e-14 -7.59578144e-14 -2.42403699e-14
3.69602818e-14 -6.67519772e-14  4.79715018e-14  2.70083653e-14
-1.01982970e-13 -8.13052041e-14]
F = [2.88213897e-13]


## API¶

class pymoo.algorithms.so_pattern_search.PatternSearch(self, explr_delta=0.25, explr_rho=0.5, pattern_step=2, eps=1e-5, display=PatternSearchDisplay(), **kwargs)

An implementation of well-known Hooke and Jeeves Pattern Search.

Parameters
x0numpy.array

The initial value where the local search should be initiated. If not provided n_sample_points are created created using latin hypercube sampling and the best solution found is set to x0.

n_sample_pointsint

Number of sample points to be used to determine the initial search point. (Only used of x0 is not provided)

explr_deltafloat

The delta values which is used for the exploration move. If lower and upper bounds are provided the value is in relation to the overall search space. For instance, a value of 0.25 means that initially the pattern is created in 25% distance of the initial search point.

explr_rhofloat

If the move was unsuccessful then the delta value is reduced by multiplying it with the value provided. For instance, explr_rho implies that with a value of delta/2 is continued.

pattern_stepfloat

After the exploration move the new center is determined by following a promising direction. This value defines how large to step on this direction will be.

epsfloat

This value is used for an additional termination criterion. When all delta values (maximum move along each variable) is less than epsilon the algorithm is terminated. Otherwise, the default termination criteria are also used.