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

Similar documents
Uninformed Search Lecture 4

CS 188: Artificial Intelligence Spring 2007

Search: The Core of Planning

First Midterm Examination

We will see what is meant by standard form very shortly

Chapter 0. What is the Lebesgue integral about?

Reinforcement Learning

KNOWLEDGE-BASED AGENTS INFERENCE

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

USA Mathematical Talent Search Round 1 Solutions Year 21 Academic Year

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CS 188 Introduction to Artificial Intelligence Fall 2018 Note 7

Chapter 1: Fundamentals

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

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

The graphs of Rational Functions

First Midterm Examination

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

The Wave Equation I. MA 436 Kurt Bryan

New data structures to reduce data size and search time

p(t) dt + i 1 re it ireit dt =

Identify graphs of linear inequalities on a number line.

Reinforcement learning II

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

Riemann Sums and Riemann Integrals

Read section 3.3, 3.4 Announcements:

This lecture covers Chapter 8 of HMU: Properties of CFLs

Riemann Sums and Riemann Integrals

Convert the NFA into DFA

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

Bellman Optimality Equation for V*

4. GREEDY ALGORITHMS I

1.4 Nonregular Languages

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

Lesson 1: Quadratic Equations

Chapter 1 Cumulative Review

Problem Set 9. Figure 1: Diagram. This picture is a rough sketch of the 4 parabolas that give us the area that we need to find. The equations are:

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

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

Geometric Sequences. Geometric Sequence a sequence whose consecutive terms have a common ratio.

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

Improper Integrals, and Differential Equations

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

1 Module for Year 10 Secondary School Student Logarithm

19 Optimal behavior: Game theory

CS 4100 // artificial intelligence. Recap/midterm review!

CS 188: Artificial Intelligence

Chapter 5 Plan-Space Planning

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

20 MATHEMATICS POLYNOMIALS

38 Riemann sums and existence of the definite integral.

CS 188: Artificial Intelligence Fall 2010

1 Online Learning and Regret Minimization

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

1 Probability Density Functions

Line and Surface Integrals: An Intuitive Understanding

A recursive construction of efficiently decodable list-disjunct matrices

Nondeterminism and Nodeterministic Automata

CS 275 Automata and Formal Language Theory

Administrivia CSE 190: Reinforcement Learning: An Introduction

ARITHMETIC OPERATIONS. The real numbers have the following properties: a b c ab ac

Module 9: Tries and String Matching

Module 9: Tries and String Matching

Is there an easy way to find examples of such triples? Why yes! Just look at an ordinary multiplication table to find them!

GRADE 4. Division WORKSHEETS

Review of basic calculus

Where did dynamic programming come from?

MORE FUNCTION GRAPHING; OPTIMIZATION. (Last edited October 28, 2013 at 11:09pm.)

Jonathan Mugan. July 15, 2013

7.2 The Definite Integral

Lesson 2.4 Exercises, pages

The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem

PART 1 MULTIPLE CHOICE Circle the appropriate response to each of the questions below. Each question has a value of 1 point.

Math 113 Exam 2 Practice

Section 5.1 #7, 10, 16, 21, 25; Section 5.2 #8, 9, 15, 20, 27, 30; Section 5.3 #4, 6, 9, 13, 16, 28, 31; Section 5.4 #7, 18, 21, 23, 25, 29, 40

Math 4310 Solutions to homework 1 Due 9/1/16

Recitation 3: More Applications of the Derivative

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

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

Bayesian Networks: Approximate Inference

Lecture 2 : Propositions DRAFT

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Lecture 19: Continuous Least Squares Approximation

SOLUTIONS FOR ADMISSIONS TEST IN MATHEMATICS, COMPUTER SCIENCE AND JOINT SCHOOLS WEDNESDAY 5 NOVEMBER 2014

Faster Regular Expression Matching. Philip Bille Mikkel Thorup

Continuous Random Variables Class 5, Jeremy Orloff and Jonathan Bloom

Math 61CM - Solutions to homework 9

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

Chapter 4 State-Space Planning

1 APL13: Suffix Arrays: more space reduction

Concepts of Concurrent Computation Spring 2015 Lecture 9: Petri Nets

p-adic Egyptian Fractions

Good-for-Games Automata versus Deterministic Automata.

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

Section 17.2 Line Integrals

Section 3.1: Exponent Properties

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Computing the Optimal Global Alignment Value. B = n. Score of = 1 Score of = a a c g a c g a. A = n. Classical Dynamic Programming: O(n )

Student Session Topic: Particle Motion

Transcription:

DATA620006 魏忠钰 Serch I Mrch 7 th, 2018

Outline Serch Problems Uninformed Serch Depth-First Serch Bredth-First Serch Uniform-Cost Serch

Rel world tsk - Pc-mn

Serch problems A serch problem consists of: A stte spce A successor function (with ctions, costs) A strt stte A gol test

Serch Problems - Pc-mn A serch problem consists of: A stte spce A successor function (with ctions, costs) N, 1.0 A strt stte E, 1.0 A gol test Move to specific position

Rel world tsk : the 8-puzzle Strt Stte Gol Stte

Serch Problems: the 8-puzzle Stte spce Strt Stte integer loctions of 8 tiles. Successor function: Move blnk (up, down, right, left) Gol Stte

Rel Tsk: 8-Queens Puzzle Plce 8 queens on chessbord so tht no two queens ttck ech other. A queen ttcks ny piece in the sme row, column or digonl. 3 more queens missing

Serch Problem: 8-Queens Puzzle Stte spce: ny rrngement of 0 to 8 queens on bord Successor function: dd queen to ny squre Strt stte: blnk bord Gol test: 8 queens on bord, non ttcked

Rel world tsk : Trveling in Romni

Serch Problems: Trveling in Romni Stte spce Cities Successor function: Rods: Go to djcent city with cost = distnce Strt stte: Ard Gol test: Is stte == Buchrest?

Wht is in Stte Spce? The world stte includes every lst detil of the environment A serch stte keeps only the detils needed for plnning (bstrction) Problem: Pthing Sttes: (x,y) loction Actions: NSEW Successor: updte loction only Gol test: is (x,y)=end Problem: Et-All-Dots Sttes: {(x,y), dot boolens} Actions: NSEW Successor: updte loction nd possibly dot boolen Gol test: dots ll flse

Stte Spce Sizes? World stte: Bord blnks: 64 Queen number: 8 How mny World sttes? 64 8

Stte Spce Sizes? World stte: Agent positions: 120 Food count: 30 Ghost positions: 12 Agent fcing: NSEW How mny World sttes? 120x(2 30 )x(12 2 )x4 Sttes for pthing? 120 Sttes for et-ll-dots? 120x(2 30 )

Sfe Pssge Problem: et ll dots while keeping the ghosts perm-scred Wht does the stte spce hve to specify? (gent position, dot boolens, power dot boolens, remining scred time)

Stte Spce Grphs nd Serch Trees

Stte Spce Grph Stte spce grph: A mthemticl representtion of serch problem Nodes re (bstrcted) world configurtions Arcs represent successors (ction results) The gol test is set of gol nodes (mybe only one) In stte spce grph, ech stte occurs only once! We cn rrely build this full grph in memory (it s too big), but it s useful ide

Serch Trees This is now / strt N, 1.0 E, 1.0 Possible futures A serch tree: A wht if tree of plns nd their outcomes The strt stte is the root node Children correspond to successors Nodes show sttes, but correspond to PLANS tht chieve those sttes For most problems, we cn never ctully build the whole tree

Stte Spce Grphs vs. Serch Trees 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 Ech NODE in the serch tree is n entire PATH in the stte spce grph. Serch Tree Stte Spce Grph

Stte Spce Grphs vs. Serch Trees Consider this 4-stte grph: S G How big is its serch tree (from S)? b Importnt: Lots of repeted structure in the serch tree!

Tree Serch Uninformed Serch Depth-First Serch Bredth-First Serch Uniform-Cost Serch

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

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

Serch Algorithm Properties Complete: Gurnteed to find solution if one exists? Optiml: Gurnteed to find the lest cost pth? Time complexity? Spce complexity? Crtoon of serch tree: b is the brnching fctor m is the mximum depth s is the solutions t vrious depths Number of nodes in entire tree? 1 + b + b 2 +. b m = O(b m ) m b 1 node b nodes b 2 nodes b m nodes

Depth-First Serch (DFS) Properties Wht nodes DFS expnd (Time Complexity)? Some left prefix of the tree. If m is finite, tkes time O(b m ) How much spce does the fringe tke (Spce Complexity)? Only hs siblings on pth to root, so O(bm) Is it complete? No, m cn be infinite m tiers b 1 node b nodes b 2 nodes Is it optiml? No, it finds the leftmost solution, regrdless of depth or cost b m nodes

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

Bredth-First Serch (BFS) Properties Wht nodes does BFS expnd (Time Complexity)? Processes ll nodes bove shllowest solution Let depth of shllowest solution be s Serch tkes time O(b s ) How much spce does the fringe tke? Hs roughly the lst tier, so O(b s ) Is it complete? yes Is it optiml? Yes (if the cost is equl per step) s tiers b 1 node b nodes b 2 nodes b s b m

DFS vs BFS When will BFS outperform DFS? The brnch fctor is reltively smll. The depth of the optiml solution is reltively shllow. When will DFS outperform BFS? The tree is deep nd the nswer is frequent.

Itertive Deepening Ide: get DFS s spce dvntge with BFS s time / shllow-solution dvntges Run DFS with depth limit 1. If no solution Run DFS with depth limit 2. If no solution Run DFS with depth limit 3... How mny nodes does BFS expnd? O(b d ) How much spce does the fringe tke? O(bd) Is it complete? yes! Is it optiml? Yes! (if the cost is equl per step) d b

Cost-Sensitive Serch 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 2 BFS finds the shortest pth in terms of number of ctions. It does not find the lest-cost pth. We will now cover similr lgorithm which does find the lest-cost pth.

Uniform Cost Serch Strtegy: expnd chepest node first: Fringe is priority queue (priority: cumultive cost) b 3 S 1 2 1 p d 15 8 9 q 2 c h e 8 2 r G 2 f 1 S 0 d 3 e 9 p 1 Cost contours Suppose C* = 10 nd e equls 3 b 4 6 c 11 e 5 h 13 r 7 p q f 8 q 11 c G 10 h 17 r 11 p q f q c G q 16

Uniform Cost Serch (UCS) Properties Wht nodes does UCS expnd? Processes ll nodes with cost less thn chepest solution! If tht solution costs C* nd rcs cost t lest e, then the effective depth is roughly C*/e Tkes time O(b C*/e ) (exponentil in effective depth) How much spce does the fringe tke? Hs roughly the lst tier, so O(b C*/e ) Is it complete? Assuming best solution hs finite cost nd minimum rc cost is positive, yes! C*/e tiers b c 1 c 2 c 3 Is it optiml? Yes!

Uniform Cost Issues Remember: UCS 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

Comprison Algorithm Complete? Optiml? Time? Spce? DFS N N O(b m ) O(bm) BFS Y Y O(b d ) O(b d ) IDS Y Y O(b d ) O(bd) UCS Y Y O(b C*/e ) O(b C*/e ) For BFS, Suppose the brnching fctor b is finite nd step costs re identicl;

How bd is BFS?

Dt structure LIFO stck FIFO queue Priority queue

Lst in First out Stck

FIFO queue

Priority queue

The One Queue All these serch lgorithms re the sme except for fringe strtegies Conceptully, ll fringes re priority queues (i.e. collections of nodes with ttched priorities) Cn even code one implementtion tht tkes vrible queuing object