Title: CS621: Artificial Intelligence
1CS621 Artificial Intelligence
- Pushpak BhattacharyyaCSE Dept., IIT Bombay
- Lecture 5 Power of Heuristic non-conventional
search
2A Definitions and Properties
3A Algorithm Definition and Properties
- f(n) g(n) h(n)
- The node with the least value of f is chosen from
the OL. - f(n) g(n) h(n), where,
- g(n) actual cost of the optimal path (s, n)
- h(n) actual cost of optimal path (n, g)
- g(n) g(n)
- By definition, h(n) h(n)
s
S
g(n)
n
h(n)
goal
State space graph G
48-puzzle heuristics
Example 8 puzzle
s
n
g
- h(n) actual no. of moves to transform n to g
- h1(n) no. of tiles displaced from their
destined position. - h2(n) sum of Manhattan distances of tiles from
their destined position. - h1(n) h(n) and h1(n) h(n)
h
h2
h1
Comparison
5A Algorithm- Properties
- Admissibility An algorithm is called admissible
if it always terminates and terminates in optimal
path - Theorem A is admissible.
- Lemma Any time before A terminates there exists
on OL a node n such that f(n) lt f(s) - Observation For optimal path s ? n1 ? n2 ? ?
g, - 1. h(g) 0, g(s)0 and
- 2. f(s) f(n1) f(n2) f(n3) f(g)
6A Properties (contd.)
- f(ni) f(s), ni ? s and ni ? g
- Following set of equations show the above
equality - f(ni) g(ni) h(ni)
- f(ni1) g(ni1) h(ni1)
- g(ni1) g(ni) c(ni , ni1)
- h(ni1) h(ni) - c(ni , ni1)
- Above equations hold since the path is optimal.
7Admissibility of A A always terminates finding
an optimal path to the goal if such a path
exists. Intuition
(1) In the open list there always exists a node n
such that f(n) lt f(S) . (2) If A does not
terminate, the f value of the nodes expanded
become unbounded. 1) and 2) are together
inconsistent Hence A must terminate
S
g(n)
n
h(n)
G
8Lemma Any time before A terminates there exists
in the open list a node n' such that f(n') lt
f(S)
For any node ni on optimal path, f(ni) g(ni)
h(ni) lt g(ni) h(ni) Also f(ni)
f(S) Let n' be the fist node in the optimal path
that is in OL. Since all parents of n' have gone
to CL, g(n') g(n') and h(n') lt h(n') gt
f(n') lt f(S)
Optimal path
S
n1
n2
G
9If A does not terminate Let e be the least cost
of all arcs in the search graph. Then g(n) gt
e.l(n) where l(n) of arcs in the path from S
to n found so far. If A does not terminate, g(n)
and hence f(n) g(n) h(n) h(n) gt 0 will
become unbounded. This is not consistent with
the lemma. So A has to terminate.
102nd part of admissibility of A The path formed
by A is optimal when it has terminated
Proof Suppose the path formed is not optimal Let
G be expanded in a non-optimal path. At the
point of expansion of G, f(G) g(G) h(G)
g(G) 0 gt g(G) g(S) h(S)
f(S) f(S) cost of optimal path This is a
contradiction So path should be optimal
11Better Heuristic Performs Better
12Theorem A version A2 of A that has a better
heuristic than another version A1 of A performs
at least as well as A1
Meaning of better h2(n) gt h1(n) for all
n Meaning of as well as A1 expands at least
all the nodes of A2
h(n)
h2(n)
h1(n)
For all nodes n, except the goal node
13Proof by induction on the search tree of A2. A
on termination carves out a tree out of
G Induction on the depth k of the search tree of
A2. A1 before termination expands all the nodes
of depth k in the search tree of A2. k0. True
since start node S is expanded by both Suppose
A1 terminates without expanding a node n at
depth (k1) of A2 search tree. Since A1 has
seen all the parents of n seen by A2 g1(n) lt
g2(n) (1)
14Since A1 has terminated without expanding n,
f1(n) gt f(S) (2) Any node whose f value is
strictly less than f(S) has to be
expanded. Since A2 has expanded n f2(n) lt f(S)
(3)
S
k1
G
From (1), (2), and (3) h1(n) gt h2(n) which is a
contradiction. Therefore, A1 has to expand all
nodes that A2 has expanded.
Exercise If better means h2(n) gt h1(n) for some
n and h2(n) h1(n) for others, then Can you
prove the result ?
15A list of AI Search Algorithms
- A
- AO
- IDA (Iterative Deepening)
- Minimax Search on Game Trees
- Viterbi Search on Probabilistic FSA
- Hill Climbing
- Simulated Annealing
- Gradient Descent
- Stack Based Search
- Genetic Algorithms
- Memetic Algorithms
16Evolutionary search Genetic and Memetic Algoritms
17Evolution Fundamental Laws
- Survival of the fittest.
- Change in species is due to change in genes over
reproduction or/and due to mutation. - An Example showing the concept of survival of the
fittest and reproduction over generations.
18Evolutionary Computation
- Evolutionary Computation (EC) refers to
computer-based problem solving systems that use
computational models of evolutionary process. - Terminology
- Chromosome It is an individual representing a
candidate solution of the optimization problem. - Population A set of chromosomes.
- gene It is the fundamental building block of
the chromosome, each gene in a chromosome
represents each variable to be optimized. It is
the smallest unit of information. - Objective To find a best possible chromosome to
a given optimization problem.
19Evolutionary AlgorithmA meta-heuristic
- Let t 0 be the generation counter
- create and initialize a population P(0)
- repeat
- Evaluate the fitness, f(xi), for all xi
belonging to P(t) - Perform cross-over to produce offspring
- Perform mutation on offspring
- Select population P(t1) of new generation
- Advance to the new generation, i.e., t t1
- until stopping condition is true
20On Overview of GAs
- GA emulate genetic evolution.
- A GA has distinct features
- A string representation of chromosomes.
- A selection procedure for initial population and
for off-spring creation. - A cross-over method and a mutation method.
- A fitness function be to minimized.
- A replacement procedure.
- Parameters that affect GA are initial population,
size of the population, selection process and
fitness function.
21Anatomy of GA
22Selection
- Selection is a procedure of picking parent
chromosome to produce off-spring. - Types of selection
- Random Selection Parents are selected randomly
from the population. - Proportional Selection probabilities for
picking each chromosome is calculated as - P(xi) f(xi)/Sf(xj) for all j
- Rank Based Selection This method uses ranks
instead of absolute fitness values. - P(xi) (1/ß)(1 er(xi))
23Roulette Wheel Selection
- Let i 1, where i denotes chromosome index
- Calculate P(xi) using proportional selection
- sum P(xi)
- choose r U(0,1)
- while sum lt r do
- i i 1 i.e. next chromosome
- sum sum P(xi)
- end
- return xi as one of the selected parent
- repeat until all parents are selected
24Reproduction
- Reproduction is a processes of creating new
chromosomes out of chromosomes in the population. - Parents are put back into population after
reproduction. - Cross-over and Mutation are two parts in
reproduction of an off-spring. - Cross-over It is a process of creating one or
more new individuals through the combination of
genetic material randomly selected from two or
parents.
25Cross-over
- Uniform cross-over where corresponding bit
positions are randomly exchanged between two
parents. - One point random bit is selected and entire
sub-string after the bit is swapped. - Two point two bits are selected and the
sub-string between the bits is swapped.
26Mutation
- Mutation procedures depend upon the
representation schema of the chromosomes. - This is to prevent falling all solutions in
population into a local optimum. - For a bit-vector representation
- random mutation randomly negates bits
- in-order mutation performs random mutation
between two randomly selected bit position.