Introduction to Intelligent Systems

Similar documents
AI: A Modern Approach, Chpts. 3-4 Russell and Norvig

Measuring the Performance of an Agent

Informed search algorithms. Chapter 4, Sections 1 2 1

Problem solving and search

CS MidTerm Exam 4/1/2004 Name: KEY. Page Max Score Total 139

SOLVING PROBLEMS BY SEARCHING

Search methods motivation 1

Approximation Algorithms

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

SEARCHING AND KNOWLEDGE REPRESENTATION. Angel Garrido

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Binary Heaps. CSE 373 Data Structures

Classification/Decision Trees (II)

An Introduction to The A* Algorithm

Binary Heap Algorithms

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

Course Outline Department of Computing Science Faculty of Science. COMP Applied Artificial Intelligence (3,1,0) Fall 2015

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

Analysis of Algorithms, I

From Last Time: Remove (Delete) Operation

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

Full and Complete Binary Trees

Analysis of Algorithms I: Binary Search Trees

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Symbol Tables. Introduction

Binary Trees and Huffman Encoding Binary Search Trees

Sequential Data Structures

Incremental Routing Algorithms For Dynamic Transportation Networks

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

A binary heap is a complete binary tree, where each node has a higher priority than its children. This is called heap-order property

Chapter 13: Binary and Mixed-Integer Programming

A Systematic Approach to Model-Guided Empirical Search for Memory Hierarchy Optimization

Algorithms Chapter 12 Binary Search Trees

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *

Network (Tree) Topology Inference Based on Prüfer Sequence

Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees

Big Data and Scripting. Part 4: Memory Hierarchies

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Near Optimal Solutions

Algorithms and Data Structures

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Y. Xiang, Constraint Satisfaction Problems

Alok Gupta. Dmitry Zhdanov

Data Structures Fibonacci Heaps, Amortized Analysis

Curriculum Map. Discipline: Computer Science Course: C++

Social Media Mining. Graph Essentials

Decision Trees from large Databases: SLIQ

Operations: search;; min;; max;; predecessor;; successor. Time O(h) with h height of the tree (more on later).

Algorithms and Data S tructures Structures Stack, Queues, and Applications Applications Ulf Leser

6 March Array Implementation of Binary Trees

DEVELOPMENT OF A VULNERABILITY ASSESSMENT CODE FOR A PHYSICAL PROTECTION SYSTEM: SYSTEMATIC ANALYSIS OF PHYSICAL PROTECTION EFFECTIVENESS (SAPE)

Online Planning Algorithms for POMDPs

Applied Algorithm Design Lecture 5

How To Create A Tree From A Tree In Runtime (For A Tree)

Chapter 6. Decoding. Statistical Machine Translation

GRAPH THEORY LECTURE 4: TREES

GENERATING THE FIBONACCI CHAIN IN O(log n) SPACE AND O(n) TIME J. Patera

24. The Branch and Bound Method

Smart Graphics: Methoden 3 Suche, Constraints

A binary search tree is a binary tree with a special property called the BST-property, which is given as follows:

Guessing Game: NP-Complete?

ER E P M A S S I CONSTRUCTING A BINARY TREE EFFICIENTLYFROM ITS TRAVERSALS DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A

INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

Mining Social Network Graphs

Data Structure [Question Bank]

Decision Making under Uncertainty

Graph Theory Problems and Solutions

The Goldberg Rao Algorithm for the Maximum Flow Problem

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

Exam study sheet for CS2711. List of topics

Data Mining on Streams

Cpt S 223. School of EECS, WSU

CSE 326: Data Structures B-Trees and B+ Trees

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Binary Search Trees CMPSC 122

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Fairness in Routing and Load Balancing

TUM INSTITUT FÜR INFORMATIK. Matching and Evaluation of Disjunctive Predicates for Data Stream Sharing TECHNISCHE UNIVERSITÄT MÜNCHEN

1 Norms and Vector Spaces

Angelic Hierarchical Planning: Optimal and Online Algorithms (Revised)

Ordered Lists and Binary Trees

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Binary Search Trees 3/20/14

Mathematics for Algorithm and System Analysis

Class Notes CS Creating and Using a Huffman Code. Ref: Weiss, page 433

XML Data Integration

Any set with a (unique) η-representation is Σ 3, and any set with a strong η-representation is

Efficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.

Class notes Program Analysis course given by Prof. Mooly Sagiv Computer Science Department, Tel Aviv University second lecture 8/3/2007

Security-Aware Beacon Based Network Monitoring

Data Mining for Knowledge Management. Classification

Data Structures and Algorithms(5)

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

International Journal of Advanced Research in Computer Science and Software Engineering

Modeling and Solving the Capacitated Vehicle Routing Problem on Trees

THE last two decades have witnessed an exponential

COMP3420: Advanced Databases and Data Mining. Classification and prediction: Introduction and Decision Tree Induction

Data Structures and Data Manipulation

Transcription:

Problem Solving by Search Objectives Problem solving agent Tree search Uninformed search strategies: BFS, DFS, DLS, and IDS Heuristic search strategies: GBFS and A* Reference Russell & Norvig: 3 and 4.1 Goals Goals Agent s task at hand can often be specified in terms of a goal to be satisfied. A goal is a set of desirable env states (goal states). Examples of goals Goal formulation Agent formulates its goal based on the current state and its performance measure. Goals help agent organize behavior by limiting the objectives to be achieved. Y. Xiang, CIS 3700, Introduction to Intelligent Systems 1 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 2 Problem Formulation and Search Problem formulation is the process of deciding what states and actions to consider, given a goal. Ex Storage in an open-floor warehouse Ex Delivery in Reynolds building Search Agent needs to find out which sequence of actions will get it from the current state to a goal state. Search is the process of looking for such a sequence. Y. Xiang, CIS 3700, Introduction to Intelligent Systems 3 Problem Solving Agents simpleproblemsolvingagent(percept) { static actionseq=, state=initstate, goal=null, problemform=null; state = updatestate(state, percept); if actionseq =, do goal = formulategoal(state); problemform = formulateproblem(state, goal); actionseq = Search(problemForm); action = getfirst(actionseq); actionseq = getrest(actionseq); return action; } Y. Xiang, CIS 3700, Introduction to Intelligent Systems 4 1

Environmental Assumptions Assumptions on environment Observable initial state Deterministic Static Discrete Consequence Open-loop system An example No surprises Well-defined Problems in Search Problem definition Initial state Possible actions in terms of a Successor function Successor(state) maps a state to a set of (action, state ) pairs. State space: the set of states reachable from initial state Goal test Path cost (in terms of step cost) A solution is a path from initial state to a goal state. What else are contained in a solution (implicitly)? An optimal solution has the lowest path cost among all solutions. Y. Xiang, CIS 3700, Introduction to Intelligent Systems 5 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 6 Type of Problems Toy problems A concise, exact description can be given. Performance of algorithms can be easily compared. Ex Simple vacuum cleaner, 8-puzzle, etc. Real-world problems Solutions affect people s life. There is no single, precise, and agreed-upon description. Ex Unmanned vehicles, airline scheduling, medical diagnosis, etc. A potential confusion Y. Xiang, CIS 3700, Introduction to Intelligent Systems 7 Search Tree Search tree Root: The initial env state Expand: Apply Successor() to a node to generate its child nodes. Fringe: The set of all leaf nodes Relation to state space A search tree is superimposed over the state space. It may not include all states, unless fully expanded. A given state may reappear in a search tree. Search strategy: Given the current search tree, which leaf node should be expanded next? 8 2

The Idea of Tree Search treesearch(problem, strategy) { set root of search tree to initial state of problem; loop find a leaf x to expand according to strategy; if no qualified leaf is found, return failure; if x corresponds to a goal state, return the corresponding solution; else expand x; add children of x to the search tree; } Y. Xiang, CIS 3700, Introduction to Intelligent Systems 9 River-Crossing Problem A farmer, with a wolf, a sheep, and a cabbage, needs to cross a river using a boat. The boat can carry farmer plus only one other thing. Wolf and sheep cannot be left in the same bank unattended, nor can sheep and cabbage. How can farmer cross river with belongings intact? Step 1: Identify factors affecting rational behavior. Step 2: Identify initial state and goal. Step 3: Find action sequence by treesearch(). Y. Xiang, CIS 3700, Introduction to Intelligent Systems 10 Data Structure for Node on Search Tree Components in node data structure 1. Corresponding env state 2. Parent node on search tree 3. Action that generated this node from its parent 4. Depth: Length of the path from root 5. Path cost from root to the node Data structure of fringe Set Queue Y. Xiang, CIS 3700, Introduction to Intelligent Systems 11 Algorithm for Tree Search treesearch(problem, strategy) { // fringe as queue tree.makerootnode(problem.initialstate); fringe.insert(problem.initialstate); loop if ( fringe.isempty() ) return failure; node = fringe.removefirst(); if ( problem.isgoal(node.getstate()) ) return node.getsolution(); successors = node.expand(problem); tree.addleaves(successors); fringe.insert(successors, strategy); } Y. Xiang, CIS 3700, Introduction to Intelligent Systems 12 3

expand(problem) { // method in class Node successors = ; actionstatepairs = problem.successor(getstate()); for each p in actionstatepairs, do n = new Node(); n.state = p.state; n.action = p.action; n.parent = this; n.depth = this.depth + 1; n.pathcost = this.pathcost + getstepcost(p.action); successors.add(n); return successors; } 13 When Does Agent Test For Goal? Test-Before-Expansion vs Test-At-Expansion Examples of alternative approaches Algorithm comparison Difference in complexity The default Usage of phrases relative to tree nodes Visit Expansion Generation Y. Xiang, CIS 3700, Introduction to Intelligent Systems 14 Measure Problem Solving Performance 1. Completeness: A search algorithm is complete if it guarantees to find a solution when one exists. 2. Optimality: A search algorithm is optimal if it guarantees to find the optimal solution. 3. Time complexity: Time taken to find a solution Measured by max # of nodes generated 4. Space complexity: Memory needed to perform search Measured by max number of nodes stored Efficiency of solution vs efficiency of search Measure Size of Problem Why do we measure the size of a problem? Size of a search problem can be measured by the following parameters of the fully expanded search tree. Branching factor: b Max number of successors of any node Depth of the shallowest goal node: d Max length of any path: m Y. Xiang, CIS 3700, Introduction to Intelligent Systems 15 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 16 4

Search Strategies Search strategy determines the problem solving performance for a given problem. Depending on the amount of agent knowledge, search strategies can be grouped into two broad classes: Uninformed (blind) search strategies Agent has no additional information about states beyond the problem definition. Informed (heuristic) search strategies Agent has knowledge about whether one non-goal state is more promising than another. Breadth-First Search (BFS) BFS strategy Each node at a given depth is expanded before any node at the next level is expanded. Ex 8-puzzle Can be implemented with a FIFO queue for fringe in TreeSearch(). What should fringe.insert(successors, BFS) do? Y. Xiang, CIS 3700, Introduction to Intelligent Systems 17 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 18 Properties of BFS Is BFS complete? Is BFS optimal? What is its time complexity? What is the space complexity? Depth-First Search (DFS) DFS strategy Visit the deepest node in the fringe An example Can be implemented with a LIFO queue (stake) Is DFS complete? Is DFS optimal? What is the time complexity? Y. Xiang, CIS 3700, Introduction to Intelligent Systems 19 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 20 5

Space Complexity of DFS A node can be removed from memory, as soon as all its descendants have been visited. Need to store only a single path from root to a leaf, and unvisited siblings for each node on the path Space complexity How many nodes must be stored in the worst case? Y. Xiang, CIS 3700, Introduction to Intelligent Systems 21 Depth-Limited Search (DLS) Motivation: Avoid being stuck in unbounded branches DLS strategy Depth-first search with a depth limit l Nodes at depth l are treated as having no successors. Is DLS guaranteed to terminate? Space complexity Time complexity Is DLS complete? Is DLS optimal? Summery 22 Iterative Deepening Search (IDS) Motivation: Combine merits from BFS and DFS IDS strategy: Perform DLS with increasing depth limit l = 0, 1, 2,, until a goal node is found. Visiting node x: if x is a goal node, return solution; else if x.depth < l, expand x; else remove x from memory; if x is the last child, rm y=x.parent from memory; if y is the last child, rm z=y.parent from memory; Properties of IDS Is IDS complete? Is IDS optimal? What is its space complexity? What is its time complexity? An example 23 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 24 6

Avoiding Repeated States Causes of repeated states Reversible actions Multiple paths to reach a state from the initial state Tradeoff in checking and deleting repeated nodes: Save time & space for processing repeated subtrees. Need space to store all uniquely generated nodes, and time to check each newly generated node against them. Heuristic Search Strategies General approach: Best-First Search Problem-specific knowledge on the promise of a node n for leading to a goal is expressed with an evaluation function f(n). Expand the leaf with the best f(.) value Convention: The lower the f(.) value, the better. Implementation: Maintain fringe as a queue sorted in ascending order of f(.) values If f(n) is accurate, what properties does it have? Can we always find accurate f(n)? Y. Xiang, CIS 3700, Introduction to Intelligent Systems 25 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 26 Greedy Best-First Search (GBFS) Greedy Best-First Search Define a heuristic function h(n): Estimated cost of the cheapest path from node n to a goal node What should the value of h(n) be if n is a goal node? Define f(n) = h(n) Ex Routing from city A to city B with straight-line distance heuristics Y. Xiang, CIS 3700, Introduction to Intelligent Systems 27 118 75 Area Map A T 71 Z 111 O 140 L 70 M 75 D 151 S 80 R 120 146 C 99 97 138 F P A 366 B 0 C 160 D 242 E 161 F 176 G 77 H 151 101 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 28 G B 90 N Straight-line distance to B 85 87 U I 92 98 V 211 142 H I 226 L 244 M 241 N 234 O 380 P 100 R 193 S 253 T 329 U 80 V 199 Z 374 86 E 7

Evaluation of GBFS Is GBFS optimal? Is GBFS complete? Ex Routing from city I to F Time complexity GBFS behaves similarly to DFS. Space complexity Comparison with DFS Y. Xiang, CIS 3700, Introduction to Intelligent Systems 29 A* Tree Search A* Tree Search Idea: Combine the cost g(n) from root to n, with the cost estimate h(n) from n to a goal node. Define f(n) = g(n)+h(n). What is its interpretation? Ex Routing from city A to B Issue of optimality None of the blind search strategies is optimal. Admissible heuristic Heuristic function h(n) is admissible if h(n) c(n), where c(n) is the minimum path cost from n to a goal node. What is the implication to f(n)? Y. Xiang, CIS 3700, Introduction to Intelligent Systems 30 Optimality of A* Tree Search Theorem: A* is optimal, if h(n) is admissible. Proof idea: 1) C*: cost of optimal solution t : a sub-optimal goal in the current fringe 2) Claim: f(t ) > C* 3) n: a fringe node on the optimal solution path 4) Claim: f(n) C* 5) Claim: t cannot be expanded before n 6) The first goal node visited must be the optimal. Monotonicity of Heuristic Function Monotonic (consistent) heuristic A heuristic function h(n) is monotonic, if for each node n and each child n of n, the following holds: h(n) c(n,n ) + h(n ), [triangle inequality] where c(n,n ) is the step cost from n to n. Ex Is straight-line distance heuristics monotonic? Ex An non-monotonic h(n) Comparison with blind search strategies Y. Xiang, CIS 3700, Introduction to Intelligent Systems 31 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 32 8

Completeness of A* Tree Search Proposition: If h(n) is monotonic, then f(n ) f(n), where n is a child node of n. Observation: If h(n) is monotonic, then A* expands nodes at concentric contours of non-decreasing f(n) values in state space. Theorem: A* tree search is complete, if 1. h(n) is monotonic, 2. each step cost is positive, and 3. the branching factor b is finite. Complexity Time complexity For most problems of interest to AI, the number of nodes within the search space of goal contour is exponential in the length of the solution. Space complexity A* needs to store all nodes expanded. Hence, space and time complexity are the same. Y. Xiang, CIS 3700, Introduction to Intelligent Systems 33 Y. Xiang, CIS 3700, Introduction to Intelligent Systems 34 9