Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016

Similar documents
Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search

CSCI 446: Artificial Intelligence

CSEP 573 Artificial Intelligence Winter 2016

AI Adjacent Fields. This slide deck courtesy of Dan Klein at UC Berkeley

CS 221: Artificial Intelligence Fall 2011

Uninformed Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 31 Jan 2012

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search.

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. General Tree Search. Uniform Cost. Lecture 3: A* Search 9/4/2007

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem

Ma/CS 6b Class 1: Graph Recap

CSC 2114: Artificial Intelligence Search

Ma/CS 6b Class 1: Graph Recap

What are suffix trees?

Announcements. Project 0: Python Tutorial Due last night

CS201 Discussion 10 DRAWTREE + TRIES

CS 188: Artificial Intelligence Fall 2008

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

COMBINATORIAL PATTERN MATCHING

ITEC2620 Introduction to Data Structures

Lexical Analysis: Constructing a Scanner from Regular Expressions

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)

Presentation Martin Randers

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig

CS 5522: Artificial Intelligence II

Definition of Regular Expression

Regular Expression Matching with Multi-Strings and Intervals. Philip Bille Mikkel Thorup

CS481: Bioinformatics Algorithms

CS 188: Ar)ficial Intelligence

CSE 473: Ar+ficial Intelligence

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong

Dr. D.M. Akbar Hussain

Finite Automata. Lecture 4 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 21, 2015

UNIT 11. Query Optimization

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 4: Lexical Analyzers 28 Jan 08

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

COMP 423 lecture 11 Jan. 28, 2008

2 Computing all Intersections of a Set of Segments Line Segment Intersection

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012

TO REGULAR EXPRESSIONS

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming

Alignment of Long Sequences. BMI/CS Spring 2012 Colin Dewey

Minimal Memory Abstractions

Greedy Algorithm. Algorithm Fall Semester

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.

Allocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation

CS143 Handout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexical Analysis

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

CS 4100 // artificial intelligence

CSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

Deterministic. Finite Automata. And Regular Languages. Fall 2018 Costas Busch - RPI 1

10.5 Graphing Quadratic Functions

Compression Outline :Algorithms in the Real World. Lempel-Ziv Algorithms. LZ77: Sliding Window Lempel-Ziv

Slides for Data Mining by I. H. Witten and E. Frank

Section 10.4 Hyperbolas

CS 432 Fall Mike Lam, Professor a (bc)* Regular Expressions and Finite Automata

Looking up objects in Pastry

Languages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *

Topic 2: Lexing and Flexing

Applied Databases. Sebastian Maneth. Lecture 13 Online Pattern Matching on Strings. University of Edinburgh - February 29th, 2016

P(r)dr = probability of generating a random number in the interval dr near r. For this probability idea to make sense we must have

Implementing Automata. CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

Suffix trees, suffix arrays, BWT

From Dependencies to Evaluation Strategies

Fig.25: the Role of LEX

Topic: Software Model Checking via Counter-Example Guided Abstraction Refinement. Having a BLAST with SLAM. Combining Strengths. SLAM Overview SLAM

Outline. Solving Problems by Searching. Introduction. Problem-solving agents

Intermediate Information Structures

9 Graph Cutting Procedures

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos

Solving Problems by Searching

Orthogonal line segment intersection

521495A: Artificial Intelligence

Lexical Analysis. Amitabha Sanyal. ( as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay

On the Detection of Step Edges in Algorithms Based on Gradient Vector Analysis

Network Interconnection: Bridging CS 571 Fall Kenneth L. Calvert All rights reserved

Algorithm Design (5) Text Search

A Sparse Grid Representation for Dynamic Three-Dimensional Worlds

Suffix Tries. Slides adapted from the course by Ben Langmead

CS486/686 Lecture Slides (c) 2015 P.Poupart

Section 3.1: Sequences and Series

Graph Search. Chris Amato Northeastern University. Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA

From Indexing Data Structures to de Bruijn Graphs

Midterm 2 Sample solution

CSCI1950 Z Computa4onal Methods for Biology Lecture 2. Ben Raphael January 26, hhp://cs.brown.edu/courses/csci1950 z/ Outline

LR Parsing, Part 2. Constructing Parse Tables. Need to Automatically Construct LR Parse Tables: Action and GOTO Table

Theory of Computation CSE 105

CS486/686 Lecture Slides (c) 2014 P.Poupart

LECT-10, S-1 FP2P08, Javed I.

Qubit allocation for quantum circuit compilers

1.5 Extrema and the Mean Value Theorem

PPS: User Manual. Krishnendu Chatterjee, Martin Chmelik, Raghav Gupta, and Ayush Kanodia

Compilers Spring 2013 PRACTICE Midterm Exam

Stack. A list whose end points are pointed by top and bottom

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards

Graphs with at most two trees in a forest building process

Transcription:

Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence Winter 2016 1

Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl component to mny AI systems - Automted resoning, theorem proving, root nvigtion, scheduling, gme plying,... 2

Serch Prolems A serch prolem consists of stte spce successor function (ctions, cost) (N, 1.0) (E, 1.0) strt stte nd gol test A solution is sequence of ctions (pln) from the strt stte to gol stte 3

Exmple: Trveling in Romni Strt Sttes: Initil Stte: Successor Function: Gol test: Solution: End 4

Exmples of Serch Prolems Sttes: Initil Stte: Successor Function: Gol test: Solution: Sttes: Initil Stte: Successor Function: Gol test: Solution: 5

Exmples of Serch Prolems 6

Our Definition Excludes... Chnce Continuous sttes Adversries Prtil Oservility All of the ove 7

Wht is is stte spce? The world stte includes every lst detil of the environment A serch stte keeps only the detils needed for plnning (strction) Prolem: Pthing Sttes: (x,y) loction Actions: NSEW Successor: updte loction only Gol test: is (x,y)=end Prolem: Et-All-Dots Sttes: {(x,y), dot oolens} Actions: NSEW Successor: updte loction nd possily dot oolen Gol test: dots ll flse Adpted from UC Berkeley s CS188 Course 8

Representing Serch Stte spce grph - - - Vertices correspond to sttes (one vertex for ech stte) Edges correspond to successors Gol test is set of gol nodes S p d q c h e r f G We serch for solution y uilding serch tree nd trversing it to find gol stte 9

Serch Tree A serch tree: Strt stte is the root of the tree Children re successors A pln is pth in the tree. A solution is pth from the root to gol node. For most prolems we do not ctully generte the entire tree S A A S B G B B G G 10 G

Quiz Given this stte grph, how lrge is the serch tree? A S G B 11

Expnding Nodes Expnding node - Applying ll legl opertors to the stte contined in the node - Generting nodes for ll corresponding successor sttes 12

Exmple: Trveling in Romni Strt End 13

Expnding Nodes 14

Generic Serch Algorithm Initilize with initil stte of the prolem Repet - If no cndidte nodes cn e expnded return filure - Choose lef node for expnsion, ccording to serch strtegy - - If node contins gol stte, return solution Otherwise, expnd the node. Add resulting nodes to the tree 15

Implementtion Detils Need to keep trck of nodes to e expnded (fringe) Implement using queue: - Insert node for initil stte - Repet - If queue is empty, return filure - Dequeue node - If node contins gol stte, return solution - Expnd node Serch lgorithms differ in their queuing function! 16

Serch Strtegies G c d e f S h p q r 17 Adpted from UC Berkeley s CS188 Course

Serch Strtegies S d e p c e h r q h r p q f p q f q c G q c G 18

Depth-First Serch S G d p q c e h f r S d p c e p h f r q q c G q e p h f r q q c G Strtegy: Expnd deepest node first Implementtion: LIFO stck 19

Key Properties Completeness: Is the lg. gurnteed to find solution if the solution exists? Optimlity: Does the lg. find the optiml solution? Time complexity Spce complexity (size of the fringe) m tiers : rnching fctor m: mximum depth d: depth of shllowest gol node 1 node nodes 2 nodes m nodes Numer of nodes in tree? 1++ 2 + + m =O( m ) 20

DFS Properties Complete? No! m could e infinite (why?) Optiml? No! It finds leftmost solution first, regrdless of cost or depth Time complexity It could process the entire tree! Therefore O( m ) m tiers 1 node nodes 2 nodes Spce complexity Only hs silings on pth to root! Therefore O(m)! m nodes 21

Bredth-First Serch S G d p q c e h f r S d p c e p h f r q q c G q e p h f r q q c G Strtegy: Expnd shllowest node first Implementtion: FIFO queue 22

BFS Properties Complete? Yes! d must e finite is solution exists Optiml? Mye! If costs re ll 1 Time complexity It could process the tree until it finds the shllowest gol! Therefore O( d ) m tiers 1 node nodes 2 nodes m nodes Spce complexity O(d ) 23

Quiz: DFS vs BFS 24

Itertive Deepening Serch Cn we comine serch methods to tke dvntge of DFS spce complexity nd BFS completeness/ shllow solution dvntge? 25

IDS Properties Complete? Yes! d must e finite is solution exists (like BFS) Optiml? Mye! If costs re ll 1 Time complexity It could process the tree until it finds the shllowest gol! Therefore O( d ) Spce complexity O(d) m tiers 1 node nodes 2 nodes m nodes Wsteful? Most nodes found in lowest level of serch so not too d 26

Cost-Sensitive Serch 2 2 GOAL 1 8 c 3 2 3 d 2 e 9 8 2 f START 1 4 h 2 p 15 q 4 r Recll tht BFS ws only optiml under some conditions (i.e. we only cred out numer of ctions tken). Wht cn we do if ctions hve different costs? 27

Uniform Cost Serch Strtegy: Expnd chepest node first Implementtion: Priority queue 2 2 GOAL 3 1 d c 3 8 2 e 9 8 2 f 2 START 1 p 4 15 q 4 h r 2 28

UCS Properties Complete? Yes! (ssuming min cost is positive nd est solution hs finite cost) Optiml? Yes! Time complexity Processes ll nodes with cost less thn chepest solution If chepest solution cost C* nd edges cost t lest ε then depth is pproximtely C*/ε. Thus time O( C*/ ε ) Spce complexity C*/ε tiers O(C*/ ε ) 29

Summry These lgorithms re siclly the sme except for the order in which they expnd nodes Bsiclly ll priority queues with different wys to determining priorities How successful the serch is depends hevily on your model! 30

Questions? Next clss: Informed serch 31