20CDE03 ARTIFICIAL INTELLIGENCE
UNIT III: A* AND RANDOMIZED SEARCH
METHOD
TOPICS IN THE UNIT
1. Algorithm A*
2. Admissibility of A*
3. Recursive Best First Search
4. Escaping local maxima
5. Iterated Hill Climbing
6. Simulated Annealing
7. Genetic Algorithm
8. Travelling Sales Problem
9. GA based methods for TSP
RECALLING...
1. Best first search only looks ahead from the node n, seeking
quick path to the goal
2. Branch and Bound looks behind, keeping track of the best
paths found so far.
F*(n)=cost of optimal path s -> n -> G
F*(n)= g*(n)+h*(n)
g*(n) and h*(n) may not know, so by assumption g(n) can be
thought of estimate of g*(n) and h(n) the heuristic function
that is estimate of h*(n)
Note : if * used then it is actual but unknown
ALGORITHM A*
Algorithm A* uses an evaluation function f to order its search,
F(n)= Estimated cost of a path from start to Goal via node n
The evaluation function has two components,
 g(n); Know cost of the path from s to n
 h(n); estimated cost from n to G
F(n)= g(n)+h(n)
EG: FOR H(N)<=H*(N)
A* has two nodes P and Q on the
OPEN list
Let the cost of reaching both P and
Q is 100
Cost of P to G is 30
Cost of Q to G is 40
g*(n) is lower than g(n), because
the algorithm may not have the
optimal path to n yet.
g(n)>=g*(n)
The heuristic value h(n) is an
estimate of the distance to the goal
It is necessary that the heuristic
function underestimate the
distance to the goal.
h(n)<=h*(n)
If both the conditions are true, then
A* is admissible
LET US A* HAS TWO VERSION A1 * AND A2* HAVING TWO
HEURISTIC+ FUNCTIONS H1(N) AND H2(N)
ASSUMPTION: G IS FOUND FROM P AND Q WITH DISTANCE 100,
WITH ERRONEOUS HEURISTIC FUNCTION ESTIMATING Q IS NEAR
TO G.
BUT ,
1. A1* OVERESTIMATES THE DISTANCE TO G
2. A2* UNDERESTIMATES THE DISTANCE TO G
Let us consider A2*,
f2(P)=g2(P)+h2(P)=100+20=120
f2(Q)=g2(Q)+h2(Q)=100+15=115
Since, Q has the minimum value so A1* choose it
for expansion
f2(P)=g2(P)+h2(P)=100+20=120
f2(Q)=g2(Q)+h2(Q)=140+0=140
A2* picks P instead of G and finds the shorter
path to G. (Because of underestimate)
ALGORITHM A*
The algorithm A* is described below. Like the Dijkstra’s Algorithm, it uses
a graph structure but one which it generates on a need basis during
search.
It is also called a graph search algorithm.
It keeps track of the best route it has found so far to every node on the
OPEN and CLOSED, via the parent link.
Since it may find cheaper routes to nodes it has already expanded, a
provision to pass on any improvements in cost to successors of nodes
generated earlier, has to be made.
ALGORITHM A*
• Instead, an explicit parent pointer is maintained. This has
been done because we want to keep only one copy of each
node, and reassign parents when the need arises.
• Consequently, the definition of the ReconstructPath
function will change.
• The revised definition is left as an exercise for the user.
ADMISSIBILITY OF A*
The algorithm A* will always find an optimal solution, provided the following
assumptions (A1 — A3) are true.
A1. The branching factor is finite. That is, there are only a finite number of choices at
every node in the search space.
A2. The cost of each move is greater than some arbitrarily small nonzero positive value
ε.
That is, for all m, n: k(m, n) > ε (epsilon)
A3. The heuristic function underestimates the cost to the goal node.
That is for all n: h(n) <= h*(n)
The proof is made up of a series of lemmas
ADMISSIBILITY OF A*
L1: THE ALGORITHM ALWAYS
TERMINATE FOR FINITE GRAPHS
1. The algorithm will pick a node from OPEN and places it in
CLOSED
2. For finite number of nodes, the algorithm will terminate in
finite number of cycles, even if it reaches goal
L2: IF A PATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS
CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE
OF THE NODE IS GREATER THAN THE OPTIMAL COST
S is on OPEN and Node n1 is a child of
S.
S is removed from OPEN, n1 is place on
OPEN
Likewise, the next nodes are placed on
OPEN.
When G is removed the A* will be
terminated.
L2: IF A PATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS
CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE
OF THE NODE IS GREATER THAN THE OPTIMAL COST
f(n')=g(n') +h(n')
f(n')=g*(n') +h(n') ; n' is optimal path
g(n')=g*(n')
f(n')<=g*(n') +h*(n') ; h(n')<=h*(n)
f(n')<=f*(n')
f(n')<=f*(S) ; n' is on the optimal path
f*(S) is the optimal cost path from S to G
L2: IF A PATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS
CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE
OF THE NODE IS GREATER THAN THE OPTIMAL COST
f(n')=g(n') +h(n')
f(n')=g*(n') +h(n') ; n' is optimal path
g(n')=g*(n')
f(n')<=g*(n') +h*(n') ; h(n')<=h*(n)
f(n')<=f*(n')
f(n')<=f*(S) ; n' is on the optimal path
f*(S) is the optimal cost path from S to G
L4: A* FINDS THE LEAST COST PATH TO THE GOAL
Proof (by contradiction)
Assumption A4: Let A* terminate with node G' with cost g(G') > f*(S).
At the last step when A* was about to expand G', there must exist (L2)
a node n' such that f (n) < f*(S). Therefore, f(n’) < f (G'), and A* would
have picked n' instead of G'. Thus, assumption A4 is wrong, and A* could
not have terminated with any node with a suboptimal cost. Therefore, A*
terminates by finding the optimal cost path.
L5: FOR EVERY NODE N EXPANDED BY A*, F(N) < F*(S)
A* picked node n in preference to node n'
f(n)<=f(n')=f*(S)
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
Proof (by induction) We show that any node expanded by A2; is also ‘expanded by A1.
The property P that we need to prove for all nodes n is,
expands(n, A2) => expands(n, A1)
Basis: expands(n, A2) => expands(n, A1) since both start with S.
Hypothesis: Let P be true for all nodes up to depth k from S.
Proof step: (to show that property P is true for nodes at depth k +1).
by contradiction.
Assumption: Let there exist a node L at depth k +1 that is expanded by A2, and such
that A terminates without expanding node L.
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
Let A1 and A2; be two admissible versions of A* using heuristic functions
h1 and h2 ,let h2(n) > h1(n) for all n.
h1 is more informed than h2, because it is closer to the h* value. Since both
versions are admissible, both heuristic functions have h(n) as the upper
bound.
Any node expanded by A2, is also expanded by A1. That is, the
version with the more informed heuristic function is more focused on the
goal, and will never generate more nodes than the less informed one.
ALGORITHM A*
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
L6: A MORE INFORMED HEURISTIC LEADS TO MORE
FOCUSED SEARCH.
The assumption that A2 terminates without expanding L is
false, and therefore A2 must expand L.
Since L was an arbitrary node picked at depth k+1, the
property P is true for depth k+1 as well.
Thus by induction for all nodes n, the property is true.
For all nodes n, expands(n, A2) => expands(n, A1)
MONOTONE PROPERTY /
CONSISTENCY PROPERTY
The heuristic function, for a node n that is successor to a node
m on a path to the goal being constructed by the algorithm A*
using the heuristic function h(x)
h(m)-h(n)<=k(m, n)
MONOTONE PROPERTY /
CONSISTENCY PROPERTY
L7: IF THE MONOTONE CONDITION
HOLDS FOR THE
HEURISTIC FUNCTION THEN AT THE
TIME WHEN A* PICKS A
NODE N FOR EXPANSION G(N) = G*(N).
L7: IF THE MONOTONE CONDITION
HOLDS FOR THE
HEURISTIC FUNCTION THEN AT THE
TIME WHEN A* PICKS A
NODE N FOR EXPANSION G(N) = G*(N).
PERFORMANCE OF A*
Completeness: Complete
Admissibility/Optimality: Admissible /Optimal
Time complexity & space complexity : For good heuristics, it is
linear and for poor heuristic it is exponential.
(more accurate heuristic function requires less time and
space)
WEIGHTED A*
f(n)=g(n)+k.h(n)
K is weight
When k=0, the algorithm is controlled by g(n) then it is BnB
If k value larger, then the algorithm is controlled by h(n) so it
behaves like Best First Search
RECURSIVE BEST FIRST SEARCH
(RBFS) BY RICHARD KORF
It requires linear space, but it as uses backtracking
Backtracking occurs when the given / current node has no best
successors in the OPEN list
In RBFS, when a path is explored and backtracked from a node, the
algorithm stores the f-value (evaluation function) that is found.
The stored f-values are updated for the explored nodes.
RECURSIVE BEST FIRST SEARCH
The left, it pursues the middle path from
the root node with heuristic value 55, till
it reaches a point when all successors are
worse than 59, its left sibling.
It now rolls back the partial path and
reverts to the left sibling with value 59.
It also revises the estimate of the middle
node from 55 to 60,the best backed-up
values as shown by the upward arrows.
RECURSIVE BEST FIRST SEARCH
RBFS keeps the next best value as an upper bound for search to
progress further.
Backtracking is initiated when all the children of the current node
become costlier than the upper bound.
Space complexity : Unpredictable could be attained by experimental
results may polynomial, combinatorial, linear or exponential
Time complexity : Large computation time because, it may revisit a
node again and again
CLOSED PROBLEM
To overcome the issue of reducing memory , starting with the
CLOSED list.
Benefits:
1. It keeps a check on the nodes already visited and prevents
the search from expanding them again and again.
2. It is the means for reconstructing the path after the
solution is found.
ESCAPING LOCAL MAXIMA
Real world problems create search space that are too huge to
explore
For example, 100 variables in a SAT problem would lead to 2^100
possibilities, which is impossible to found solution.
For optimization in TSP, we could not find whether obtained
solution is the optimal one.
Complete search not being a viable option for large problems such
as Hill Climbing and Tabu Search work with bounded memories
ESCAPING LOCAL MAXIMA
Hill climbing may stuck in local maxima
In Tabu search, the possibility of moving towards a node is not
the best successor or even a better one.
HILL CLIMBING RECALL
Working in the solution space, our search algorithm
perturb candidate solutions in search of better ones.
The notion of a start node and a goal node in the state space is
replaced by optimizing the value of the evaluation or heuristic
function.
The start node in the search tree has no particular significance
when we are searching in the solution space. It is simply a
candidate solution we begin with.
HILL CLIMBING RECALL
For the Hill Climbing algorithm, this is the starting point of the
steepest gradient ascent (or descent, if the problem is of minimization).
Once the starting point is decided, the algorithm moves up (or down) along
the steepest gradient, and terminates when the gradient becomes zero.
The end point of the search is determined by the starting point, and the nature
of the surface defined by the evaluation function. If the surface is monotonic
then the end point is the global optimum; otherwise the search ends up at an
optimum that is in some sense closest to the starting point, but may only be a
local optimum.
ITERATED HILL CLIMBING
Iterated Hill Climbing exploits this property by doing a
series of searches from a set of randomly selected
different starting points.
The hope is that the best value found by at least one
of the searches will be the global optimum.
The IHC algorithm will work if the surface defined by
the evaluation function is smooth at the local level,
with perhaps small number of local optima globally
ITERATED HILL CLIMBING
The IHC algorithm has the same space requirements
as Hill Climbing. Both need a constant amount of
space to run.
The difference is that for different runs on the same
problem, the Hill Climbing algorithm will always return
the same result;
The IHC algorithm may return different results. This is
because its performance is determined by the random
choice of the random starting points.
A set of shaded nodes from where the steepest
gradient leads to the global maximum is called as
the footprint of the HC algorithm.
ITERATED HILL CLIMBING
If in one of the outer loop iterations of IHC, a point in this
region is chosen as the starting point then the algorithm will
find the optimal solution.
The larger the footprint is, the greater is the chance of
starting in it, and finding the optimum.
As the footprint gets smaller, one would need a larger
number of iterations in the outer loop to have a good chance
of finding the optimum.
If the footprint is very small then the number of iterations in
the outer loops may become prohibitively large, and one
may have to look for an alternative approach.
ITERATED HILL CLIMBING
RANDOM WALK
The search process makes moves in the search space in
complete disregard of the gradient.
RANDOM WALK
The search process makes moves in the search space in
complete disregard of the gradient.
RANDOM WALK VS HILL CLIMBING
RANDOM WALK HILL CLIMBLING
1. It performs exploration of the
search space.
2. Its performance is dependent
upon time. The longer you explore
the space, the more the chances
of finding the global optimum.
3. Because it is totally oblivious of
the gradient, it never gets stuck
on a local optimum. H
1. It relies on the exploitation of the
gradient.
2. Its performance depends upon
the nature of the surface. It
terminates on reaching an
optimum.
3. If the surface has a monotonic
gradient towards the global
optimum, HC will quickly reach
SIMULATED ANNEALING
It combines the activity of both explorative and exploitative searching methods
It makes probabilistic move in a random direction.
The probability of making the move is proportional to the gain of value made by the move.
Traditionally, this gain is associated with energy and the term ΔE to represent the change
in the evaluation value.
The larger the gain, the larger is the probability of making the move.
The algorithm will make a move even for negative gain moves with nonzero probability,
though this probability decreases as the move becomes worse.
The point is that the algorithm will make moves against the gradient too, but will have a
higher probability of making better moves.
SIMULATED ANNEALING
Consider a maximization problem from which
three states A, B and C.
Both A and B are maxima with B having a higher
evaluation value.
If the algorithm has to move from local maximum
A to C, it will have a negative gain of ΔEAC.
Likewise, if it has to move from B to C, it will have
to go through a negative gain of ΔEBC- Since this
is larger than ΔEAC, it is likely that the algorithm
moves from A to C more often than from B to C.
SIMULATED ANNEALING
It has the tendency to move to the better solution
It does not work well on the below graph
But IHC works for such situations
A randomized algorithm that has a simple and constant bias
towards better values is called Stochastic hill Climbing
SIMULATED ANNEALING
Again, since the positive gain from C to B is
higher; the algorithm is more likely to move
from C to B than to A.
That is, it is more likely that the algorithm
will move from A to B than in the other
direction.
Then, given a series of local maxima of
increasing magnitude, the search is likely to
move towards the better ones over a period
of time.
SIMULATED ANNEALING
Simulated Annealing starts of being closer to the Random Walk, but gradually becomes
more and more controlled by the gradient.
This changing behaviour is controlled by a parameter T called temperature.
High temperatures is associated with random behaviour, much like the movement of
molecules in a physical material.
In Simulated Annealing, we start with a high value of T and gradually decrease it to make
the search more and more deterministic. The probability of making a move at any point of
time is given by a sigmoid function of the gain ΔE and temperature T as given below,
P(C,N) <- 1/(1+e^-ΔE/T)
SIMULATED ANNEALING
P(C,N) <- 1/(1+e^-ΔE/T)
where P is the probability of making a move from the current node C to the new node N,
ΔE = (eval(N) -eval(C)) is the gain in value and T is an externally controlled parameter
called temperature.
Note that the above formula is for maximization of the evaluation function value. For
minimization, the negative sign in the denominator will be removed.
When the temperature tends to infinity, the probability is uniformly
0.5, irrespective of the ΔE value.
This means that there is equal probability of staying in the current
node, and shifting to the neighbour.
For finite values of T, ΔE is positive, the probability is greater than
half; and when it is negative, the probability is less than half.
Thus, a move to a better node is more likely to be made, than a
move to a worse node, though both have nonzero probability.
For any given temperature, the greater the ΔE, the more the
probability of the move being made.
When ΔE is negative then the probability becomes lower as the
loss in value becomes greater.
All temperatures, the probability is half when ΔE= 0.
This means that when the neighbour evaluates to the same value
as the current node, it does not matter and one may or may not
move to it with equal probability.
Temperature T becomes lower, the Sigmoid
probability function tends to become more
and more like a step function.
When T = 0, it is a step function and the
decision to move to the neighbour becomes a
deterministic one.
The search moves to the neighbour (with
probability = 1) if the neighbour is better (ΔE >
0), else it does not move to it (moves with
probability = 0).
A large number of probabilistic moves with the temperature
parameter being gradually reduced from a large initial value
to a lower one. The manner in which the temperature is
brought down is known as the cooling schedule.
The intuition is that starting off with random moves that allow
the search to explore the search space, the temperature is
lowered gradually to make the search more exploitative of the
gradient information.
GENETIC
ALGORITHM
GENETIC
ALGORITHM
Each species has its own strategy to live and
consume resources, if it is done successfully it
survives.
A species survives if the individuals of the
species survives, it at least long enough to
create the next generation.
Charles Darwin's "Survival of the fittest" : A
good design of the living creature is , a
candidate solution for the problem of life is the
one that’s survive
The creature must survive on the limited amount
of energy that is available.
GA
If survival is competition, then life forms evolves by the process of natural selection
If there is competition between species, then it may also lead to competition within species
This competition to the continual improvement of the species
By Edward Cope's hypothesis the body size of the member of a species grows with evolution
(Cope)^3
As the species evolves the ecosystem choose the individuals that survive longer
The offspring of a species will inherit the features from both the parents.
The process has the element of random move, some children will have
good qualities, and some may have not
GA
The design of the individual is expressed in the genetic make-up
of the individual known as genotype
A chromosome is a large macromolecule in which normally
packed in a cell and contains many genes.
The genes carries the information in the physical form called
DNA Deoxyribonucleic acid
It contains the genetic instructions for the biological development of
a cellular form of life or a virus.
DNA
DNA consists of a pair of molecules, organized as strands running
start-to-end and joined by hydrogen bonds along their lengths.
Each strand is a chain of chemical "building blocks", called
nucleotides, of which there are four types:
1. adenine (A),
2. cytosine (C),
3. guanine (G) and
4. thymine (T).
DNA is thought to have originated approximately 3.5 to 4.6 billion
years ago and is responsible for the genetic propagation of most
inherited traits.
GENETIC ALGORITHM
During cell division, DNA is replicated, and during reproduction is transmitted to
offspring.
The offspring's genome is a combination of the genomes of its parents.
Genetic Algorithms (GA) are a class of algorithms that try and build solutions by
introducing evolution and selection of the best in a population of candidate solutions.
The first thing one must do is to encode the problem by devising a schema for
candidate solutions.
An artificial chromosome, or the DNA sequence that is the blueprint of the solution.
The chromosome is made up of the different components that make up the solution.
Starting with a population of strings, GAs involve churning of the genes in search of
better combinations.
THREE BASIC
OPERATIONS
IN GENETIC
ALGORITHMS
Selection
Recombination
Mutation
GA: SELECTION
The selection operator allows the fitter candidates to be chosen for reproduction, and thus
propagation of the genes (components).
The purpose of writing the GA is to produce a good design (solution).
GAs employ a user specified function to decide which designs/solutions are good or not.
This function is called the fitness function and gives a fitness value to each candidate.
In optimization, we called this function the evaluation function.
The selection operator takes a population of candidates and reproduces (clones) them in
proportion to their fitness values.
Fitter candidates will have more copies made, and the worst ones may not get replicated.
GA: RECOMBINATION
The recombination operator takes the output of the selection
operator, and randomly mates pairs of candidates in the population,
producing offspring that inherit components (genes) from both
parents.
The new population thus contains a totally different set of solutions.
In order to preserve the best candidates, sometime elitism is
followed, that allows the best few candidates to have cloned copies
in the new generation.
GA: MUTATION
Child gets a mutated copy of a gene from the parent.
GAs incorporate mutations to allow for the possibility of making good
random moves.
As a result, even when the population does not contain a good gene, there
is a chance that it may arise out of a random mutation.
The most commonly used operator to recombine the genes from the two
parents is known as the crossover operator.
A single point crossover simply cuts the two parents at a randomly chosen
point and recombines them to form two new solution strings.
GA: MUTATION
A two point crossover would be equivalent
to doing the above operation twice.

AI : A* AND RANDOMIZED SEARCH METHOD​.pptx

  • 1.
    20CDE03 ARTIFICIAL INTELLIGENCE UNITIII: A* AND RANDOMIZED SEARCH METHOD
  • 2.
    TOPICS IN THEUNIT 1. Algorithm A* 2. Admissibility of A* 3. Recursive Best First Search 4. Escaping local maxima 5. Iterated Hill Climbing 6. Simulated Annealing 7. Genetic Algorithm 8. Travelling Sales Problem 9. GA based methods for TSP
  • 3.
    RECALLING... 1. Best firstsearch only looks ahead from the node n, seeking quick path to the goal 2. Branch and Bound looks behind, keeping track of the best paths found so far.
  • 4.
    F*(n)=cost of optimalpath s -> n -> G F*(n)= g*(n)+h*(n) g*(n) and h*(n) may not know, so by assumption g(n) can be thought of estimate of g*(n) and h(n) the heuristic function that is estimate of h*(n) Note : if * used then it is actual but unknown
  • 5.
    ALGORITHM A* Algorithm A*uses an evaluation function f to order its search, F(n)= Estimated cost of a path from start to Goal via node n The evaluation function has two components,  g(n); Know cost of the path from s to n  h(n); estimated cost from n to G F(n)= g(n)+h(n)
  • 6.
    EG: FOR H(N)<=H*(N) A*has two nodes P and Q on the OPEN list Let the cost of reaching both P and Q is 100 Cost of P to G is 30 Cost of Q to G is 40
  • 7.
    g*(n) is lowerthan g(n), because the algorithm may not have the optimal path to n yet. g(n)>=g*(n) The heuristic value h(n) is an estimate of the distance to the goal It is necessary that the heuristic function underestimate the distance to the goal. h(n)<=h*(n) If both the conditions are true, then A* is admissible
  • 8.
    LET US A*HAS TWO VERSION A1 * AND A2* HAVING TWO HEURISTIC+ FUNCTIONS H1(N) AND H2(N) ASSUMPTION: G IS FOUND FROM P AND Q WITH DISTANCE 100, WITH ERRONEOUS HEURISTIC FUNCTION ESTIMATING Q IS NEAR TO G. BUT , 1. A1* OVERESTIMATES THE DISTANCE TO G 2. A2* UNDERESTIMATES THE DISTANCE TO G
  • 9.
    Let us considerA2*, f2(P)=g2(P)+h2(P)=100+20=120 f2(Q)=g2(Q)+h2(Q)=100+15=115 Since, Q has the minimum value so A1* choose it for expansion f2(P)=g2(P)+h2(P)=100+20=120 f2(Q)=g2(Q)+h2(Q)=140+0=140 A2* picks P instead of G and finds the shorter path to G. (Because of underestimate)
  • 10.
    ALGORITHM A* The algorithmA* is described below. Like the Dijkstra’s Algorithm, it uses a graph structure but one which it generates on a need basis during search. It is also called a graph search algorithm. It keeps track of the best route it has found so far to every node on the OPEN and CLOSED, via the parent link. Since it may find cheaper routes to nodes it has already expanded, a provision to pass on any improvements in cost to successors of nodes generated earlier, has to be made.
  • 11.
    ALGORITHM A* • Instead,an explicit parent pointer is maintained. This has been done because we want to keep only one copy of each node, and reassign parents when the need arises. • Consequently, the definition of the ReconstructPath function will change. • The revised definition is left as an exercise for the user.
  • 12.
    ADMISSIBILITY OF A* Thealgorithm A* will always find an optimal solution, provided the following assumptions (A1 — A3) are true. A1. The branching factor is finite. That is, there are only a finite number of choices at every node in the search space. A2. The cost of each move is greater than some arbitrarily small nonzero positive value ε. That is, for all m, n: k(m, n) > ε (epsilon) A3. The heuristic function underestimates the cost to the goal node. That is for all n: h(n) <= h*(n) The proof is made up of a series of lemmas
  • 13.
  • 14.
    L1: THE ALGORITHMALWAYS TERMINATE FOR FINITE GRAPHS 1. The algorithm will pick a node from OPEN and places it in CLOSED 2. For finite number of nodes, the algorithm will terminate in finite number of cycles, even if it reaches goal
  • 15.
    L2: IF APATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE OF THE NODE IS GREATER THAN THE OPTIMAL COST S is on OPEN and Node n1 is a child of S. S is removed from OPEN, n1 is place on OPEN Likewise, the next nodes are placed on OPEN. When G is removed the A* will be terminated.
  • 16.
    L2: IF APATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE OF THE NODE IS GREATER THAN THE OPTIMAL COST f(n')=g(n') +h(n') f(n')=g*(n') +h(n') ; n' is optimal path g(n')=g*(n') f(n')<=g*(n') +h*(n') ; h(n')<=h*(n) f(n')<=f*(n') f(n')<=f*(S) ; n' is on the optimal path f*(S) is the optimal cost path from S to G
  • 17.
    L2: IF APATH EXISTS TO THE GOAL NODE, THEN THE OPEN LIST ALWAYS CONTAINS A NODE N' FROM AN OPTIMAL PATH. MOREOVER, THE F-VALUE OF THE NODE IS GREATER THAN THE OPTIMAL COST f(n')=g(n') +h(n') f(n')=g*(n') +h(n') ; n' is optimal path g(n')=g*(n') f(n')<=g*(n') +h*(n') ; h(n')<=h*(n) f(n')<=f*(n') f(n')<=f*(S) ; n' is on the optimal path f*(S) is the optimal cost path from S to G
  • 18.
    L4: A* FINDSTHE LEAST COST PATH TO THE GOAL Proof (by contradiction) Assumption A4: Let A* terminate with node G' with cost g(G') > f*(S). At the last step when A* was about to expand G', there must exist (L2) a node n' such that f (n) < f*(S). Therefore, f(n’) < f (G'), and A* would have picked n' instead of G'. Thus, assumption A4 is wrong, and A* could not have terminated with any node with a suboptimal cost. Therefore, A* terminates by finding the optimal cost path.
  • 20.
    L5: FOR EVERYNODE N EXPANDED BY A*, F(N) < F*(S) A* picked node n in preference to node n' f(n)<=f(n')=f*(S)
  • 21.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH. Proof (by induction) We show that any node expanded by A2; is also ‘expanded by A1. The property P that we need to prove for all nodes n is, expands(n, A2) => expands(n, A1) Basis: expands(n, A2) => expands(n, A1) since both start with S. Hypothesis: Let P be true for all nodes up to depth k from S. Proof step: (to show that property P is true for nodes at depth k +1). by contradiction. Assumption: Let there exist a node L at depth k +1 that is expanded by A2, and such that A terminates without expanding node L.
  • 22.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH. Let A1 and A2; be two admissible versions of A* using heuristic functions h1 and h2 ,let h2(n) > h1(n) for all n. h1 is more informed than h2, because it is closer to the h* value. Since both versions are admissible, both heuristic functions have h(n) as the upper bound. Any node expanded by A2, is also expanded by A1. That is, the version with the more informed heuristic function is more focused on the goal, and will never generate more nodes than the less informed one.
  • 23.
  • 24.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH.
  • 25.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH.
  • 26.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH.
  • 27.
    L6: A MOREINFORMED HEURISTIC LEADS TO MORE FOCUSED SEARCH. The assumption that A2 terminates without expanding L is false, and therefore A2 must expand L. Since L was an arbitrary node picked at depth k+1, the property P is true for depth k+1 as well. Thus by induction for all nodes n, the property is true. For all nodes n, expands(n, A2) => expands(n, A1)
  • 28.
    MONOTONE PROPERTY / CONSISTENCYPROPERTY The heuristic function, for a node n that is successor to a node m on a path to the goal being constructed by the algorithm A* using the heuristic function h(x) h(m)-h(n)<=k(m, n)
  • 29.
  • 30.
    L7: IF THEMONOTONE CONDITION HOLDS FOR THE HEURISTIC FUNCTION THEN AT THE TIME WHEN A* PICKS A NODE N FOR EXPANSION G(N) = G*(N).
  • 31.
    L7: IF THEMONOTONE CONDITION HOLDS FOR THE HEURISTIC FUNCTION THEN AT THE TIME WHEN A* PICKS A NODE N FOR EXPANSION G(N) = G*(N).
  • 32.
    PERFORMANCE OF A* Completeness:Complete Admissibility/Optimality: Admissible /Optimal Time complexity & space complexity : For good heuristics, it is linear and for poor heuristic it is exponential. (more accurate heuristic function requires less time and space)
  • 33.
    WEIGHTED A* f(n)=g(n)+k.h(n) K isweight When k=0, the algorithm is controlled by g(n) then it is BnB If k value larger, then the algorithm is controlled by h(n) so it behaves like Best First Search
  • 34.
    RECURSIVE BEST FIRSTSEARCH (RBFS) BY RICHARD KORF It requires linear space, but it as uses backtracking Backtracking occurs when the given / current node has no best successors in the OPEN list In RBFS, when a path is explored and backtracked from a node, the algorithm stores the f-value (evaluation function) that is found. The stored f-values are updated for the explored nodes.
  • 35.
    RECURSIVE BEST FIRSTSEARCH The left, it pursues the middle path from the root node with heuristic value 55, till it reaches a point when all successors are worse than 59, its left sibling. It now rolls back the partial path and reverts to the left sibling with value 59. It also revises the estimate of the middle node from 55 to 60,the best backed-up values as shown by the upward arrows.
  • 36.
    RECURSIVE BEST FIRSTSEARCH RBFS keeps the next best value as an upper bound for search to progress further. Backtracking is initiated when all the children of the current node become costlier than the upper bound. Space complexity : Unpredictable could be attained by experimental results may polynomial, combinatorial, linear or exponential Time complexity : Large computation time because, it may revisit a node again and again
  • 37.
    CLOSED PROBLEM To overcomethe issue of reducing memory , starting with the CLOSED list. Benefits: 1. It keeps a check on the nodes already visited and prevents the search from expanding them again and again. 2. It is the means for reconstructing the path after the solution is found.
  • 38.
    ESCAPING LOCAL MAXIMA Realworld problems create search space that are too huge to explore For example, 100 variables in a SAT problem would lead to 2^100 possibilities, which is impossible to found solution. For optimization in TSP, we could not find whether obtained solution is the optimal one. Complete search not being a viable option for large problems such as Hill Climbing and Tabu Search work with bounded memories
  • 39.
    ESCAPING LOCAL MAXIMA Hillclimbing may stuck in local maxima In Tabu search, the possibility of moving towards a node is not the best successor or even a better one.
  • 40.
    HILL CLIMBING RECALL Workingin the solution space, our search algorithm perturb candidate solutions in search of better ones. The notion of a start node and a goal node in the state space is replaced by optimizing the value of the evaluation or heuristic function. The start node in the search tree has no particular significance when we are searching in the solution space. It is simply a candidate solution we begin with.
  • 41.
    HILL CLIMBING RECALL Forthe Hill Climbing algorithm, this is the starting point of the steepest gradient ascent (or descent, if the problem is of minimization). Once the starting point is decided, the algorithm moves up (or down) along the steepest gradient, and terminates when the gradient becomes zero. The end point of the search is determined by the starting point, and the nature of the surface defined by the evaluation function. If the surface is monotonic then the end point is the global optimum; otherwise the search ends up at an optimum that is in some sense closest to the starting point, but may only be a local optimum.
  • 42.
    ITERATED HILL CLIMBING IteratedHill Climbing exploits this property by doing a series of searches from a set of randomly selected different starting points. The hope is that the best value found by at least one of the searches will be the global optimum. The IHC algorithm will work if the surface defined by the evaluation function is smooth at the local level, with perhaps small number of local optima globally
  • 43.
    ITERATED HILL CLIMBING TheIHC algorithm has the same space requirements as Hill Climbing. Both need a constant amount of space to run. The difference is that for different runs on the same problem, the Hill Climbing algorithm will always return the same result; The IHC algorithm may return different results. This is because its performance is determined by the random choice of the random starting points. A set of shaded nodes from where the steepest gradient leads to the global maximum is called as the footprint of the HC algorithm.
  • 44.
    ITERATED HILL CLIMBING Ifin one of the outer loop iterations of IHC, a point in this region is chosen as the starting point then the algorithm will find the optimal solution. The larger the footprint is, the greater is the chance of starting in it, and finding the optimum. As the footprint gets smaller, one would need a larger number of iterations in the outer loop to have a good chance of finding the optimum. If the footprint is very small then the number of iterations in the outer loops may become prohibitively large, and one may have to look for an alternative approach.
  • 45.
  • 46.
    RANDOM WALK The searchprocess makes moves in the search space in complete disregard of the gradient.
  • 47.
    RANDOM WALK The searchprocess makes moves in the search space in complete disregard of the gradient.
  • 48.
    RANDOM WALK VSHILL CLIMBING RANDOM WALK HILL CLIMBLING 1. It performs exploration of the search space. 2. Its performance is dependent upon time. The longer you explore the space, the more the chances of finding the global optimum. 3. Because it is totally oblivious of the gradient, it never gets stuck on a local optimum. H 1. It relies on the exploitation of the gradient. 2. Its performance depends upon the nature of the surface. It terminates on reaching an optimum. 3. If the surface has a monotonic gradient towards the global optimum, HC will quickly reach
  • 49.
    SIMULATED ANNEALING It combinesthe activity of both explorative and exploitative searching methods It makes probabilistic move in a random direction. The probability of making the move is proportional to the gain of value made by the move. Traditionally, this gain is associated with energy and the term ΔE to represent the change in the evaluation value. The larger the gain, the larger is the probability of making the move. The algorithm will make a move even for negative gain moves with nonzero probability, though this probability decreases as the move becomes worse. The point is that the algorithm will make moves against the gradient too, but will have a higher probability of making better moves.
  • 50.
    SIMULATED ANNEALING Consider amaximization problem from which three states A, B and C. Both A and B are maxima with B having a higher evaluation value. If the algorithm has to move from local maximum A to C, it will have a negative gain of ΔEAC. Likewise, if it has to move from B to C, it will have to go through a negative gain of ΔEBC- Since this is larger than ΔEAC, it is likely that the algorithm moves from A to C more often than from B to C.
  • 51.
    SIMULATED ANNEALING It hasthe tendency to move to the better solution It does not work well on the below graph But IHC works for such situations A randomized algorithm that has a simple and constant bias towards better values is called Stochastic hill Climbing
  • 52.
    SIMULATED ANNEALING Again, sincethe positive gain from C to B is higher; the algorithm is more likely to move from C to B than to A. That is, it is more likely that the algorithm will move from A to B than in the other direction. Then, given a series of local maxima of increasing magnitude, the search is likely to move towards the better ones over a period of time.
  • 53.
    SIMULATED ANNEALING Simulated Annealingstarts of being closer to the Random Walk, but gradually becomes more and more controlled by the gradient. This changing behaviour is controlled by a parameter T called temperature. High temperatures is associated with random behaviour, much like the movement of molecules in a physical material. In Simulated Annealing, we start with a high value of T and gradually decrease it to make the search more and more deterministic. The probability of making a move at any point of time is given by a sigmoid function of the gain ΔE and temperature T as given below, P(C,N) <- 1/(1+e^-ΔE/T)
  • 54.
    SIMULATED ANNEALING P(C,N) <-1/(1+e^-ΔE/T) where P is the probability of making a move from the current node C to the new node N, ΔE = (eval(N) -eval(C)) is the gain in value and T is an externally controlled parameter called temperature. Note that the above formula is for maximization of the evaluation function value. For minimization, the negative sign in the denominator will be removed.
  • 55.
    When the temperaturetends to infinity, the probability is uniformly 0.5, irrespective of the ΔE value. This means that there is equal probability of staying in the current node, and shifting to the neighbour. For finite values of T, ΔE is positive, the probability is greater than half; and when it is negative, the probability is less than half. Thus, a move to a better node is more likely to be made, than a move to a worse node, though both have nonzero probability.
  • 56.
    For any giventemperature, the greater the ΔE, the more the probability of the move being made. When ΔE is negative then the probability becomes lower as the loss in value becomes greater. All temperatures, the probability is half when ΔE= 0. This means that when the neighbour evaluates to the same value as the current node, it does not matter and one may or may not move to it with equal probability.
  • 57.
    Temperature T becomeslower, the Sigmoid probability function tends to become more and more like a step function. When T = 0, it is a step function and the decision to move to the neighbour becomes a deterministic one. The search moves to the neighbour (with probability = 1) if the neighbour is better (ΔE > 0), else it does not move to it (moves with probability = 0).
  • 58.
    A large numberof probabilistic moves with the temperature parameter being gradually reduced from a large initial value to a lower one. The manner in which the temperature is brought down is known as the cooling schedule. The intuition is that starting off with random moves that allow the search to explore the search space, the temperature is lowered gradually to make the search more exploitative of the gradient information.
  • 60.
  • 61.
    GENETIC ALGORITHM Each species hasits own strategy to live and consume resources, if it is done successfully it survives. A species survives if the individuals of the species survives, it at least long enough to create the next generation. Charles Darwin's "Survival of the fittest" : A good design of the living creature is , a candidate solution for the problem of life is the one that’s survive The creature must survive on the limited amount of energy that is available.
  • 62.
    GA If survival iscompetition, then life forms evolves by the process of natural selection If there is competition between species, then it may also lead to competition within species This competition to the continual improvement of the species By Edward Cope's hypothesis the body size of the member of a species grows with evolution (Cope)^3 As the species evolves the ecosystem choose the individuals that survive longer The offspring of a species will inherit the features from both the parents. The process has the element of random move, some children will have good qualities, and some may have not
  • 63.
    GA The design ofthe individual is expressed in the genetic make-up of the individual known as genotype A chromosome is a large macromolecule in which normally packed in a cell and contains many genes. The genes carries the information in the physical form called DNA Deoxyribonucleic acid It contains the genetic instructions for the biological development of a cellular form of life or a virus.
  • 64.
    DNA DNA consists ofa pair of molecules, organized as strands running start-to-end and joined by hydrogen bonds along their lengths. Each strand is a chain of chemical "building blocks", called nucleotides, of which there are four types: 1. adenine (A), 2. cytosine (C), 3. guanine (G) and 4. thymine (T). DNA is thought to have originated approximately 3.5 to 4.6 billion years ago and is responsible for the genetic propagation of most inherited traits.
  • 65.
    GENETIC ALGORITHM During celldivision, DNA is replicated, and during reproduction is transmitted to offspring. The offspring's genome is a combination of the genomes of its parents. Genetic Algorithms (GA) are a class of algorithms that try and build solutions by introducing evolution and selection of the best in a population of candidate solutions. The first thing one must do is to encode the problem by devising a schema for candidate solutions. An artificial chromosome, or the DNA sequence that is the blueprint of the solution. The chromosome is made up of the different components that make up the solution. Starting with a population of strings, GAs involve churning of the genes in search of better combinations.
  • 66.
  • 67.
    GA: SELECTION The selectionoperator allows the fitter candidates to be chosen for reproduction, and thus propagation of the genes (components). The purpose of writing the GA is to produce a good design (solution). GAs employ a user specified function to decide which designs/solutions are good or not. This function is called the fitness function and gives a fitness value to each candidate. In optimization, we called this function the evaluation function. The selection operator takes a population of candidates and reproduces (clones) them in proportion to their fitness values. Fitter candidates will have more copies made, and the worst ones may not get replicated.
  • 68.
    GA: RECOMBINATION The recombinationoperator takes the output of the selection operator, and randomly mates pairs of candidates in the population, producing offspring that inherit components (genes) from both parents. The new population thus contains a totally different set of solutions. In order to preserve the best candidates, sometime elitism is followed, that allows the best few candidates to have cloned copies in the new generation.
  • 69.
    GA: MUTATION Child getsa mutated copy of a gene from the parent. GAs incorporate mutations to allow for the possibility of making good random moves. As a result, even when the population does not contain a good gene, there is a chance that it may arise out of a random mutation. The most commonly used operator to recombine the genes from the two parents is known as the crossover operator. A single point crossover simply cuts the two parents at a randomly chosen point and recombines them to form two new solution strings.
  • 70.
    GA: MUTATION A twopoint crossover would be equivalent to doing the above operation twice.