CS 188: Artificial Intelligence Spring 2007

Similar documents
Uninformed Search Lecture 4

DATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018

Search: The Core of Planning

19 Optimal behavior: Game theory

CS 188: Artificial Intelligence

Reinforcement Learning

Decision Networks. CS 188: Artificial Intelligence. Decision Networks. Decision Networks. Decision Networks and Value of Information

Reinforcement learning II

Administrivia CSE 190: Reinforcement Learning: An Introduction

CS 188 Introduction to Artificial Intelligence Fall 2018 Note 7

Bellman Optimality Equation for V*

CS 188: Artificial Intelligence Fall 2010

Decision Networks. CS 188: Artificial Intelligence Fall Example: Decision Networks. Decision Networks. Decisions as Outcome Trees

Chapter 0. What is the Lebesgue integral about?

CS 275 Automata and Formal Language Theory

1 Online Learning and Regret Minimization

Resources. Introduction: Binding. Resource Types. Resource Sharing. The type of a resource denotes its ability to perform different operations

Chapter 5 Plan-Space Planning

Where did dynamic programming come from?

Module 9: Tries and String Matching

Module 9: Tries and String Matching

Turing Machines Part One

Improper Integrals. Type I Improper Integrals How do we evaluate an integral such as

CMSC 330: Organization of Programming Languages

NFAs continued, Closure Properties of Regular Languages

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

Regular expressions, Finite Automata, transition graphs are all the same!!

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

{ } = E! & $ " k r t +k +1

KNOWLEDGE-BASED AGENTS INFERENCE

Chapter 4: Dynamic Programming

NFAs continued, Closure Properties of Regular Languages

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Pre-Session Review. Part 1: Basic Algebra; Linear Functions and Graphs

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Nondeterminism and Nodeterministic Automata

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Good-for-Games Automata versus Deterministic Automata.

The area under the graph of f and above the x-axis between a and b is denoted by. f(x) dx. π O

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

Math 113 Exam 2 Practice

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Recitation 3: More Applications of the Derivative

Lexical Analysis Finite Automate

f(x) dx, If one of these two conditions is not met, we call the integral improper. Our usual definition for the value for the definite integral

The graphs of Rational Functions

Non-Linear & Logistic Regression

We will see what is meant by standard form very shortly

Connected-components. Summary of lecture 9. Algorithms and Data Structures Disjoint sets. Example: connected components in graphs

Math 1B, lecture 4: Error bounds for numerical methods

Riemann is the Mann! (But Lebesgue may besgue to differ.)

Module 6 Value Iteration. CS 886 Sequential Decision Making and Reinforcement Learning University of Waterloo

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Solution for Assignment 1 : Intro to Probability and Statistics, PAC learning

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

Review of Gaussian Quadrature method

Balanced binary search trees

Convert the NFA into DFA

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

1.4 Nonregular Languages

Learning Moore Machines from Input-Output Traces

( dg. ) 2 dt. + dt. dt j + dh. + dt. r(t) dt. Comparing this equation with the one listed above for the length of see that

Lesson 1: Quadratic Equations

First Midterm Examination

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Concepts of Concurrent Computation Spring 2015 Lecture 9: Petri Nets

How can we approximate the area of a region in the plane? What is an interpretation of the area under the graph of a velocity function?

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Genetic Programming. Outline. Evolutionary Strategies. Evolutionary strategies Genetic programming Summary

CS 275 Automata and Formal Language Theory

This lecture covers Chapter 8 of HMU: Properties of CFLs

p-adic Egyptian Fractions

LECTURE NOTE #12 PROF. ALAN YUILLE

Formal Methods in Software Engineering

Best Approximation. Chapter The General Case

4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve

Lexical Analysis Part III

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

On Determinisation of History-Deterministic Automata.

Chapter 1: Fundamentals

Lecture 17. Integration: Gauss Quadrature. David Semeraro. University of Illinois at Urbana-Champaign. March 20, 2014

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

Read section 3.3, 3.4 Announcements:

Arithmetic & Algebra. NCTM National Conference, 2017

First Midterm Examination

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Interpreting Integrals and the Fundamental Theorem

Math& 152 Section Integration by Parts

Before we can begin Ch. 3 on Radicals, we need to be familiar with perfect squares, cubes, etc. Try and do as many as you can without a calculator!!!

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Bayesian Networks: Approximate Inference

UNIT 1 FUNCTIONS AND THEIR INVERSES Lesson 1.4: Logarithmic Functions as Inverses Instruction

4. GREEDY ALGORITHMS I

Lecture 6 Regular Grammars

Transcription:

CS 188: Artificil Intelligence Spring 2007 Lecture 3: Queue-Bsed Serch 1/23/2007 Srini Nrynn UC Berkeley Mny slides over the course dpted from Dn Klein, Sturt Russell or Andrew Moore

Announcements Assignment 1 due 1/30 11:59 PM You cn do most of it fter tody Sections strt this week Sty tuned for Python Lb

Summry Agents interct with environments through ctutors nd sensors The gent function describes wht the gent does in ll circumstnces The gent progrm clcultes the gent function The performnce mesure evlutes the environment sequence A perfectly rtionl gent mximizes expected performnce PEAS descriptions define tsk environments Environments re ctegorized long severl dimensions: Observble? Deterministic? Episodic? Sttic? Discrete? Singlegent? Problem-solving gents mke pln, then execute it Stte spce encodings of problems

Problem-Solving Agents This is the hrd prt! This offline problem solving! Solution is executed eyes closed.

Tree Serch Bsic solution method for grph problems Offline simulted explortion of stte spce Serching model of the spce, not the rel world

A Serch Tree Serch: Expnd out possible plns Mintin fringe of unexpnded plns Try to expnd s few tree nodes s possible

Tree Serch

Generl Tree Serch Importnt ides: Fringe Expnsion Explortion strtegy Min question: which fringe nodes to explore?

Serch Nodes vs. Sttes 8 2 3 4 7 5 1 6 8 2 7 3 4 5 1 6 8 2 3 4 7 5 1 6 8 2 3 4 7 5 1 6 8 4 2 3 7 5 1 6 8 2 3 4 7 5 1 6

Serch Nodes vs. Sttes 8 2 3 4 7 5 1 6 8 2 7 3 4 5 1 6 If sttes re llowed to be revisited, the serch tree my be infinite even when the stte spce is finite 8 2 3 4 7 5 1 6 8 2 3 4 7 5 1 6 8 4 2 3 7 5 1 6 8 2 3 4 7 5 1 6

Sttes vs. Nodes Problem grphs hve problem sttes Hve successors Serch trees hve serch nodes Hve prents, children, depth, pth cost, etc. Expnd uses successor function to crete new serch tree nodes The sme problem stte my be in multiple serch tree nodes

Uninformed serch strtegies (.k.. blind serch) = use only informtion vilble in problem definition. When strtegies cn determine whether one nongol stte is better thn nother informed serch. Ctegories defined by expnsion lgorithm: Bredth-first serch Depth-first serch (Depth-limited serch) Itertive deepening serch Uniform-cost serch Bidirectionl serch

Stte Spce Grphs There s some big grph in which Ech stte is node Ech successor is n outgoing rc Importnt: For most problems we could never ctully build this grph S b p d q c h e r f G How mny sttes in 8- puzzle? Lughbly tiny serch grph for tiny serch problem

Exmple: Romni

Exmple: Tree Serch b c G S d h e f p q r

Stte Grphs vs Serch Trees S b d c h e f G Ech NODE in in the serch tree is n entire PATH in the problem grph. p q r S d e p We lmost lwys construct both on demnd nd we construct s little s possible. b c p h e q r f h r p q f q c G q q c G

Review: Depth First Serch S b d p c e p h f r q q c G q e p h f r q q c G S G d b p q c e h f r q p h f d b c e r Strtegy: expnd deepest node first Implementtion: Fringe is LIFO stck

Review: Bredth First Serch Strtegy: expnd shllowest node first Implementtion: Fringe is FIFO queue S b p d q c h e r f G S Serch Tiers b d c h e r p h q e r f p q p q f q c G q c G

Serch Algorithm Properties Complete? Gurnteed to find solution if one exists? Optiml? Gurnteed to find the lest cost pth? Time complexity? Spce complexity? Vribles: n b C* s m Number of sttes in the problem The verge brnching fctor B (the verge number of successors) Cost of lest cost solution Depth of the shllowest solution Mx depth of the serch tree

DFS Algorithm DFS Depth First Serch Complete Optiml Time Spce N O(B LMAX ) O(LMAX) N N N Infinite Infinite b START GOAL Infinite pths mke DFS incomplete How cn we fix this?

DFS With cycle checking, DFS is complete. m tiers b 1 node b nodes b 2 nodes b m nodes Algorithm DFS w/ Pth Checking Complete Optiml Time Spce Y N O(b m ) O(bm) When is DFS optiml?

BFS Algorithm DFS BFS w/ Pth Checking Complete Optiml Time Spce Y N O(b m ) O(bm) Y N* O(b s+1 ) O(b s+1 ) s tiers b 1 node b nodes b 2 nodes b s nodes b m nodes When is BFS optiml?

Comprisons When will BFS outperform DFS? When will DFS outperform BFS?

Costs on Actions b 2 3 1 d 2 c 3 8 2 e 9 8 2 GOAL 2 f START 1 p 4 15 q 4 h r 1 Notice tht BFS finds the shortest pth in terms of number of trnsitions. It does not find the lest-cost pth. We will quickly cover n lgorithm which does find the lest-cost pth.

Uniform Cost Serch Expnd chepest node first: Fringe is priority queue 2 b 1 3 S 1 p d 15 8 9 q 2 c h e 8 1 r G 2 f 1 S 0 d 3 e 9 p 1 Cost contours b 4 6 c 11 h p e 13 q 5 r f 7 8 h p 17 r 11 q f q c G q 16 q 11 c G 10

Priority Queue Refresher A priority queue is dt structure in which you cn insert nd retrieve (key, vlue) pirs with the following opertions: pq.push(key, vlue) pq.pop() inserts (key, vlue) into the queue. returns the key with the lowest vlue, nd removes it from the queue. You cn promote or demote keys by resetting their priorities Unlike regulr queue, insertions into priority queue re not constnt time, usully O(log n) We ll need priority queues for most cost-sensitive serch methods.

Uniform Cost Serch Wht will UCS do for this grph? 0 b START 1 0 1 GOAL Wht does this men for completeness?

Uniform Cost Serch Algorithm DFS BFS UCS w/ Pth Checking Complete Optiml Time Spce Y N O(b m ) O(bm) Y N O(b s+1 ) O(b s+1 ) Y* Y O(b C*/ε ) O(b C*/ε ) C*/ε tiers b We ll tlk more bout uniform cost serch s filure cses lter

Uniform Cost Problems Remember: explores incresing cost contours The good: UCS is complete nd optiml! c 1 c 2 c 3 The bd: Explores options in every direction No informtion bout gol loction Strt Gol

Depth-limited serch depth-first serch with depth limit l, i.e., nodes t depth l hve no successors Recursive implementtion:

Itertive deepening serch

Itertive deepening serch l =0

Itertive deepening serch l =1

Itertive deepening serch l =2

Itertive deepening serch l =3

Itertive deepening serch Number of nodes generted in depth-limited serch to depth d with brnching fctor b: N DLS = b 0 + b 1 + b 2 + + b d-2 + b d-1 + b d Number of nodes generted in n itertive deepening serch to depth d with brnching fctor 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 = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111 N IDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456 Overhed = (123,456-111,111)/111,111 = 11%

Itertive Deepening Itertive deepening uses DFS s subroutine: 1. Do DFS which only serches for pths of length 1 or less. (DFS gives up on ny pth of length 2) 2. If 1 filed, do DFS which only serches pths of length 2 or less. 3. If 2 filed, do DFS which only serches pths of length 3 or less..nd so on. b Algorithm DFS BFS ID w/ Pth Checking Complete Optiml Time Spce Y N O(b m ) O(bm) Y N* O(b s+1 ) O(b s+1 ) Y N* O(b d ) O(bd)

Summry of lgorithms

Extr Work? Filure to detect repeted sttes cn cuse exponentilly more work. Why?

Grph Serch In BFS, for exmple, we shouldn t bother expnding the circled nodes (why?) S d e p b c e h r q h r p q f p q f q c G q c G

Grph Serch Very simple fix: never expnd node twice Cn this wreck correctness? Why or why not?

Serch Gone Wrong?