CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Monotonicity 13 th Jan, 2011.

Slides:



Advertisements
Similar presentations
Lecture Notes on AI-NN Chapter 5 Information Processing & Utilization.
Advertisements

Informed search algorithms
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 2 - Search.
CS344: Principles of Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 7, 8, 9: Monotonicity 16, 17 and 19 th Jan, 2012.
Informed search algorithms
An Introduction to Artificial Intelligence
Solving Problem by Searching
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture– 4, 5, 6: A* properties 9 th,10 th and 12 th January,
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 15, 16, 17- Completeness Proof; Self References and.
Review: Search problem formulation
Artificial Intelligence
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–2,3: A* 3 rd and 5 th January, 2012.
CSC344: AI for Games Lecture 4: Informed search
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Dijkstra’s Algorithm: Notes to Complement.
Rutgers CS440, Fall 2003 Heuristic search Reading: AIMA 2 nd ed., Ch
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Informed State Space Search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Informed search algorithms
CS 344 Artificial Intelligence By Prof: Pushpak Bhattacharya Class on 15/Jan/2007.
1 Shanghai Jiao Tong University Informed Search and Exploration.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
CS344: Introduction to Artificial Intelligence (associated lab: CS386)
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Heuristic Search Andrea Danyluk September 16, 2013.
CSC3203: AI for Games Informed search (1) Patrick Olivier
Artificial Intelligence Problem solving by searching.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3 - Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
Informed Search CSE 473 University of Washington.
CS621 : Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 2 - Search.
Searching for Solutions
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 13– Search 17 th August, 2010.
0 The animation which I am proposing here will be a 2D animation and can be developed in JAVA or Flash.
CS621 : Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3 - Search.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 17– Theorems in A* (admissibility, Better performance.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lectures 18, 19, 20– A* Monotonicity 2 nd, 6 th and 7 th September, 2010.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3: Search, A*
Last time: Problem-Solving
Artificial Intelligence Problem solving by searching CSC 361
CS621: Artificial Intelligence
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
Dijkstra’s Algorithm Run by hand Dijkstra's Algorithm (as stated in slide 68 at on the example.
CS 4100 Artificial Intelligence
Informed search algorithms
CS621: Artificial Intelligence
CS621: Artificial Intelligence
Artificial Intelligence Chapter 9 Heuristic Search
(1) Breadth-First Search  S Queue S
CSE 473 University of Washington
HW 1: Warmup Missionaries and Cannibals
Heuristic Search Generate and Test Hill Climbing Best First Search
HW 1: Warmup Missionaries and Cannibals
CS621 : Artificial Intelligence
CS621: Artificial Intelligence
Informed Search.
Presentation transcript:

CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Monotonicity 13 th Jan, 2011

Steps of GGS (principles of AI, Nilsson,) 1. Create a search graph G, consisting solely of the start node S; put S on a list called OPEN. 2. Create a list called CLOSED that is initially empty. 3. Loop: if OPEN is empty, exit with failure. 4. Select the first node on OPEN, remove from OPEN and put on CLOSED, call this node n. 5. if n is the goal node, exit with the solution obtained by tracing a path along the pointers from n to s in G. (ointers are established in step 7). 6. Expand node n, generating the set M of its successors that are not ancestors of n. Install these memes of M as successors of n in G.

GGS steps (contd.) 7. Establish a pointer to n from those members of M that were not already in G (i.e., not already on either OPEN or CLOSED). Add these members of M to OPEN. For each member of M that was already on OPEN or CLOSED, decide whether or not to redirect its pointer to n. For each member of M already on CLOSED, decide for each of its descendents in G whether or not to redirect its pointer. 8. Reorder the list OPEN using some strategy. 9. Go LOOP.

Illustration for CL parent pointer redirection recursively S Node in CL Node in OL Parent Pointer

Illustration for CL parent pointer redirection recursively S Stage 1 : Parent Pointer change from 2 - > 3 (Cost = 4) to 2 - > 1 (Cost = 2)

Illustration for CL parent pointer redirection recursively S Stage 2 : Parent Pointer change from 4 - > 6 (Cost = 4) to 4 - > 2 (Cost = 3)

Better Heuristic Performs Better

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

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)

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 ?

Monotonicity

Definition A heuristic h(p) is said to satisfy the monotone restriction, if for all ‘p’, h(p)<=h(p c )+cost(p, p c ), where ‘p c ’ is the child of ‘p’.

Theorem If monotone restriction (also called triangular inequality) is satisfied, then for nodes in the closed list, redirection of parent pointer is not necessary. In other words, if any node ‘n’ is chosen for expansion from the open list, then g(n)=g*(n), where g(n) is the cost of the path from the start node ‘s’ to ‘n’ at that point of the search when ‘n’ is chosen, and g*(n) is the cost of the optimal path from ‘s’ to ‘n’

Grounding the Monotone Restriction nglgl h(n) -: number of displaced tiles Is h(n) monotone ? h(n) = 8 h(n’) = 8 C(n,n’) = 1 Hence monotone n’

Monotonicity of # of Displaced Tile Heuristic h(n) < = h(n’) + c(n, n’) Any move reduces h(n) by at most 1 c = 1 Hence, h(parent) < = h(child) + 1 If the empty cell is also included in the cost, then h need not be monotone (try!)

Monotonicity of Manhattan Distance Heuristic (1/2) Manhattan distance= X-dist+Y-dist from the target position Refer to the diagram in the first slide: h mn (n) = = 10 h mn (n’) = = 11 Cost = 1 Again, h(n) < = h(n’) + c(n, n’)

Monotonicity of Manhattan Distance Heuristic (2/2) Any move can either increase the h value or decrease it by at most 1. Cost again is 1. Hence, this heuristic also satisfies Monotone Restriction If empty cell is also included in the cost then manhattan distance does not satisfy monotone restriction (try!) Apply this heuristic for Missionaries and Cannibals problem

Relationship between Monotonicity and Admissibility Observation: Monotone Restriction → Admissibility but not vice-versa Statement: If h(n i ) <= h(n j ) + c(n i, n j ) for all i, j then h(n i ) < = h*(n i ) for all i

Proof of Monotonicity  admissibility Let us consider the following as the optimal path starting with a node n = n 1 – n 2 – n 3 … n i - … n m = g l Observe that h*(n) = c(n 1, n 2 ) + c(n 2,n 3 ) + … + c(n m-1, g l ) Since the path given above is the optimal path from n to g l Now, h(n 1 ) <= h(n 2 ) + c(n 1, n 2 ) Eq 1 h(n 2 ) <= h(n 3 ) + c(n 2, n 3 ) Eq 2 :::::: h(n m-1 ) = h(g i ) + c(n m-1, g i ) Eq (m-1) Adding Eq 1 to Eq (m-1) we get h(n) <= h(g l ) + h*(n) = h*(n) Hence proved that MR → (h <= h*)

Proof (continued…) Counter example for vice-versa h*(n 1 ) = 3 h(n 1 ) = 2.5 h*(n 2 ) = 2 h(n 2 ) = 1.2 h*(n 3 ) = 1 h(n 3 ) = 0.5 :: h*(g l ) = 0 h(g l ) = 0 h < h* everywhere but MR is not satisfied n1n1 n2n2 n3n3 glgl :

Let S-N 1 - N 2 - N 3 - N 4... N m …N k be an optimal path from S to N k (all of which might or might not have been explored). Let N m be the last node on this path which is on the open list, i.e., all the ancestors from S up to N m-1 are in the closed list. For every node N p on the optimal path, g*(N p )+h(N p )<= g*(N p )+C(N p,N p+1 )+h(N p+1 ), by monotone restriction g*(N p )+h(N p )<= g*(N p+1 )+h(N p+1 ) on the optimal path g*(N m )+ h(N m )<= g*(N k )+ h(N k ) by transitivity Since all ancestors of N m in the optimal path are in the closed list, g (N m )= g*(N m ). => f(N m )= g(N m )+ h(N m )= g*(N m )+ h(N m )<= g*(N k )+ h(N k ) Proof of MR leading to optimal path for every expanded node (1/2)

Now if N k is chosen in preference to N m, f(N k ) <= f(N m ) g(N k )+ h(N k ) <= g(N m )+ h(N m ) = g*(N m )+ h(N m ) <= g*((N k )+ h(N k ) g(N k )<=g*(N k ) But g(N k )>=g*(N k ), by definition Hence g(N k )=g*(N k ) This means that if N k is chosen for expansion, the optimal path to this from S has already been found TRY proving by induction on the length of optimal path Proof of MR leading to optimal path for every expanded node (2/2)

Monotonicity of f() values Statement: f values of nodes expanded by A* increase monotonically, if h is monotone. Proof: Suppose n i and n j are expanded with temporal sequentiality, i.e., n j is expanded after n i

Proof (1/3)… n i expanded before n j n i and n j co-existing n j comes to open list as a result of expanding n i and is expanded immediately n j ’s parent pointer changes to n i and expanded n j expanded after n i

Proof (2/3)… All the previous cases are forms of the following two cases (think!) CASE 1: n j was on open list when n i was expanded Hence, f(n i ) <= f(n j ) by property of A* CASE 2: n j comes to open list due to expansion of n i

Proof (3/3)… nini njnj Case 2: f(n i ) = g(n i ) + h(n i )(Defn of f) f(n j ) = g(n j ) + h(n j )(Defn of f) f(n i ) = g(n i ) + h(n i ) = g*(n i ) + h(n i ) ---Eq 1 (since n i is picked for expansion n i is on optimal path) With the similar argument for n j we can write the following: f(n j ) = g(n j ) + h(n j ) = g*(n j ) + h(n j ) ---Eq 2 Also, h(n i ) < = h(n j ) + c(n i, n j ) ---Eq 3(Parent- child relation) g*(n j ) = g*(n i ) + c(n i, n j ) ---Eq 4(both nodes on optimal path) From Eq 1, 2, 3 and 4 f(n i ) <= f(n j ) Hence proved.

Better way to understand monotonicity of f() Let f(n 1 ), f(n 2 ), f(n 3 ), f(n 4 )… f(n k-1 ), f(n k ) be the f values of k expanded nodes. The relationship between two consecutive expansions f(n i ) and f(n i+1 ) nodes always remains the same, i.e., f(n i ) <= f(n i+1 ) This is because f(n i )= g(n i ) +h(n i ) and g(n i )=g*(n i ) since n i is an expanded node (proved theorem) and this value cannot change h(n i ) value also cannot change Hence nothing after n i+1 ’s expansion can change the above relationship.

Monotonicity of f() f(n 1 ), f(n 2 ), f(n 3 ), ……,f(n i ), f(n i+1 ), …,f(n k ) Sequence of expansion of n 1, n 2, n 3 … n i … n k f values increase monotonically f(n) = g(n) + h(n) Consider two successive expansions - > n i, n i+1 Case 1: n i & n i+1 Co-existing in OL n i precedes n i+1 By definition of A* f(n i ) <= f(n i+1 )

Monotonicity of f() Case 2: ni+1 came to OL because of expanding ni and ni+1 is expanded f(ni) = g(ni) + h(ni) <= g(ni) + c(ni, hi+1)+ h(ni+1) = g(ni) + h(ni+1) = f(ni+1) Case 3: ni+1 becomes child of ni after expanding ni and ni+1 is expanded. Same as case 2.

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