Artificial Intelligence Lecture Notes PDF
Document Details
Uploaded by ElatedHeliodor5690
October 6 University
Prof. Shereen Aly Taie
Tags
Summary
These lecture notes provide an introduction to Artificial Intelligence, focusing on search algorithms. The material covers various search strategies, including breadth-first search, depth-first search, and depth-limited search. Examples and diagrams illustrate the concepts.
Full Transcript
Instructor Prof. Shereen Aly Taie 1 states? operators? goal test? path cost? states? locations of tiles operators? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move states? operators? goal test? path cost? ...
Instructor Prof. Shereen Aly Taie 1 states? operators? goal test? path cost? states? locations of tiles operators? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move states? operators? goal test? path cost? states? 2 integers to represent amount of dirt in each room and one value to represent robot location operators? Left, Right, Suck goal test? no dirt at all locations path cost? 1 per action Given a problem representation, search is the process that builds some or all of the search tree for the representation in order to do one of the following: – If the search tree has one or more goals, identify one (or all of them) and the sequence of operators that produce each. – If the search tree has one or more goals, identify a least costly one and the sequence of operators that produces it. – If the search tree is finite and does not contain a goal, recognise this. 7 Breadth-first search Depth-first search Iterative deepening search Bidirectional search Uniform-cost search Also known as blind search Greedy search A* search IDA* search Hill climbing Simulated annealing Also known as heuristic search ◦ require heuristic function Blind Searches Simply searches the State Space Can only distinguish between a goal state and a non-goal state Sometimes called an uninformed search as it has no knowledge about its domain Blind Searches have no preference as to which state (node) that is expanded next The different types of blind searches are characterised by the order in which they expand the nodes. Expand Root Node First Expand all nodes at level 1 before expanding level 2 OR Expand all nodes at level d before expanding nodes at level d+1 14 15 Expand Node list node {A} A BCD B EF D GHI I JK K LM 16 17 Search Tiers S d e p b c e h r q a a h r p q f p q f q c G q c G a [demo: bfs] a Branching rate ◦ Average number of edges coming from a node (3 above) Uniform Search ◦ Every node has same number of branches (as above) a G b c Strategy: expand e a shallowest d f S h node first p q r Implementation: Fringe is a FIFO queue S d e p Search b c e h r q Tiers a a h r p q f p q f q c G q c G a a Given the following state space (tree search), give the sequence of visited nodes when using BFS (assume that the node O is the goal state): A B C D E F G H I J K L M N O 23 A, A B C D E 24 A, B, A B C D E F G 25 A, B,C A B C D E F G H 26 A, B,C,D A B C D E F G H I J 27 A, B,C,D,E A B C D E F G H I J 28 A, B,C,D,E, F, A B C D E F G H I J 29 A, B,C,D,E, F,G A B C D E F G H I J K L 30 A, B,C,D,E, F,G,H A B C D E F G H I J K L 31 A, B,C,D,E, F,G,H,I A B C D E F G H I J K L M 32 A, B,C,D,E, F,G,H,I,J, A B C D E F G H I J K L M N 33 A, B,C,D,E, F,G,H,I,J, K, A B C D E F G H I J K L M N 34 A, B,C,D,E, F,G,H,I,J, K,L A B C D E F G H I J K L M N O 35 A, B,C,D,E, F,G,H,I,J, K,L, M, A B C D E F G H I J K L M N O 36 A, B,C,D,E, F,G,H,I,J, K,L, M,N, A B C D E F G H I J K L M N O 37 A, B,C,D,E, F,G,H,I,J, K,L, M,N, A Goal state: O B C D E F G H I J K L M N O 38 The returned solution is the sequence of operators in the path: A, B, G, L, O A B C D E F G H I J K L M N O 39 The example node set Initial state A B C D E F Goal state G H I J K L M N O P Q R S T U V W X Y Z Press space to see a BFS of the example node set A B C D E F G H I J K L M N O P Q R S T U BREADTH-FIRST SEARCH PATTERN Observations ◦ Very systematic ◦ If there is a solution breadth first search is guaranteed to find it ◦ If there are several solutions then breadth first search will always find the shallowest goal state first and if the cost of a solution is a non- decreasing function of the depth then it will always find the cheapest solution 43 a G b c Strategy: e expand a d f deepest node S h first p r q Implementation : Fringe is a LIFO S stack d e p b c e h r q a a h r p q f p q f q c G q c G a a If DFS goes down a infinite branch it will not terminate if it does not find a goal state. If it does find a solution there may be a better solution at a lower level in the tree. Therefore, depth first search is neither complete nor optimal. DFS may never terminate as it could follow a path that has no solution on it DLS solves this by imposing a depth limit, at which point the search terminates that particular branch Can be implemented by the general search algorithm using operators which keep track of the depth Choice of depth parameter is important ◦ Too deep is wasteful of time and space ◦ Too shallow and we may never reach a goal state Suppose branching rate b Breadth-first ◦ Complete (guaranteed to find solution) ◦ Requires a lot of memory At depth d needs to remember up to bd-1 states Depth-first ◦ Not complete because of indefinite paths or depth limit ◦ But is memory efficient Only needs to remember up to b*d states