3 Optimizingsearch
3 Optimizingsearch
( x y )
Optimizing Search
(Iterative Improvement Algorithms)
Example Problem I
(Continuous)
y = f(x)
Example Problem II
(Discrete)
A
B
C
...
A
0
12
34
...
B
12
0
76
...
C
34
76
0
...
...
...
...
...
Function Fitting
Depending on the way the problem
is setup this, could be continuous
and/or discrete.
Discrete part
Finding the form of the function
is it X2 or X4 or ABS(log(X)) + 75
Continuous part
Finding the value for X
is it X= 3.1 or X= 3.2
Traveling Salesman
Function Optimizing
y = log(x) + sin(tan(y-x))
x = 2;
y = 7;
A C F K W..Q A
A to C = 234
C to F = 142
Total 10,231
x = add_10_percent(x)
y = subtract_10_percent(y)
.
A C F K W..Q A
A C K F W..Q A
A
B
C
...
A
0
12
34
...
B
12
0
76
...
Hill-Climbing I
function Hill-Climbing (problem) returns a solution state
inputs : problem
// a problem.
// a node.
next
// a node.
// initial state.
// a node
1 to do
T schedule [ t ]
if T = 0 then return current
next a randomly selected successor of current
E Value [ next ] - Value [ current ]
if E > 0 then current next
else current next only with probability eE/T
Richard Dawkins
Genetic Algorithms II
The basic idea of genetic algorithms (evolutionary programming).
Initialize a population of n states (randomly)
end
Report best state as answer.
All we need do is ...(A) Figure out how to represent the states. (B) Figure out a
fitness function. (C) Figure out how to allow our states to reproduce.
+
log
Another is a bitstring
100111010101001
tan
pow
sin
C
23
E
12
F
56
D
77
B
36
A
83
log
tan
pow
sin
Genetic Algorithms V
Parent state A
log
Sexual
Reproduction
(crossover)
sin
11101000
cos
Parent state B
+
sin
tan
Parent state A
10011000
Child of A and B
10011101
cos
tan
pow
Parent state B
Child of A and B
y
Genetic Algorithms VI
Parent state A
Asexual
Reproduction
Child of A
cos
Mutation
tan
Parent state A
10011101
Parent state A
10011111
Child of A
Mutation
D
F
Child of A
+
log
sin
cos
tan
pow