Hooke Jeeves Method
Hooke Jeeves Method
Method 3: Hooke-Jeeves
The Premise
The Hooke-Jeeves algorithm, also known as
“pattern search”, keeps track of the direction of
travel as the process moves from point to point,
instead of starting over from scratch at each
new point.
The First Step
1. Test your initial point in one dimension only,
for example by testing (x1 + .1, x2) and (x1 - .1,
x2).
? ?
?
Save the best value of x1.
2. Repeat for x2, using the best value of x1.
The First Step
1. Test your initial point in one dimension only,
for example by testing (x1 + .1, x2) and (x1 - .1,
x2). ?
? ?
?
Save the best value of x1.
2. Repeat for x2, using the best value of x1.
Now you have a new point made up of the
new values of x1 and x2.
Practice Problem 1
Write a program that, given a function f(x1, x2) and
an initial point, tests the function in all four
directions with a step of 0.1. Your program should
print:
1) The original point
2) The improved point
3) The vector between them, found by subtracting
(improved – original).
Test your code using f(x1, x2) = (x1 – 3)2 + (x2 + 1)2.
The Second Step
With the brute force method, we would just
repeat the process from the new point.
Instead, with Hooke-Jeeves, we use the vector
from the old point to the new point, and we
search in that direction until we stop seeing
improvement.
Practice Problem 2
Write a program that, given a function, a starting
point, and a vector, moves the point in the direction
of the vector until the function value stops
decreasing.
Test it on
f(x1, x2) = (x1 + x2)2 + (sin(x1 + 2))2 + (x2)2 + 10.
Document and save this program!