0% found this document useful (0 votes)
33 views

CSE860 - 14 - Local Search Optimization

1. The document discusses local search and optimization techniques in artificial intelligence, including hill climbing, simulated annealing, beam search, and genetic algorithms. 2. It provides examples of applying hill climbing and random restart hill climbing to solve the 8 queens problem. Allowing limited sideways moves in hill climbing improves performance. 3. Simulated annealing is inspired by annealing in metallurgy and relates the running time of search to temperature, allowing more randomness early on. 4. Local beam search and genetic algorithms are variants of stochastic beam search that generate successor states from multiple parent states rather than a single state.

Uploaded by

Aqeel Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

CSE860 - 14 - Local Search Optimization

1. The document discusses local search and optimization techniques in artificial intelligence, including hill climbing, simulated annealing, beam search, and genetic algorithms. 2. It provides examples of applying hill climbing and random restart hill climbing to solve the 8 queens problem. Allowing limited sideways moves in hill climbing improves performance. 3. Simulated annealing is inspired by annealing in metallurgy and relates the running time of search to temperature, allowing more randomness early on. 4. Local beam search and genetic algorithms are variants of stochastic beam search that generate successor states from multiple parent states rather than a single state.

Uploaded by

Aqeel Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

CSE 860 Artificial Intelligence

(Local Search & Optimization)

Prof. Dr. Yasar Ayaz


(Pride of Performance)

Chairman / Central Project Director


National Center of Artificial Intelligence (NCAI)
Pakistan

Professor & Founding Head


Department of Robotics & AI
NUST-SMME
1
• Systematic Search
– Keep one or more alternate paths in memory at
each point along the path.
• Local Search
– Operate using a single current node (rather than
multiple paths) and generally move only to
neighbors of that node. Typically, the paths
followed by the search are not retained.

Wednesday, December 14,


2
2022
• Examples:
– Factory Floor Layout
– Job Shop Scheduling
– Vehicle Routing
– High level reasoning for robots
• Advantages:
– Low memory consumption
– Handling large or infinite search spaces

Wednesday, December 14,


3
2022
• State Space Landscape

Wednesday, December 14,


4
2022
• Follow Steepest Ascent till Highest Value of
Objective Function is reached.

Wednesday, December 14,


5
2022
• Example: 8-Queens Problem
State Formulation
→Each State has 8 Queens on
the board;
→Successors achieved by moving
a single queen in the same column;
(Sucessors: 8x7=56 for each state)
→ Heuristic: Number of pair of
queens attaching each other.
Wednesday, December 14,
6
2022
• Example: 8-Queens Problem

h = 17 h=1
5 Steps only
Wednesday, December 14,
7
2022
Performance in solving 8-Queens Problem:

– Solves: 14% of problem instances


(4 Steps on average)
– Gets Stuck: 86% of problem instances
(3 Steps on average)

Not bad considering that 8-Queens problem has


88 ≈ 17 Million States
Wednesday, December 14,
8
2022
But Why Does it Get Stuck?
• Local Maxima
• Plateaux
(Flat Local Maxima
or Shoulder)

• Ridges

Wednesday, December 14,


9
2022
How about allowing sideways moves when
there are no uphill moves possible?
• Targets handling ‘shoulders’.
• Allow limited sideways moves or end up in
infinite loop!

Wednesday, December 14,


10
2022
Performance in solving 8-Queens Problem:
(100 Consecutive Sideways Moves Permitted)
– Solves: 94% of problem instances
(21 Steps on average)
– Gets Stuck: 6% of problem instances
(64 Steps on average)

Not bad considering that 8-Queens problem has


88 ≈ 17 Million States
Wednesday, December 14,
11
2022
• Stochastic Hill Climbing
Choose randomly from available uphill moves.
• First-Choice Hill Climbing
Implement Stochastic Hill Climbing by generating
successors randomly until one better than current
state is found. (When there are too many
successors).

Wednesday, December 14,


12
2022
• Random-Restart Hill Climbing
“If at first you don’t succeed: Try, Try again!”

– Conduct series of Hill-Climbing Searches from


randomly generated initial states until a goal is
found.

Wednesday, December 14,


13
2022
• Random-Restart Hill Climbing
– If Probability of Success: p

1
➔ Expected Restarts Required:
p

– Total Expected Number of steps becomes:

1− p
Cost of successful iteration + (Cost of Failure)
p
Wednesday, December 14,
14
2022
• Random-Restart Hill Climbing
– For No Sidestep Allowed case: p = 0.14

1
➔ Expected Restarts Required: =7
p

– Total Expected Number of steps: 22


1 − 0.14
4+ (3)  22
0.14

Wednesday, December 14,


15
2022
• Random-Restart Hill Climbing
– For (upto 100) Sidestep Allowed case: p = 0.94

1
➔ Expected Restarts Required: = 1.06
p

– Total Expected Number of steps: 25


1 − 0.94
21 + (64)  25
0.94

Wednesday, December 14,


16
2022
• Random-Restart Hill Climbing
– For 8-queens, it turns out that random-restart hill
climbing is very effective indeed. Even for three
million queens, the approach can find solutions in
under a minute. Luby et al. (1993)

Wednesday, December 14,


17
2022
• Random-Restart Hill Climbing
– For 8-queens, it turns out that random-restart hill
climbing is very effective indeed. Even for three
million queens, the approach can find solutions in
under a minute. Luby et al. (1993)
• Success of Hill Climbing Search depends very
much on the shape of the state-space landscape:
if there are few local maxima and plateaux,
random-restart hill climbing will find a good
solution very quickly.

Wednesday, December 14,


18
2022
• In metallurgy, annealing is the process used to
temper or harden metals and glass by heating
them to a high temperature and then gradually
cooling them, thus allowing the material to reach
a low energy crystalline state.
• Simulated Annealing is inspired by this process. It
relates running time of the search with
Temperature in Annealing process allowing more
randomness in the early stages than in later ones.
Wednesday, December 14,
19
2022
• Imagine the task of getting a ping-pong ball into the
deepest crevice in a bumpy surface.
• If we just let the ball roll, it will come to rest at a local
minimum.
• If we shake the surface, we can bounce the ball out of
the local minimum.
• The trick is to shake just hard enough to bounce the
ball out of local minima but not hard enough to
dislodge it from the global minimum. The simulated-
annealing solution is to start by shaking hard (i.e., at a
high temperature) and then gradually reduce the
intensity of the shaking (i.e., lower the temperature).

Wednesday, December 14,


20
2022
Wednesday, December 14,
21
2022
• The local beam search algorithm keeps track
of k states rather than just one.
• It begins with k randomly generated states.
• At each step, all the successors of all k states
are generated.
• If any one is a goal, the algorithm halts.
Otherwise, it selects the k best successors
from the complete list and repeats.
Wednesday, December 14,
22
2022
• In a local beam search, useful information is
passed among the parallel search threads.

• In effect, the states that generate the best


successors say to the others, “Come over here,
the grass is greener!” The algorithm quickly
abandons unfruitful searches and moves its
resources to where the most progress is being
made.

Wednesday, December 14,


23
2022
• A Genetic Algorithm (or GA) is a variant of
stochastic beam search in which successor states
are generated by combining two parent states
rather than by modifying a single state.
• Like beam searches, GAs begin with a set of k
randomly generated states, called the population.
Each state, or individual, is represented as a string
over a finite alphabet—most commonly, a string
of 0s and 1s.
Wednesday, December 14,
24
2022
• For example, an 8-queens state must specify
the positions of 8 queens. The state could be
represented as 8 digits, each in the range from
1 to 8.

➔ 16257483

Wednesday, December 14,


25
2022
(a) Initial Population
– 4 arrangements of 8 Queens placed on the board.

Wednesday, December 14,


26
2022
(b) Fitness Function
– Number of Non-Attacking Pair of Queens.
– %age is calculated over total value of fitness functions of
the population.

Wednesday, December 14,


27
2022
(c) Selection
– Random selection for reproduction of states.
– Random selection of crossover point for each pair
from the possible positions in the string.

Wednesday, December 14,


28
2022
(d) Crossover
– Offsprings are generated by crossing over parent
strings at crossover point.
Wednesday, December 14,
29
2022
(d) Crossover
– Offsprings are generated by crossing over parent
strings at crossover point.
Wednesday, December 14,
30
2022
(e) Mutation
– Each location is subject to random mutation with
a small independent probability.
Wednesday, December 14,
31
2022
Wednesday, December 14,
32
2022
(c) Selection (Variant)
– As a variant to Random selection, methods such as
Culling proceed by discarding individuals with value of
fitness function below a certain value. This leads to
faster convergence (Baum et al, 1995).
Wednesday, December 14,
33
2022
• Variant: Placement of a queen in a column can
be represented in 3 binary digits i.e. 3 bits,
and so it requires 8× log2 8=24 bits.

000 101 00
➔ 1 100 110 0
11 111 010

Wednesday, December 14,


34
2022
• In this 24 bit encoding, there’s a 2/3rd chance
of crossover point coming out to be in the
middle of a digit i.e. a very arbitrary mutation.

000 101 00
➔ 1 100 110 0
11 111 010

Wednesday, December 14,


35
2022

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy