1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further.

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
Uninformed search strategies
Artificial Intelligence Problem Solving Eriq Muhammad Adams
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Uninformed (also called blind) search algorithms) This Lecture Chapter Next Lecture Chapter (Please read lecture topic material before.
Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d + b(b d -1) = O(b d+1 ) Space? O(b d+1 ) (keeps every node.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Chapter 3 Solving Problems by Searching. 2 Outline Problem-solving agentsProblem-solving agents Problem typesProblem types Problem formulationProblem.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
Search Search plays a key role in many parts of AI. These algorithms provide the conceptual backbone of almost every approach to the systematic exploration.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
1 Lecture 3: 18/4/1435 Uninformed search strategies Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
Artificial Intelligence for Games Uninformed search Patrick Olivier
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Artificial Intelligence for Games Depth limited search Patrick Olivier
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CHAPTER 3 CMPT Blind Search 1 Search and Sequential Action.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
Searching the search space graph
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
C M M Awais (LUMS)1 SEARCH METHODS State space search Heuristic search.
Solving problems by searching
1 Lecture 3 Uninformed Search
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
Lecture 3 Uninformed Search.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
Artificial Intelligence
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Prof. Carla P. Gomes Module: Search I (Reading R&N: Chapter.
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Solving problems by searching 1. Outline Problem formulation Example problems Basic search algorithms 2.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 3 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Pengantar Kecerdasan Buatan
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Problem Solving by Searching
Implementation: General Tree Search
Solving problems by searching A I C h a p t e r 3.
WEEK 5 LECTURE -A- 23/02/2012 lec 5a CSC 102 by Asma Tabouk Introduction 1 CSC AI Basic Search Strategies.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Lecture 3: Uninformed Search
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Solving problems by searching
Solving Problems by Searching
Search Strategies CMPT 420 / CMPG 720.
Presentation transcript:

1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further classified into large birds and small birds. Small birds include sparrows, and crows. The large birds are ostriches. The mammals include whales, monkeys, and elephants. Charlie is a elephant.

2 search CS 331/531 Dr M M Awais Predicate types(Animals, Birds,Mammals) types(Birds, Largebirds, Smallbirds) Etc… Unify to answer the queries IS THERE ANY OTHER WAY?

3 search CS 331/531 Dr M M Awais Semantic Nets (Graphical Methods) Instance IS-A Animal Bird Mammal Elephant whales charlie small Large IS-A sparro w crow instance Super Class: Animal

4 search CS 331/531 Dr M M Awais Semantic Nets (Graphical Methods) Instance IS-A Animal Bird Mammal Elephant whales charlie small Large IS-A sparro w crow instance IS_A: Relation Animal: Super Bird: Class Mammal: Class

5 search CS 331/531 Dr M M Awais Semantic Nets (Graphical Methods) Instance IS-A Animal Bird Mammal Elephant whales charlie small Large IS-A sparro w crow instance Instance: defines a specific instance of a class

6 search CS 331/531 Dr M M Awais Semantic Nets (Graphical Methods) Instance IS-A Animal Bird Mammal Elephant whales charlie small Large IS-A sparro w crow instance

7 search CS 331/531 Dr M M Awais Semantic Nets (Graphical Methods) Instance IS-A Animal Bird Mammal Elephant whales charlie small Large IS-A sparro w crow instance banana s likes Can have attribute link: likes for instance, class, superclass

8 search CS 331/531 Dr M M Awais SEARCH METHODS Formulate a problem as a search Can answer queries such as: Is CHARLIE an animal?

9 search CS 331/531 Dr M M Awais Search Representation Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node

10 search CS 331/531 Dr M M Awais Search Representation Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node Level 1

11 search CS 331/531 Dr M M Awais Search Representation Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node Level 1 Level 2

12 search CS 331/531 Dr M M Awais Search Representation Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node Level 1 Level 2 Level 3

13 search CS 331/531 Dr M M Awais Answering Queries Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node Level 1 Level 2 Level 3 Is charlie an animal? Answer: Traverse the tree If charlie node present then answer is YES otherwise NO

14 search CS 331/531 Dr M M Awais Answering Queries Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Level 0: Root node Level 1 Level 2 Level 3 Is charlie an animal? Answer: Traverse the tree If charlie node present then answer is YES otherwise NO The way one traverses the tree defines SEARCH TYPES

15 search CS 331/531 Dr M M Awais SEARCH METHODS Blind Search Breadth First Depth First Iterative Deepening Heuristic search Hill Climbing Best First A* Search

16 search CS 331/531 Dr M M Awais Standard Terms Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Root node

17 search CS 331/531 Dr M M Awais Standard Terms Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Child of Animal node

18 search CS 331/531 Dr M M Awais Standard Terms Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Bird and Mammal are Siblings

19 search CS 331/531 Dr M M Awais Standard Terms Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Root node Path to a node is the list of nodes from the root to the goal node. GOAL node

20 search CS 331/531 Dr M M Awais Standard Terms Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow Root node Path to a node is the list of nodes to the goal node (bold lines). GOAL node

21 search CS 331/531 Dr M M Awais How to Traverse the Tree to find PATH? Animal Bird Mammal Elephan t whales charlie smallLarge sparro w crow

22 search CS 331/531 Dr M M Awais ANALYSIS OF SEARCH STRATEGIES Completeness: is the strategy guaranteed to find a solution where there is one? Time Complexity:How long does it take to find a solution? Space Complexity:How much memory does it need to perform the search? Optimality:Does the strategy find the highest quality solution when there are several different solutions?

23 search CS 331/531 Dr M M Awais Exhaustive Search One can systematically check every state that is reachable from initial state to end state if it is a goal state. Search Space The set of all states is the search space For simple/small search space exhaustive search is applicable [BRUTE FORCE or BLIND SEARCH] For complex search space HEURISTIC SEARCH is used

24 search CS 331/531 Dr M M Awais GRAPHS AND TREES Graphs:- Consist of a set of nodes with links between them links can be directed / undirected Path is the sequence of nodes connected nodes via links. Acyclic graphs = (Paths linking a node with itself are absent) Trees???

25 search CS 331/531 Dr M M Awais Tree:- A tree is a special kind of graph with only one path to each node, usually represented with a special root node at the top Relationship between nodes Parent Children Sibling Ancestor Node,Descendant Node,Leaf Node

26 search CS 331/531 Dr M M Awais Graphs VS Trees Compare the searches in the two (which is efficient) a b c d a b c d e f g

27 search CS 331/531 Dr M M Awais Relating State and Graph Nodes Every physical state of a problem can be represented as a node in a graph/tree The link between the nodes represent action required to change the states For a navigation problem: Link:driving action Node:cities For the Wumpus world problem: Link:movement of the agent Node:present position of the agent

28 search CS 331/531 Dr M M Awais 8 Puzzle Problem: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth

29 search CS 331/531 Dr M M Awais 8 Puzzle Problem: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth

30 search CS 331/531 Dr M M Awais Tree search algorithms Basic idea: offline, simulated exploration of state space by generating successors of already-explored states (a.k.a.~expanding states)

31 search CS 331/531 Dr M M Awais Example: Romania

32 search CS 331/531 Dr M M Awais Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest Formulate goal: be in Bucharest Formulate problem: states: various cities actions: drive between cities Find solution: sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

33 search CS 331/531 Dr M M Awais Tree search example

34 search CS 331/531 Dr M M Awais Tree search example

35 search CS 331/531 Dr M M Awais Tree search example Keep on expanding unless you reach the goal

36 search CS 331/531 Dr M M Awais Search strategies A search strategy is defined by picking the order of node expansion Strategies are evaluated along the following dimensions: completeness: does it always find a solution if one exists? time complexity: number of nodes generated space complexity: maximum number of nodes in memory optimality: does it always find a least-cost solution? Time and space complexity are measured in terms of b: maximum branching factor of the search tree d: depth of the least-cost solution m: maximum depth of the state space (may be ∞)

37 search CS 331/531 Dr M M Awais Blind Search: Strategies Breadth First (Breadth wise expansion) Depth First (Depth wise expansion) Iterative Deepening (Depth Limit)

38 search CS 331/531 Dr M M Awais Breadth-first search Expand shallowest unexpanded node Implementation: FIFO queue, i.e., new successors go at end

39 search CS 331/531 Dr M M Awais Breadth-first search

40 search CS 331/531 Dr M M Awais Breadth-first search

41 search CS 331/531 Dr M M Awais Breadth-first search

42 search CS 331/531 Dr M M Awais Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d + b(b d -1) = O(b d+1 ) Space? O(b d+1 ) (keeps every node in memory) Optimal? Yes (if cost = 1 per step) Space is the bigger problem (more than time)

43 search CS 331/531 Dr M M Awais 1.Start with queue = [initial - state] and found = FALSE 2.While queue not empty and not found do: (a)Remove the first node n from queue (b)if N is a goal state then found = TRUE (c )Find all the successor nodes of X, and put them on the end of the queue Breath First: Algorithm

44 search CS 331/531 Dr M M Awais 1.Open = [A]; closed = [] Evaluate A not goal Goal: D

45 search CS 331/531 Dr M M Awais 1.Open = [A]; closed = [] Evaluate A not goal 2.Open = [B,C];closed =[A] Evaluate B not goal Goal: D

46 search CS 331/531 Dr M M Awais 1.Open = [A]; closed = [] Evaluate A not goal 2.Open = [B,C];closed =[A] Evaluate B not goal 3.Open = [C,D,E];closed = [B,A] Evaluate C not goal Goal: D

47 search CS 331/531 Dr M M Awais 1.Open = [A]; closed = [] Evaluate A not goal 2.Open = [B,C];closed =[A] Evaluate B not goal 3.Open = [C,D,E];closed = [B,A] Evaluate C not goal 4.Open = [D,E,G,F];closed = [C,B,A] 1.Evaluate Dis goal: STOP Goal: D Path: A B D Path Cost: The cost in reaching D from A Path cost = 2 A to B=1, B to D=1 (assuming a unit cost between nodes)

48 search CS 331/531 Dr M M Awais Uniform-cost search Expand least-cost unexpanded node Implementation: queue ordered by path cost Equivalent to breadth-first if step costs all equal

49 search CS 331/531 Dr M M Awais Depth-first search Expand deepest unexpanded node Implementation: LIFO queue, i.e., put successors at front

50 search CS 331/531 Dr M M Awais Depth-first search

51 search CS 331/531 Dr M M Awais Depth-first search

52 search CS 331/531 Dr M M Awais Depth-first search

53 search CS 331/531 Dr M M Awais Depth-first search

54 search CS 331/531 Dr M M Awais Depth-first search

55 search CS 331/531 Dr M M Awais Depth-first search

56 search CS 331/531 Dr M M Awais Depth-first search

57 search CS 331/531 Dr M M Awais Depth-first search

58 search CS 331/531 Dr M M Awais Depth-first search

59 search CS 331/531 Dr M M Awais Depth-first search

60 search CS 331/531 Dr M M Awais Depth-first search

61 search CS 331/531 Dr M M Awais Properties of depth-first search Complete? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path  complete in finite spaces Time? O(b m ): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space? O(bm), i.e., linear space! Optimal? No

62 search CS 331/531 Dr M M Awais 1.Start with agenda = [initial - state] and found = FALSE 2.While agenda not empty and not found do: (a)Remove the first node N from agenda (b)if N is not in visited then (I)Add N to visited (II)if N is a goal state then found = TRUE (III)Put N’s successors on the front of the stack Depth First

63 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Goal: C

64 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate Bnot a goal Goal: C

65 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Goal: C

66 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Goal: C

67 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Open=[I,E,C];closed=[H,D,B,A] Evaluate I not a goal Goal: C

68 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Open=[I,E,C];closed=[H,D,B,A] Evaluate I not a goal Open=[E,C];closed=[I,H,D,B,A] Evaluate E not a goal Goal: C

69 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Open=[I,E,C];closed=[H,D,B,A] Evaluate I not a goal Open=[E,C];closed=[I,H,D,B,A] Evaluate E not a goal Open=[J,K,C];closed=[E,I,H,D,B,A] Evaluate J not a goal Goal: C

70 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Open=[I,E,C];closed=[H,D,B,A] Evaluate I not a goal Open=[E,C];closed=[I,H,D,B,A] Evaluate E not a goal Open=[J,K,C];closed=[E,I,H,D,B,A] Evaluate J not a goal Open=[K,C];closed=[K, E,I,H,D,B,A] Evaluate K not a goal Goal: C

71 search CS 331/531 Dr M M Awais Open=[A],closed=[] Evaluate A not a goal Open=[B,C];closed=[A] Evaluate B not a goal Open=[D,E,C];closed=[B,A] Evaluate D not a goal Open=[H,I,E,C];closed=[D,B,A] Evaluate H not a goal Open=[I,E,C];closed=[H,D,B,A] Evaluate I not a goal Open=[E,C];closed=[I,H,D,B,A] Evaluate E not a goal Open=[J,K,C];closed=[E,I,H,D,B,A] Evaluate J not a goal Open=[K,C];closed=[J,E,I,H,D,B,A] Evaluate K not a goal Open=[C];closed=[K,E,I,H,D,B,A] Evaluate C is goal: STOP Goal: C

72 search CS 331/531 Dr M M Awais Depth-limited search depth-first search with depth limit L nodes at depth L have no successors Do not apply depth first after a certain depth Iterative Deepening tries almost all depth limits Searches the tree with L=0, L=1, L=2, etc…

73 search CS 331/531 Dr M M Awais Iterative deepening search L=0 For depth 0, evaluate the root node and stop

74 search CS 331/531 Dr M M Awais Iterative deepening search L=1

75 search CS 331/531 Dr M M Awais Iterative deepening search L=1

76 search CS 331/531 Dr M M Awais Iterative deepening search L=1

77 search CS 331/531 Dr M M Awais Iterative deepening search L=2

78 search CS 331/531 Dr M M Awais Iterative deepening search L=2

79 search CS 331/531 Dr M M Awais Iterative deepening search L=3

80 search CS 331/531 Dr M M Awais Iterative deepening search Number of nodes generated in a depth-limited search to depth d with branching factor b: N DLS = b 0 + b 1 + b 2 + … + b d-2 + b d-1 + b d Number of nodes generated in an iterative deepening search to depth d with branching factor b: N IDS = (d+1)b 0 + d b 1 + (d-1)b 2 + … + 3b d-2 +2b d-1 + 1b d For b = 10, d = 5, N DLS = , , ,000 = 111,111 N IDS = , , ,000 = 123,456 Overhead = (123, ,111)/111,111 = 11%

81 search CS 331/531 Dr M M Awais Properties of iterative deepening search Complete? Yes Time? (d+1)b 0 + d b 1 + (d-1)b 2 + … + b d = O(b d ) Space? O(bd) Optimal? Yes, if step cost = 1

82 search CS 331/531 Dr M M Awais Summary of algorithms