D Goforth - COSC 4117, fall 20061 Note to 4 th year students students interested in doing masters...

Post on 26-Dec-2015

212 views 0 download

Transcript of D Goforth - COSC 4117, fall 20061 Note to 4 th year students students interested in doing masters...

D Goforth - COSC 4117, fall 2006 1

Note to 4th year students

students interested in doing masters degree and those who intend to apply for OGS/NSERC scholarships should complete the required forms and apply before October 19. The forms can be obtained through the research office website.

Optimization Problems

searching a space when paths don’t matter

D Goforth - COSC 4117, fall 2006 3

Local search algorithms

If paths don’t matter, algorithms are able to ‘jump’ from state to state (ie not follow edges)

Examplethe n queens problem:

place n chess queens, n>3, on an n x n chess board so no queen threatens another according to chess rules

D Goforth - COSC 4117, fall 2006 4

Optimisation problems

find maximum value of a function over a parameter state space

e.g., one-dimensional = max f(x) over x

x

f(x)

D Goforth - COSC 4117, fall 2006 5

Optimisation problems

e.g., 2-dimensional = max f(x,y) over x,y

x

f(x,y)

y

D Goforth - COSC 4117, fall 2006 6

Algorithms

hill-climbing (~greedy best-first dfs) weaknesses

local optima ridges plateaux

variations on hill-climbing to avoid the traps

D Goforth - COSC 4117, fall 2006 7

Hill climbing

D Goforth - COSC 4117, fall 2006 8

Getting outside the local area

variations on hill-climbing choosing a successor that may not be the

optimal (escape by path) random restart (escape by jump) simulated annealing

D Goforth - COSC 4117, fall 2006 9

Getting outside the local area

choosing a successor that may not be the optimal (escape by path)

D Goforth - COSC 4117, fall 2006 10

Getting outside the local area

random restart

D Goforth - COSC 4117, fall 2006 11

Getting outside the local area

simulated annealing random move is generated, probability of

moving is based on change in value

x

f(x)

D Goforth - COSC 4117, fall 2006 12

Simulated annealing

Probability of move function

Probability of making bad move decreases with time

+-

probability of moving

D Goforth - COSC 4117, fall 2006 13

Avoiding paths altogether

genetic algorithms1. pick set of states randomly2. order states by fitness3. create new set of states by combining

state variables of most fit4. make a few random changes to state

variables5. go to 2

D Goforth - COSC 4117, fall 2006 14

Genetic algorithm example

Guessing a 32 bit sequence fitness function – number of matching

bits(hill-climbing would be better!)

D Goforth - COSC 4117, fall 2006 15

Genetic algorithm example population size: 4 first generation random fitness

1. 0110 1010 1011 0110 0110 1010 1010 1110 142. 1100 1101 0110 0101 1101 0010 0000 1010 153. 1101 0110 1011 1010 1001 1010 1010 1110 194. 0010 1101 1000 0111 0010 0110 1001 1001 13

order: 3,2,1,4 cross 3 x 2 and 3 x 1 for next generation

D Goforth - COSC 4117, fall 2006 16

Genetic algorithm example crossing 3 x 2

pick random cut point: after 9th

1100 1101 0|110 0101 1101 0010 0000 1010 1101 0110 1|011 1010 1001 1010 1010 1110

recombine crossed pieces 1100 1101 0|011 1010 1001 1010 1010 1110 21 1101 0110 1|110 0101 1101 0010 0000 1010 13

crossing 3 x 1 (cut after 21) 1101 0110 1011 1010 1001 1|010 1010 1110 18 0110 1010 1011 0110 0110 1|010 1010 1110 15

(4 potential new sequences)

D Goforth - COSC 4117, fall 2006 17

Genetic algorithm example next generation

1. 1100 1101 0110 0101 1101 0010 0000 1010 152. 1101 0110 1011 1010 1001 1010 1010 1110 193. 1100 1101 0011 1010 1001 1010 1010 1110 214. 1101 0110 1011 1010 1001 1010 1010 1110 18(2 best new combinations replace 2 worst from original

population) repeat