Search. Announcements. Clarifications from Last Time. Recap of Last Time. Goal-Based Agents. Goal-Based Agents

Similar documents
Measuring the Performance of an Agent

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

Problem solving and search

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

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

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

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

Algorithms and Data Structures

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

14.1 Rent-or-buy problem

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

Search methods motivation 1

CMPSCI611: Approximating MAX-CUT Lecture 20

Load Balancing. Load Balancing 1 / 24

Analysis of Algorithms, I

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

The 2010 British Informatics Olympiad

Binary Search Trees CMPSC 122

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

Decision Making under Uncertainty

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

6.852: Distributed Algorithms Fall, Class 2

Approximation Algorithms

each college c i C has a capacity q i - the maximum number of students it will admit

PLANET: Massively Parallel Learning of Tree Ensembles with MapReduce. Authors: B. Panda, J. S. Herbach, S. Basu, R. J. Bayardo.

Analysis of a Search Algorithm

Static Load Balancing

Abstract Data Type. EECS 281: Data Structures and Algorithms. The Foundation: Data Structures and Abstract Data Types

Binary Heap Algorithms

Social Media Mining. Graph Essentials

CSE373: Data Structures and Algorithms Lecture 1: Introduction; ADTs; Stacks/Queues. Linda Shapiro Spring 2016

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Data Structures. Chapter 8

Big O and Limits Abstract Data Types Data Structure Grand Tour.

3 Abstract Data Types and Search

Data Structures. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

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

Mining Social Network Graphs

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

Sequential Data Structures

Greatest Common Factor and Least Common Multiple

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

Chapter 2: Intelligent Agents

Coin Flip Questions. Suppose you flip a coin five times and write down the sequence of results, like HHHHH or HTTHT.

Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q...

Data Structures and Algorithms(5)

Final Exam. Route Computation: One reason why link state routing is preferable to distance vector style routing.

Introduction to Data Structures and Algorithms

International Journal of Software and Web Sciences (IJSWS)

Lecture 2 CS An example of a middleware service: DNS Domain Name System

(Refer Slide Time: 2:03)

The Basics of Graphical Models

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

Informed search algorithms. Chapter 4, Sections 1 2 1

International Journal of Advanced Research in Computer Science and Software Engineering

C H A P T E R Regular Expressions regular expression

Lecture 8: Routing I Distance-vector Algorithms. CSE 123: Computer Networks Stefan Savage

Agents: Rationality (2)

Optimizations. Optimization Safety. Optimization Safety. Control Flow Graphs. Code transformations to improve program

Datagram-based network layer: forwarding; routing. Additional function of VCbased network layer: call setup.

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Cpt S 223. School of EECS, WSU

10CS35: Data Structures Using C

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

Data Structure with C

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,

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

Chapter 7: Termination Detection

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

Introduction to Data Structures

Graph Theory Problems and Solutions

Level 2 Routing: LAN Bridges and Switches

Today s topic: So far, we have talked about. Question. Task models

Network Flow I. Lecture Overview The Network Flow Problem

Data Structure [Question Bank]

Exam study sheet for CS2711. List of topics

Dynamic Programming Problem Set Partial Solution CMPSC 465

Scheduling Shop Scheduling. Tim Nieberg

Smart Graphics: Methoden 3 Suche, Constraints

6.02 Practice Problems: Routing

Ordered Lists and Binary Trees

Part 2: Community Detection

OPERATING SYSTEMS DEADLOCKS

Data Structures Using C++

Output: struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;

Y. Xiang, Constraint Satisfaction Problems

Lecture 17 : Equivalence and Order Relations DRAFT


Full and Complete Binary Trees

Common Data Structures

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, Chapter 7: Digraphs

Data Structures and Algorithms Written Examination

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

Enumerating possible Sudoku grids

Chapter 13: Binary and Mixed-Integer Programming

MAC Sublayer. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross

2.2 Derivative as a Function

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

Transcription:

Burr H. Settles CS-540, UW-adison www.cs.wisc.edu/~cs540-1 Summer 23 Announcements Homework #1 is out today (6/18) and will be due next Friday (6/27) Please hand in Homework #0 (the info card/sheet about you) as soon as you can Read Chapter 4 in AI: A odern Approach for next time 1 2 Clarifications from Last Time Recap of Last Time We talked about the features of agents (situatedness, autonomy, etc.) and of environments (discrete/continuous, deterministic/stochastic, etc.) These are formalisms that we use to help in modeling a problem: We as the programmers get to draw these lines! Can be sometimes arbitrary Generally used at a single level of abstraction The different types of agent programs: Lookup table Simple reflex agent odel-based reflex agent Goal-based agent Utility-based agent } Let s talk about these 3 4 We are interested in how we can design goal-based agents to solve problems There are three major questions to consider: What goal does the agent need to achieve? What knowledge does the agent need? What actions does the agent need to do? What goal does the agent need to achieve? How do you describe the goal? A situation to be reached The answer to a question A set of properties to be acquired How do you know when the goal is reached? With a goal test that defines what it means to have achieved/satisfied the goal 5 6 1

What knowledge does the agent need? The information needs to be: Sufficient to describe everything relevant to reaching the goal Adequate to describe the world state/situation We ll use a closed world assumption: All necessary information about a problem domain is observable in each percept so that each state is a complete description of the world i.e. There is never any hidden information What actions does the agent need to do? Given: An set of available actions A description of the current state of the world Determine: Which actions can be applied (those applicable/legal?) What the exact state of the world will be (or likely be) after an action is performed in the current state history information needed to compute the new world state What is the action is likely to lead me to my goal? 7 8 otivation Case Study: Die Hard III We want to design a goal-based agent to solve a puzzle called the water jug problem What better motivation is there than to keep from being blown up!?!?! 9 Imagine you are given two containers: a 3-gallon water jug, and a 4-gallon jug Initially both jugs are empty You have 3 actions available to you: Fill a jug completely Dump a jug completely Pour as much water as possible from one of the jugs into the other You must end up with a jug having exactly 2 gallons of water in order to disarm the bomb!! How Can a achine Do This? Formalizing a We want our agent to search for a sequence of actions that lead to a solution To do this we formalize the problem as a search task, considering our three questions: What goal does the agent need to achieve? What knowledge does the agent need? What actions does the agent need to do? 11 : specific description of the world Combination of jug volumes space: set of all possible states in our problem environment 4 5 = 20 water jug states node: data structure where the state information is stored for the search tree: directed graph G = (V,E) V is a set of nodes (states) E is a set of edges (actions turning one state to another) 12 2

Formalizing a Formalizing a Initial state: designated start state 2 empty jugs Successor states: collection of states generated by applying actions to a particular state Goal state: state which satisfies to the object of our search task One jug with 2 gallons Goal test: way of deciding a goal state list: list of states which are waiting to be considered in the search list: list of states which have already been considered in the search : path from the initial state to a goal 13 Water Jug Setup Water Jug Algorithm : ordered pair AB A is the 3 gallon jug; B is the 4 gallon jug space: our possible states Edges: generated by our six possible actions:, dump(a), pour(a,b), dump(b), Initial state: the state Goal state: any state n2 or 2n Where n can be any number OPEN = { } // states we're considering CLOSED = { } // states we've already seen while OPEN is not empty { X = state removed from OPEN if X is (n2) or (2n) then return solution else { add X to CLOSED generate successor states via actions on X ignore successors already in OPEN or CLOSED add successors to OPEN } } return FAILURE // no solution found 15 16 Water Jug Tree The List 04 dump(a) pour(a,b) 04, 04 04,,,,,,,,, 04,, 04, In this example, we used a FIFO scheme (or a queue) to track states in our open list. This is called a breadth-first search (BFS),,,, Goal!!,, 04,,,, 04,,,,, 04,,,,,, 04,,,,, There are several other ways to manage states in the open list we call each method a different search strategy 17 If we use a LIFO scheme (a stack), we perform what is called depth-first search (DFS) 18 3

Water Jug with DFS Water Jug Comparison 04 dump(a) 04, 04 dump(a) 04 dump(a) 04,,,,,,, 04, 04,, 04,, pour(a,b),,,,, 04,,,, 04,,,, Goal!! Breadth-First Depth-First 19 20 A te on Finding s Responsible Children In this problem, our solution is a sequence of actions, or path from the initial state to a goal state 04 dump(a) 04 dump(a) pour(a,b) nodes are irresponsible, because they don t keep track of their children! In practice, we make each node remember its parent instead, then backtrack from the goal to the initial state Breadth-First Depth-First 21 22 Utility-Based Agents ing with Costs Recall that utility-based agents are goalbased agents that can determine which solutions are best What solution is best in the water jug problem example? For the water jug problem, the costs to fill, dump, or pour a jug are all the same Uniform-cost search (UCS) is a strategy we use if there are costs associated with actions (edges), and we want the least expensive solution to a goal What if actions have costs? We use a priority queue for the open list, where states are ranked by the total cost of the path from the initial state 23 4

Example with Costs BFS Suppose we want to travel by train to the Armadillo Convention in El Paso, and we want to find the least expensive series of tickets from adison Cities are our states, and tickets are actions. Let s try comparing BFS, DFS, and UCS strategies adison Kansas $18 St. Louis $27 City $21 El Paso $ Rouge DSN D SNP S NPKH N PKHB P KHBE K HBE H BE B E E Goal!! Total Cost: $96 D DS DSN DSNP adison DSNPK Kansas $18 St. Louis DSNPKH $27 City DSNPKHB $21 El Paso $ Rouge 25 26 DFS UCS NSD adison :0 S:15, D:48, N:48 adison N B H E BSD HSD ESD Goal!! N NB DBH S K D N K:, D:48, N:48, H:51 D:48, N:48, H:51, P:75 N:48, H:51, P:75 H:51, B:64, P:75 S SK SKD SKDN Total Cost: $90 $27 $21 Kansas City $18 St. Louis El Paso $ Rouge H E:63, B:64, P:75 E Goal!! Total Cost: $63 SKDNH $27 $21 Kansas City $18 St. Louis El Paso $ Rouge 27 28 Other Strategies Other Strategies Depth-limited search (DLS) If memory space is a major concern, one can conduct a simple DFS with a fixed depth limit l Iterative deepening search (IDS) Conduct a depth-limited search at increasing depth limits until a solution is found Bi-directional search (BDS) If we want to find a particular goal node, we can search from both ends of the search space Conducts a BFS from both the start and goal states until they meet somewhere in the middle 29 5

Evaluating Strategies Evaluating Strategies Completeness If a solution exists, will it be found? A complete algorithm will find a solution Optimality If a solution is found, is it guaranteed to be the best one? (remember utility-based agents) An optimal algorithm will find a solution with the minimum cost Time Complexity How long does it take to find a solution? easured for worst or average case easured in number of states expanded/tested (i.e. the size of the closed list) Space Complexity How much space is used by the algorithm? easured in terms of the states generated (i.e. the size of the open + closed lists) Evaluating Strategies Uninformed Strategy Complete? Optimal? Time Complexity Space Complexity O(b m ) O(bm) Uniformcost Breadthfirst (if all costs are equal) Depthlimited Bi-directional O(b l ) O(bl) Iterative deepening (if all costs are equal) O(bd) Depthfirst (if all costs are equal) O(b d/2 ) O(b d/2 ) b is the branching factor of the problem, d is the depth of the shallowest solution, m is the maximum depth of the search tree, and l is the depth limit All the strategies discussed so far are called uninformed search strategies because there is no information provided other than the problem definition Next we ll discuss informed or heuristic search strategies that try to speed things up by using domain knowledge to guide the search 6