Uninformed search Lirong Xia Spring, Uninformed search Lirong Xia Spring, 2017.

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
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Lirong Xia Basic search Friday, Jan 24, TA OH –Joe Johnson (mainly in charge of the project): Wed 12:30-1:30 pm, Amos Eaton 217 –Hongzhao Huang.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Using Search in Problem Solving
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
Announcements Project 0: Python Tutorial
CS 188: Artificial Intelligence Fall 2009 Lecture 2: Queue-Based Search 9/1/2009 Dan Klein – UC Berkeley Multiple slides from Stuart Russell, Andrew Moore.
CSE 473: Artificial Intelligence Spring 2014 Hanna Hajishirzi Problem Spaces and Search slides from Dan Klein, Stuart Russell, Andrew Moore, Dan Weld,
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
CSE 511a: Artificial Intelligence Spring 2012
CPS 570: Artificial Intelligence Search Instructor: Vincent Conitzer.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Advanced Artificial Intelligence Lecture 2: Search.
CS 343H: Artificial Intelligence
Solving problems by searching A I C h a p t e r 3.
AI Adjacent Fields  Philosophy:  Logic, methods of reasoning  Mind as physical system  Foundations of learning, language, rationality  Mathematics.
Warm-up We’ll often have a warm-up exercise for the 10 minutes before class starts. Here’s the first one… Write the pseudo code for breadth first search.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Search Instructors: David Suter and Qince Li Course Harbin Institute of Technology [Many slides adapted from those.
Artificial Intelligence Solving problems by searching.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Announcements Homework 1 Full assignment posted..
Announcements Homework 1 will be posted this afternoon. After today, you should be able to do Questions 1-3. Python 2.7 only for the homework; turns.
Csc 2720 Instructor: Zhuojun Duan
Introduction to Artificial Intelligence
Uninformed Search Chapter 3.4.
Problem Solving by Searching
Uninformed Search Strategies
Artificial Intelligence (CS 370D)
Search Tuomas Sandholm Read Russell & Norvig Sections
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Solving problems by searching
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
Problem Solving and Searching
EA C461 – Artificial Intelligence
Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Tree Searching.
Minimax strategies, alpha beta pruning
Uninformed search Lirong Xia. Uninformed search Lirong Xia.
Uninformed search Lirong Xia. Uninformed search Lirong Xia.
HW 1: Warmup Missionaries and Cannibals
Tree Searching.
Tree Searching.
Tree Searching.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
HW 1: Warmup Missionaries and Cannibals
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Minimax strategies, alpha beta pruning
Search Strategies CMPT 420 / CMPG 720.
CS440/ECE 448 Lecture 4: Search Intro
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

Uninformed search Lirong Xia Spring, 2017

Today’s schedule Rational agents Search problems Uninformed search State space graph: modeling the problem Search trees: scratch paper for solution Uninformed search Depth first search (DFS) algorithm Breadth first search (BFS) algorithm

Example 0: Roguelike game You entered a maze in darkness No map but you build one as you explore Limited sight, only know which direction does not have a wall know nothing about enemies, traps, etc. you only see the exit when you step on it Goal: write a walkthrough to minimize the cost of reaching the next level How would you do it?

Rational Agents An agent is an entity that perceives and acts. A rational agent selects actions that maximize its utility function. Characteristics of the percepts, environment, and action space dictate techniques for selecting rational actions. Actuators Sensors Percepts Actions Environment

Example 1: Pacman as an Agent Sensors Percepts Environment ? Actuators Actions

When goal = search for something (no cost yet)

Search Problems . . . . . . A search problem consists of: A state space A successor function (with actions, costs) A start state and a goal test A solution is a sequence of actions (a plan) which transforms the start state to a goal state . . . . (N, 1) . . (E, 1)

State space graph: modeling the problem A directed weighted graph of all states ab: b is a successor of a weight(ab): the cost of traveling from a to b Note: just for analysis, usually the state space graph is not fully built . (E, 1) Goal (S, 1) (N, 1) . . (W, 1) Start (E, 1)

What’s in a State Space? The world state specifies every last detail of the environment A search state keeps only the details needed (abstraction) Problem: Pathing States: (x,y) location Actions: NSEW Successor: adjacent locations Goal test: is (x,y) = END Problem: Eat-All-Dots States: {(x,y), dot booleans} Actions: NSEW Successor: updated location and dot booleans Goal test: dots all false

State Space Sizes? World state: Agent positions: 120 Food count: 30 Ghost positions: 12 Agent facing: NSEW How many World states? 120×230×122×4 States for pathing? 120 States for eat-all-dots? 120×230

Search Trees: scratch paper for solution A search tree: Start state at the root node Children correspond to successors Nodes contain states, correspond to PLANS to those states For most problems, we can never actually build the whole tree

Space graph vs. search tree Nodes in state space graphs are problem states: Represent an abstracted state of the world Have successors, can be goal/non-goal, have multiple predecessors Nodes in search trees are plans Represent a plan (sequence of actions) which results in the node’s state Have a problem state and one parent, a path length, a depth and a cost The same problem state may be achieved by multiple search tree nodes Problem States Search Nodes

Uninformed search Uninformed search: given a state, we only know whether it is a goal state or not Cannot say one non-goal state looks better than another non-goal state Can only traverse state space blindly in hope of somehow hitting a goal state at some point Also called blind search Blind does not imply unsystematic!

Breadth-first search (search tree)

BFS Never expand a node whose state has been visited Fringe can be maintained as a First-In-First-Out (FIFO) queue (class Queue in util.py) Maintain a set of visited states fringe := {node corresponding to initial state} loop: if fringe empty, declare failure choose and remove the top node v from fringe check if v’s state s is a goal state; if so, declare success if v’s state has been visited before, skip if not, expand v, insert resulting nodes into fringe This is the BFS you should implement in project 1

Properties of breadth-first search May expand more nodes than necessary BFS is complete: if a solution exists, one will be found BFS finds a shallowest solution Not necessarily an optimal solution if the cost is non-uniform If every node has b successors (the branching factor), shallowest solution is at depth d, then fringe size will be at least bd at some point This much space (and time) required 

Depth-first search

Properties of depth-first search Not complete (might cycle through non-goal states) If solution found, generally not optimal/shallowest If every node has b successors (the branching factor), and we search to at most depth m, fringe is at most bm Much better space requirement  Saves even more space by recursion Time: still need to check every node bm + bm-1 + … + 1 (for b>1, O(bm)) Inevitable for uninformed search methods…

If we keep a set of visited stages Never add a visited state to the fringe This version of DFS is complete (avoid cycling) Space requirement can be as bad as BFS

DFS Never expand a node whose state has been visited Fringe can be maintained as a Last-In-First-Out (LIFO) queue (class Stack in util.py) Maintain a set of visited states fringe := {node corresponding to initial state} loop: if fringe empty, declare failure choose and remove the top node v from fringe check if v’s state s is a goal state; if so, declare success if v’s state has been visited before, skip if not, expand v, insert resulting nodes into fringe This is the DFS you should implement in project 1

You can start to work on Project 1 now Read the instructions on course website and the comments in search.py first Q1: DFS LIFO Q2: BFS FIFO Due in two weeks (Feb 3) Check util.py for LIFO and FIFO implementation Use piazza for Q/A

Dodging the bullets The auto-grader is very strict 0 point for expanding more-than-needed states no partial credit Hint 1: do not include print "Start:", problem.getStartState() in your formal submission comment out all debuging commands Hint 2: remember to check if a state has been visited before Hint 3: return a path from start to goal. You should pass the local test before submission (details and instructions on project 1 website)