Artificial Intelligence: Knowledge Representation

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Lecture Notes on AI-NN Chapter 5 Information Processing & Utilization.
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Course Overview What is AI? What are the Major Challenges? What are the Main Techniques? Where are we failing, and why? Step back and look at the Science.
Chapter 4: Informed Heuristic Search
Heuristics, and what to do if you dont know what to do Carl Hultquist.
Informed Search CS 171/271 (Chapter 4)
Heuristic Search Ref: Chapter 4.
Heuristic Search techniques
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
25 seconds left…...
18-Dec-14 Pruning. 2 Exponential growth How many leaves are there in a complete binary tree of depth N? This is easy to demonstrate: Count “going left”
Depth-First and Breadth-First Search CS 5010 Program Design Paradigms “Bootcamp” Lesson 9.2 TexPoint fonts used in EMF. Read the TexPoint manual before.
CS203 Lecture 15.
Introduction to Recursion and Recursive Algorithms
1 State-Space representation and Production Systems Introduction: what is State-space representation? What are the important trade-offs? (E.Rich, Chapt.2)
Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
Use “Search” for Pathfinding FactorySchool Library Hospital Park Newsagent University church Example from Alison Cawsey’s book start finish.
Problem Solving and Search in AI Part I Search and Intelligence Search is one of the most powerful approaches to problem solving in AI Search is a universal.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Using Search in Problem Solving
Graphs.
Graphs. Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
Using Search in Problem Solving
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Using Search in Problem Solving
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Othello.
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.
State-Space Searches.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
Artificial Intelligence: Planning Lecture 6 Problems with state space search Planning Operators A Simple Planning Algorithm (Game Playing)
1 Solving problems by searching This Lecture Chapters 3.1 to 3.4 Next Lecture Chapter 3.5 to 3.7 (Please read lecture topic material before and after each.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Methods for Intelligently/Efficiently Searching a Space.
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.
Graphs. 2 Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
CSCI 4310 Lecture 2: Search. Search Techniques Search is Fundamental to Many AI Techniques.
Artificial Intelligence Lecture No. 6 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 3 –Problem Solving Agents State space search –Programming Assignment Thursday.
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
Artificial Intelligence Solving problems by searching.
ARTIFICIAL INTELLIGENCE
Introduction to Artificial Intelligence
Problem Solving by Searching
Artificial Intelligence
Graphs.
Artificial Intelligence
Solving problems by searching
Graphs.
Graphs.
State-Space Searches.
ARTIFICIAL INTELLIGENCE
Graphs.
State-Space Searches.
Graphs.
State-Space Searches.
Solving problems by searching
Presentation transcript:

Artificial Intelligence: Knowledge Representation Using Search in Problem Solving Intro to Basic Search Techniques Heuristic Search

Intro: Search and AI In solving problems, we sometimes have to search through many possible ways of doing something. We may know all the possible actions our robot can do, but we have to consider various sequences to find a sequence of actions to achieve a goal. We may know all the possible moves in a chess game, but we must consider many possibilities to find a good move. Many problems can be formalized in a general way as search problems.

Search and Problem Solving Search problems described in terms of: An initial state. (e.g., initial chessboard, current positions of objects in world, current location) A target state.(e.g., winning chess position, target location) Some possible actions, that get you from one state to another. (e.g. chess move, robot action, simple change in location). Search techniques systematically consider all possible action sequences to find a path from the initial to target state.

Simple Example Easiest to first look at simple examples based on searching for route on a map. How do we systematically and exhaustively search possible routes, in order to find, say, route from library to university? School Factory Hospital Newsagent church Library Park University

Search Space The set of all possible states reachable from the initial state defines the search space. We can represent the search space as a tree. We refer to nodes connected to and “under” a node in the tree as “successor nodes”. library school hospital park newsagent factory university church

Simple Search Techniques How do we search this tree to find a possible route from library to University? May use simple systematic search techniques, which try every possibility in systematic way. Breadth first search - Try shortest paths first. Depth first search - Follow a path as far as it goes, and when reach dead end, backup and try last encountered alternative.

Breadth first search Explore nodes in tree order: library, school, hospital, factory, park, newsagent, uni, church. (conventionally explore left to right at each level) library school hospital park newsagent factory university church

Depth first search Nodes explored in order: library, school, factory, hospital, park, newsagent, university. library school hospital park newsagent factory university

Algorithms for breadth first and depth first search. Very easy to implement algorithms to do these kinds of search. Both algorithms keep track of the list of nodes found, but for which routes from them have yet to be considered. E.g., [school, hospital] -have found school and hospital in tree, but not yet considered the nodes connected to these. List is sometimes referred to as an agenda. But implemented using stack for depth first, queue for breadth first.

Algorithm for breadth first: Start with queue = [initial-state] and found=FALSE. While queue not empty and not found do: Remove the first node N from queue. If N is a goal state, then found = TRUE. Find all the successor nodes of N, and put them on the end of the queue.

Algorithm for depth first: Start with stack = [initial-state] and found=FALSE. While stack not empty and not found do: Remove the first node N from stack. If N is a goal state, then found = TRUE. Find all the successor nodes of N, and put them on the top of the stack. Note: Detailed work through of algorithms and discussion of trees/graphs in textbook.

Extensions to basic algorithm Loops: What if there are loops (ie, we are search a graph)? How do you avoid (virtually) driving round and round in circles? Algorithm should keep track of which nodes have already been explored, and avoid redoing these nodes. Returning the path: How do you get it to actually tell you what the path it has found is! One way: Make an item on the agenda be a path, rather than a node.

Problem solving as search How can we formulate more interesting problems as search? Have to think of problems in terms of initial state, target state, and primitive actions that change state. Consider: Game playing: actions are moves, which change the board state. Planning robot behaviors: actions are basic moves, like “open door”, or “put block1 on top of block2”, which change situation/state.

Robot planning problem. Consider pet robot (or not very intelligent flat-mate) in small flat with two rooms. You and your robot are in room1, your beer is in room 2, the door is closed between the rooms. Actions: move(robot, Room, AnotherRoom) open(robot, door) pickup(robot, Object). Initial state: in(robot, room1) etc.

Robot planning search tree Me Rob Beer Robot opens door Robot picks up Me Me Rob Beer Me Rob Beer Robot moves to next room Me Rob Beer Etc etc

Or.. To solve a puzzle “You are given two jugs, a 4 gallon one, and a 3 gallon one. Neither has any measuring markers on it. There is a tap that can be used to fill the jugs with water. How can you get exactly 2 gallons of water in the 4 gallon jug?” How do we represent the problem state? Can represent just as pair or numbers. {4, 1} means 4 gallons in 4 gallon jug, 1 gallon in 3 gallon jug. How do we represent the possible actions. Can give simple rules for how to get from old to new state given various actions.

Jug actions 1. Fill 4-gallon jug. {X, Y} -> {4, Y} 2. Fill 3-gallon jug. {X, Y} -> {X, 3} 3. Empty 4 gallon jug into 3 gallon jug. {X, Y} -> {0, X+Y} (but only OK if X+Y <= 3) 4. Fill the 4 gallon jug from the 3 gallon jug. {X, Y} -> {4, X+Y-4} (if X+Y > 4) etc (full set given in textbook}

Search Tree for Jugs {0, 0} Fill 3 gallon Fill 4 gallon {0, 3} {4, 0} Fill 3 gallon from 4 gallon {4, 3} {1, 3} .. And so on.

So.. To solve a moderately complex puzzle what we can do is: Express it in terms of search. Decide how “problem state” may be expressed formally. Decide how to encode primitive actions as rules for getting from one state to another. Use a standard tree/graph search algorithm/program, which uses uses a general “successor state” function which you define for your problem.

Heuristic search algorithms. Depth first and breadth first search turn out to be too inefficient for really complex problems. Instead we turn to “heuristic search” methods, which don’t search the whole search space, but focus on promising areas. Simplest is best first search. We define some “heuristic evaluation function” to say roughly how close a node is to our target. E.g., map search: heuristic might be “as the crow flies” distance based on map coordinates, Jug problem: How close to 2 gallons there are in 4 gallon jug.

Best first search algorithm Best first search algorithm almost same as depth/breadth.. But we use a priority queue, where nodes with best scores are taken off the queue first. While queue not empty and not found do: Remove the BEST node N from queue. If N is a goal state, then found = TRUE. Find all the successor nodes of N, assign them a score, and put them on the queue..

Best first search Order nodes searched: Library, hospital, park, newsagent, university. Library (6) School (5) Hospital (3) Park (1) Newsagent (2) Factory (4) University (0)

Other heuristic search methods Hill climbing: always choose successor node with highest score. A*: Score based on predicted total path “cost”, so sum of actual cost/distance from initial to current node, predicted cost/distance to target node.

Summary General search methods can be used to solve complex problems. Problems are formulated in terms of initial and target state, and the primitive actions that take you from one state to next. May need to use heuristic search for complex problems, as search space can be too large.