S move 5 move 6 left right move

  • Slides: 12
Download presentation
S

S

move 5 move 6 left right move 2 down move 4 down move 2

move 5 move 6 left right move 2 down move 4 down move 2 right. . . operator = actions = slide a tile up/down/left/right into empty space solution path is sequence of actions that transforms start state to goal

goal: 8 queens placed on 8 x 8 chessboard such that none can attack

goal: 8 queens placed on 8 x 8 chessboard such that none can attack each other operators = ?

Beam. Search(init, goal(), k) beam array[k] beam. insert(init) while True // or until beam

Beam. Search(init, goal(), k) beam array[k] beam. insert(init) while True // or until beam empty, or reach max iterations. . . curr beam[0] // pop best node in beam (highest score at front) for each child c operator(curr): beam. insert(c) beam. insert(node n, int k) temp n for i=0. . k-1 // or current number of items in beam if score(curr)>score(beam[i]): swap beam[i] and temp

89 72 56 55 51 48 36 30 22 21 temp=50 89 72 temp=48

89 72 56 55 51 48 36 30 22 21 temp=50 89 72 temp=48 89 72 56 55 51 50 36 30 22 21 89 72 56 55 51 50 48 36 30 22 note: something falls off end of beam (whatever is in curr on last pass) - it could be the kth item in beam, or the new node if it is worse than everything in beam

Simulated. Annealing(init, successors(), score(), max_iterations, schedule()) curr init for i=1. . max_iterations: T =

Simulated. Annealing(init, successors(), score(), max_iterations, schedule()) curr init for i=1. . max_iterations: T = schedule(i) next random_choice(successors(curr)) DE = score(next)-score(curr) if DE>0 then curr next else: p=e. DE/T // since DE<0, 0 p 1 if rand(0. . 1)<p then curr next // accept with probability e. DE/T