Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.
-
date post
20-Dec-2015 -
Category
Documents
-
view
222 -
download
0
Transcript of Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.
![Page 1: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/1.jpg)
Introduction to Artificial Intelligence
Local Search(updated 4/30/2006)
Henry Kautz
![Page 2: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/2.jpg)
Local Search in Continuous Spaces
initial state vector
( ) quantity to optimized
step size
until Goal_Test( ) do
( )
S
f S
S
fS S S
S
negative step to minimize fpositive step to maximize f
grad
ient
![Page 3: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/3.jpg)
Local Search in Discrete State Spaces
state = choose_start_state();while ! GoalTest(state) do
state := arg min { h(s) | s in Neighbors(state) }endreturn state;
• Terminology: – “neighbors” instead of “children”– heuristic h(s) is the “objective function”, no need to be
admissible• No guarantee of finding a solution
– sometimes: probabilistic guarantee• Best goal-finding, not path-finding• Many variations
![Page 4: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/4.jpg)
Local Search versus Systematic Search
• Systematic Search– BFS, DFS, IDS, Best-First, A*– Keeps some history of visited nodes– Always complete for finite search spaces,
some versions complete for infinite spaces– Good for building up solutions incrementally
• State = partial solution• Action = extend partial solution
![Page 5: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/5.jpg)
Local Search versus Systematic Search
• Local Search– Gradient descent, Greedy local search,
Simulated Annealing, Genetic Algorithms– Does not keep history of visited nodes– Not complete. May be able to argue will
terminate with “high probability”– Good for “fixing up” candidate solutions
• State = complete candidate solution that may not satisfy all constraints
• Action = make a small change in the candidate solution
![Page 6: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/6.jpg)
N-Queens Problem
![Page 7: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/7.jpg)
N-Queens Systematic Searchstate = choose_start_state();add state to Fringe;while ! GoalTest(state) do
choose state from Fringe according to h(state);Fringe = Fringe U { Children(state) }
endreturn state;
• start = empty board• GoalTest = N queens are on the board• h = (N – number of queens on the board) • children = all ways of adding one queen without creating
any attacks
![Page 8: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/8.jpg)
N-Queens Local Search, V1state = choose_start_state();while ! GoalTest(state) do
state := arg min { h(s) | s in Neighbors(state) }endreturn state;
• start = put down N queens randomly• GoalTest = Board has no attacking pairs• h = number of attacking pairs • neighbors = move one queen to a different square on the
board
![Page 9: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/9.jpg)
N-Queens Local Search, V2state = choose_start_state();while ! GoalTest(state) do
state := arg min { h(s) | s in Neighbors(state) }endreturn state;
• start = put a queen on each square with 50% probability• GoalTest = Board has N queens, no attacking pairs• h = (number of attacking pairs + max(0, N - # queens))• neighbors = add or delete one queen
![Page 10: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/10.jpg)
N Queens Demo
![Page 11: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/11.jpg)
States Where Greedy Search Must Succeed
obj
ect
ive
fun
ctio
n
![Page 12: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/12.jpg)
States Where Greedy Search Might Succeed
obj
ect
ive
fun
ctio
n
![Page 13: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/13.jpg)
Local Search Landscapeo
bje
ctiv
e fu
nct
ion
Local Minimum
Plateau
![Page 14: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/14.jpg)
Variations of Greedy Search
• Where to start?– RANDOM STATE– PRETTY GOOD STATE
• What to do when a local minimum is reached?– STOP– KEEP GOING
• Which neighbor to move to?– BEST neighbor– Any BETTER neighbor (Hill Climbing)
• How to make local search more robust?
![Page 15: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/15.jpg)
Restarts
for run = 1 to max_runs dostate = choose_start_state();flip = 0;while ! GoalTest(state) && flip++ < max_flips do
state := arg min { h(s) | s in Neighbors(state) }endif GoalTest(state) return state;
endreturn FAIL
![Page 16: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/16.jpg)
Uphill Moves: Random Noise
state = choose_start_state();while ! GoalTest(state) do
with probability noise dostate = random member Neighbors(state)
else state := arg min { h(s) | s in
Neighbors(state) }end
endreturn state;
![Page 17: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/17.jpg)
Uphill Moves: Simulated Annealing (Constant Temperature)
state = start;while ! GoalTest(state) do
next = random member Neighbors(state);deltaE = h(next) – h(state);if deltaE 0 then
state := next;else
with probability e-deltaE/temperature dostate := next;
endendif
endreturn state;
Book reverses, because is looking
for max h state
![Page 18: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/18.jpg)
![Page 19: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/19.jpg)
Uphill Moves: Simulated Annealing (Geometric Cooling Schedule)
temperature := start_temperature;state = choose_start_state();while ! GoalTest(state) do
next = random member Neighbors(state);deltaE = h(next) – h(state);if deltaE 0 then
state := next;else
with probability e-deltaE/temperature dostate := next;
endtemperature := cooling_rate * temperature;
endreturn state;
![Page 20: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/20.jpg)
Simulated Annealing
• For any finite problem with a fully-connected state space, will provably converge to optimum as length of schedule increases:
• But: fomal bound requires exponential search time
• In many practical applications, can solve problems with a faster, non-guaranteed schedule
cooling_rate 1lim Pr(optimum) 1
![Page 21: Introduction to Artificial Intelligence Local Search (updated 4/30/2006) Henry Kautz.](https://reader035.fdocuments.in/reader035/viewer/2022062421/56649d4d5503460f94a2caff/html5/thumbnails/21.jpg)
Other Local Search Strategies
• Tabu Search– Keep a history of the last K visited states– Revisiting a state on the history list is “tabu”
• Genetic algorithms– Population = set of K multiple search points– Neighborhood = population U mutations U crossovers
• Mutation = random change in a state• Crossovers = random mix of assignments from two states• Typically only a portion of neighbor is generated
– Search step: new population = K best members of neighborhood