Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search.

Similar presentations


Presentation on theme: "CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search."— Presentation transcript:

1 CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search

2 A*: Definitions and Properties

3 A* 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 n goal State space graph G g(n) h(n)

4 8-puzzle: heuristics 214 783 56 167 432 58 123 456 78 sng Example: 8 puzzle h*(n) = actual no. of moves to transform n to g 1.h 1 (n) = no. of tiles displaced from their destined position. 2.h 2 (n) = sum of Manhattan distances of tiles from their destined position. h 1 (n) ≤ h*(n) and h 1 (n) ≤ h*(n) h* h2h2 h1h1 Comparison

5 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) <= f*(s) Observation: For optimal path s → n 1 → n 2 → … → g, 1.h*(g) = 0, g*(s)=0 and 2.f*(s) = f*(n 1 ) = f*(n 2 ) = f*(n 3 )… = f*(g) A* Algorithm- Properties

6 f*(n i ) = f*(s),n i ≠ s and n i ≠ g Following set of equations show the above equality: f*(n i ) = g*(n i ) + h*(n i ) f*(n i+1 ) = g*(n i+1 ) + h*(n i+1 ) g*(n i+1 ) = g*(n i ) + c(n i, n i+1 ) h*(n i+1 ) = h*(n i ) - c(n i, n i+1 ) Above equations hold since the path is optimal. A* Properties (contd.)

7 Admissibility of A* A* always terminates finding an optimal path to the goal if such a path exists. Intuition S g(n) n h(n) G (1) In the open list there always exists a node n such that f(n) <= 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

8 Lemma Any time before A* terminates there exists in the open list a node n' such that f(n') <= f*(S) S n1n1 n2n2 G Optimal path For any node n i on optimal path, f(n i ) = g(n i ) + h(n i ) <= g*(n i ) + h*(n i ) Also f*(n i ) = 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') <= h*(n') => f(n') <= f*(S)

9 If A* does not terminate Let e be the least cost of all arcs in the search graph. Then g(n) >= 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) >= 0] will become unbounded. This is not consistent with the lemma. So A* has to terminate.

10 2 nd 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 > g*(G) = g*(S) + h*(S) = f*(S) [f*(S) = cost of optimal path] This is a contradiction So path should be optimal

11 Better Heuristic Performs Better

12 Theorem A version A 2 * of A* that has a “better” heuristic than another version A 1 * of A* performs at least “as well as” A 1 * Meaning of “better” h 2 (n) > h 1 (n) for all n Meaning of “as well as” A 1 * expands at least all the nodes of A 2 * h*(n) h 2 *(n) h 1 *(n) For all nodes n, except the goal node

13 Proof by induction on the search tree of A 2 *. A* on termination carves out a tree out of G Induction on the depth k of the search tree of A 2 *. A 1 * before termination expands all the nodes of depth k in the search tree of A 2 *. k=0. True since start node S is expanded by both Suppose A 1 * terminates without expanding a node n at depth (k+1) of A 2 * search tree. Since A 1 * has seen all the parents of n seen by A 2 * g 1 (n) <= g 2 (n) (1)

14 k+1 S G Since A 1 * has terminated without expanding n, f 1 (n) >= f*(S) (2) Any node whose f value is strictly less than f*(S) has to be expanded. Since A 2 * has expanded n f 2 (n) <= f*(S) (3) From (1), (2), and (3) h 1 (n) >= h 2 (n) which is a contradiction. Therefore, A 1 * has to expand all nodes that A 2 * has expanded. Exercise If better means h 2 (n) > h 1 (n) for some n and h 2 (n) = h 1 (n) for others, then Can you prove the result ?

15 A 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

16 Evolutionary search: Genetic and Memetic Algoritms

17 Evolution – 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.

18 Evolutionary 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.

19 Evolutionary Algorithm: A meta-heuristic Let t = 0 be the generation counter; create and initialize a population P(0); repeat Evaluate the fitness, f(x i ), for all x i belonging to P(t); Perform cross-over to produce offspring; Perform mutation on offspring; Select population P(t+1) of new generation; Advance to the new generation, i.e., t = t+1; until stopping condition is true;

20 On 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.

21 Anatomy of GA

22 Selection 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(x i ) = f(x i ) /Σ f(x j )for all j Rank Based Selection – This method uses ranks instead of absolute fitness values. P(x i ) = (1/β)(1 – e r(x i ) )

23 Roulette Wheel Selection Let i = 1, where i denotes chromosome index; Calculate P(x i ) using proportional selection; sum = P(x i ); choose r ~ U (0,1); while sum < r do i = i + 1; i.e. next chromosome sum = sum + P(x i ); end return x i as one of the selected parent; repeat until all parents are selected

24 Reproduction 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.

25 Cross-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. Uniform Cross-over One point Cross-over Two point Cross-over Parent1 Parent2 00110110 11011011 00110110 11011011 00110110 11011011 Off-spring1 Off-spring2 01110111 10011010 00111011 11010110 01011010 10110111

26 Mutation 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. Random Mutation In-order Mutation Before mutation1110010011 After mutation11000101111110011010


Download ppt "CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search."

Similar presentations


Ads by Google