Computer Science CPSC 322 Lecture 4 Search: Intro (textbook Ch: 3.0-3.4) 1.

Slides:



Advertisements
Similar presentations
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Advertisements

Announcements Course TA: Danny Kumar
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) Sept, 11, 2013.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Department of Computer Science Undergraduate Events More
Part2 AI as Representation and Search
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) January, 28, 2008.
Slide 1 Finish Search Jim Little UBC CS 322 – Search 7 September 24, 2014 Textbook §3.6.
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.
Search: Representation and General Search Procedure Jim Little UBC CS 322 – Search 1 September 10, 2014 Textbook § 3.0 –
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 19Slide 1 Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19 (Textbook Chpt ) February, 23, 2009.
Decision Theory: Single Stage Decisions Computer Science cpsc322, Lecture 33 (Textbook Chpt 9.2) March, 30, 2009.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) January, 12, 2009.
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Computer Science cpsc322, Lecture 18 (Textbook Chpt 8) February, 12, 2010.
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) January, 25, 2010.
Search: Representation and General Search Procedure CPSC 322 – Search 1 January 12, 2011 Textbook § 3.0 –
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.
CPSC 322, Lecture 11Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Computer Science cpsc322, Lecture 11 (Textbook Chpt 4.0 – 4.2) January,
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
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?
CPSC 322, Lecture 17Slide 1 Planning: Representation and Forward Search Computer Science cpsc322, Lecture 17 (Textbook Chpt 8.1 (Skip )- 8.2) February,
CPSC 322, Lecture 17Slide 1 Planning: Representation and Forward Search Computer Science cpsc322, Lecture 17 (Textbook Chpt 8.1 (Skip )- 8.2) February,
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) March, 8, 2010.
Uninformed Search (cont.)
Solving problems by searching
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.
Solving problems by searching This Lecture Read Chapters 3.1 to 3.4 Next Lecture Read Chapter 3.5 to 3.7 (Please read lecture topic material before and.
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Computer Science CPSC 322 Lecture 3 AI Applications 1.
Uninformed Search Strategies CPSC 322 – Search 2 January 14, 2011 Textbook §3.5 1.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 26, 2010.
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.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
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.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) Sept, 12, 2012.
CPSC 322, Lecture 2Slide 1 Representational Dimensions Computer Science cpsc322, Lecture 2 (Textbook Chpt1) Sept, 7, 2012.
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
1 Solving problems by searching Chapter 3. 2 Outline Problem types Example problems Assumptions in Basic Search State Implementation Tree search Example.
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) Sep, 26, 2010.
Computer Science CPSC 322 Lecture 2 Representational Dimensions, Search Intro 1.
Constraint Satisfaction Problems (CSPs) Introduction
Computer Science cpsc322, Lecture 4
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Problem Solving by Searching
Artificial Intelligence
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 2
Problem Solving and Searching
Artificial Intelligence
Problem Solving and Searching
Computer Science cpsc322, Lecture 10
Solving problems by searching
Solving problems by searching
Presentation transcript:

Computer Science CPSC 322 Lecture 4 Search: Intro (textbook Ch: ) 1

Announcements (1) Reminder on Slide Posting I post a version of the lecture slides by 2:30pm after class (by the end of the day usually) I’ll post the version with material filled-in in class. So you’ll always have to double check the posted slides after class if you want to have the most up-to-date copy (2) Office hours are posted on the class syllabus 2

Course Overview Environment Problem Type Query Planning Deterministic Stochastic Constraint Satisfaction Search Arc Consistency Search Logics STRIPS Vars + Constraints Value Iteration Variable Elimination Belief Nets Decision Nets Markov Processes Static Sequential Representation Reasoning Technique Variable Elimination First Part of the Course 3

Course Overview Environment Problem Type Query Planning Deterministic Stochastic Constraint Satisfaction Search Arc Consistency Search Logics STRIPS Vars + Constraints Value Iteration Variable Elimination Belief Nets Decision Nets Markov Processes Static Sequential Representation Reasoning Technique Variable Elimination We’ll focus on Search 4

(Adversarial) Search: Checkers Source: IBM Research Early learning work in 1950s by Arthur Samuel at IBM Chinook program by Jonathan Schaeffer (UofA) Search explores the space of possible moves and their consequence 1994: world champion 2007: declared unbeatable 5

Slide 6 (Adversarial) Search: Chess In 1997, Gary Kasparov, the chess grandmaster and reigning world champion played against Deep Blue, a program written by researchers at IBM Source: IBM Research

Slide 7 (Adversarial) Search: Chess Deep Blue’s won 3 games, lost 2, tied 1 30 CPUs chess processors Searched nodes per sec Generated 30 billion positions per move reaching depth 14 routinely

Today’s Lecture Simple Search Agent Examples General Search Procedure (time permitting) 8

Often we are not given an algorithm to solve a problem, but only a specification of what a solution is we have to search for a solution. –Enumerate a set of potential partial solutions –Check to see if they are solutions or could lead to one Search 9

Simple Search Agent Deterministic, goal-driven agent Agent is in a start state Agent is given a goal (subset of possible states) Environment changes only when the agent acts Agent perfectly knows: actions that can be applied in any given state the state it is going to end up in when an action is applied in a given state The sequence of actions (and appropriate ordering) taking the agent from the start state to a goal state is the solution 10

Definition of a search problem Initial state(s) Set of actions (operators) available to the agent An action function that, given a state and an action, returns a new state Goal state(s) Search space: set of states that will be searched for a path from initial state to goal, given the available actions states are nodes and actions are links between them. Not necessarily given explicitly (state space might be infinite) Path Cost (we ignore this for now) 11

Today’s Lecture Simple Search Agent Examples General Search Procedure (time permitting) 12

Slide 13 Three examples 1.The delivery robot planning the route it will take in a bldg. to get from one room to another (Ch 1.6) 2.Vacuum cleaner world 3.Solving an 8-puzzle

Environment for Delivery Robot (ch.1.6) Simplified Consider only bold locations here Limits in direction of movement (e.g., can only move in the direction a door opens, can’t go back to previous location, etc.) Start: o103 Goal: r123 14

Search Space for the Delivery Robot 15

Slide 16 Example: vacuum world Possible start state Possible goal state States Two rooms: r1, r2 Each room can be either dirty or not Vacuuming agent can be in either in r1 or r2

Slide 17 Example: vacuum world States Two rooms: r1, r2 Each room can be either dirty or not Vacuuming agent can be in either in r1 or r2 Feature-based representation: -Features? -how many states? Possible start state Possible goal state

Suppose we have the same problem with k rooms. The number of states is…. D. 2 * k k A. k 3 C. k * 2 k B. k * 2k ….. 18

Cleaning Robot States – one of the eight states in the picture Actions –left, right, suck Possible Goal – no dirt 19

Search Space 20 Actions – left, right, suck - Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt

Search Space 21 Actions – left, right, suck - Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt

Search Space 22 Actions– left, right, suck - Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt

Search Space 23 Actions – left, right, suck - Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt

Search Space 24 Actions – left, right, suck - Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt

Eight Puzzle 25

Eight Puzzle States: Actions: Goal: 26

Eight Puzzle States: each state specifies which number/blank occupies each of the 9 tiles HOW MANY STATES ? Actions: blank moves left, right, up down Goal: configuration with numbers in right sequence 9! 27

Slide 28 Search space for 8puzzle

Slide 29 Search space for 8puzzle

Slide 30 How can we find a solution? How can we find a sequence of actions and their appropriate ordering that lead to the goal? Need smart ways to search the space graph

Today’s Lecture Simple Search Agent Examples General Search Procedure (time permitting) 31

Slide 32 Search: Abstract Definition How to search Start at the start state Evaluate the effect of taking different actions starting from states that have been encountered in the search so far Stop when a goal state is encountered To make this more formal, we'll use the formal definition of a graph that you reviewed for today

A directed graph consists of a set N of nodes (vertices) and a set A of ordered pairs of nodes, called edges (arcs). Node n 2 is a neighbor of n 1 if there is an arc from n 1 to n 2. That is, if  n 1, n 2   A. A path is a sequence of nodes n 0, n 1,..,n k such that  n i-1, n i   A. A cycle is a non-empty path such that the start node is the same as the end node. A directed acyclic graph (DAG) is a graph with no cycles Given a set of start nodes and goal nodes, a solution is a path from a start node to a goal node Graphs 33

Graph specification for the Delivery Robot N={mail, ts, o103, b3, o109,...} A={ 〈 ts,mail 〉, 〈 o103,ts 〉, 〈 o103,b3 〉, 〈 o103,o109 〉,...} One of several solution paths: 〈 o103, o109, o119, o123, r123 〉 34

Generic search algorithm:  given a graph, start nodes, and goal nodes, incrementally explore paths from the start nodes.  Maintain a frontier of paths from the start node that have been explored.  As search proceeds, the frontier expands into the unexplored nodes until a goal node is encountered. The way in which the frontier is expanded defines the search strategy. Graph Searching 35

Problem Solving by Graph Searching 36

Input: - a graph - a set of start nodes - Boolean procedure goal(n) testing if n is a goal node frontier:= [ : s is a start node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; For every neighbor n of n k, add to frontier; end Generic Search Algorithm 37

The forward branching factor of a node is the number of arcs going out of the node The backward branching factor of a node is the number of arcs going into the node If the forward branching factor of a node is b and the graph is a tree, how many nodes are n steps away from that node? Branching Factor ( you reviewed this for today ) 38 C. n b A. nb B. b n D. n/b

The forward branching factor of a node is the number of arcs going out of the node The backward branching factor of a node is the number of arcs going into the node If the forward branching factor of a node is b and the graph is a tree, how many nodes are n steps away from that node? Branching Factor ( you reviewed this for today ) 39 B. b n

Slide 40 Comparing Searching Algorithms: Will it find a solution? the best one? Def. : A search algorithm is complete if whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time. Def.: A search algorithm is optimal if when it finds a solution, it is the best one

Slide 41 Comparing Searching Algorithms: Complexity Def.: The time complexity of a search algorithm is the worst- case amount of time it will take to run, expressed in terms of maximum path length m maximum branching factor b. Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maximum number of nodes on the frontier), also expressed in terms of m and b. Branching factor b of a node is the number of arcs going out of the node

Slide 42 Search is a key computational mechanism in many AI agents We will study the basic principles of search on the simple deterministic search agent model Generic search approach: define a search space graph start from initial state state, incrementally explore paths from current state until goal state is reached. The way in which the frontier is expanded defines the search strategy. To Summarize

Learning Goals for today’s class Identify real world examples that make use of deterministic, goal-driven search agents Assess the size of the search space of a given search problem. Implement the generic solution to a search problem. Define completeness, optimality, time complexity and space complexity for search algorithms

TODO for Wednesday 44 Uninformed search strategies (read textbook Sec. 3.5) First Practice Exercise 3.A