22c:145 Artificial Intelligence

Similar documents
CS:4420 Artificial Intelligence

Problem solving and search. Chapter 3. Chapter 3 1

Artificial Intelligence Methods. Problem solving by searching

Deterministic Planning and State-space Search. Erez Karpas

State Space Representa,ons and Search Algorithms

Tree/Graph Search. q IDDFS-? B C. Search CSL452 - ARTIFICIAL INTELLIGENCE 2

AI Programming CS S-06 Heuristic Search

Local search algorithms. Chapter 4, Sections 3 4 1

Artificial Intelligence

Solving Problems By Searching

Game Engineering CS F-12 Artificial Intelligence

Planning and search. Lecture 6: Search with non-determinism and partial observability

Last time: Summary. Last time: Summary

Searching in non-deterministic, partially observable and unknown environments

Searching in non-deterministic, partially observable and unknown environments

22c:145 Artificial Intelligence

Artificial Intelligence (Künstliche Intelligenz 1) Part II: Problem Solving

Iterative improvement algorithms. Beyond Classical Search. Outline. Example: Traveling Salesperson Problem

Problem-Solving via Search Lecture 3

IS-ZC444: ARTIFICIAL INTELLIGENCE

Solutions. Dynamic Programming & Optimal Control ( ) Number of Problems: 4. Use only the provided sheets for your solutions.

New rubric: AI in the news

22c:145 Artificial Intelligence

Local search and agents

Artificial Intelligence Prof. Dr. Jürgen Dix

Artificial Intelligence

CMU Lecture 4: Informed Search. Teacher: Gianni A. Di Caro

Theory of Computer Science

Theory of Computer Science. Theory of Computer Science. E1.1 Motivation. E1.2 How to Measure Runtime? E1.3 Decision Problems. E1.

Beyond Classical Search

Artificial Intelligence Prof. Dr. Jürgen Dix

Chapter 4 Beyond Classical Search 4.1 Local search algorithms and optimization problems

Local and Online search algorithms

State Space Search Problems

Artificial Intelligence

Pengju

is called an integer programming (IP) problem. model is called a mixed integer programming (MIP)

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

CS:4420 Artificial Intelligence

CSE 473: Artificial Intelligence Spring 2014

Single Machine Models

Search' How"do"we"plan"our"holiday?" How"do"we"plan"our"holiday?" Many"problems"can"be"solved"by"search:"

CS:4420 Artificial Intelligence

CSC242: Artificial Intelligence. Lecture 4 Local Search

Analysis of Algorithms. Unit 5 - Intractable Problems

Chapter 3 Deterministic planning

2 GRAPH AND NETWORK OPTIMIZATION. E. Amaldi Introduction to Operations Research Politecnico Milano 1

8.3 Hamiltonian Paths and Circuits

HILL-CLIMBING JEFFREY L. POPYACK

Introduction to Arti Intelligence

CS188: Artificial Intelligence, Fall 2009 Written 2: MDPs, RL, and Probability

CS188: Artificial Intelligence, Fall 2009 Written 2: MDPs, RL, and Probability

ECS 120 Lesson 24 The Class N P, N P-complete Problems

Friday Four Square! Today at 4:15PM, Outside Gates

State Machines. step by step processes (may step in response to input not today) State machines. Die Hard. State machines

Classical Planning Chapter 10. Mausam (Based on slides of Dan Weld, Marie desjardins)

Artificial Intelligence. Non-deterministic state model. Model for non-deterministic problems. Solutions. Blai Bonet

Example: Robot Tasks. What is planning? Background: Situation Calculus. Issues in Planning I

Finding optimal configurations ( combinatorial optimization)

Simulated Annealing. Local Search. Cost function. Solution space

Markov Models and Reinforcement Learning. Stephen G. Ware CSCI 4525 / 5525

6.852: Distributed Algorithms Fall, Class 10

A.I.: Beyond Classical Search

INTEGER PROGRAMMING. In many problems the decision variables must have integer values.

Principles of Computing, Carnegie Mellon University. The Limits of Computing

Reinforcement Learning II

CS 380: ARTIFICIAL INTELLIGENCE

Doctoral Course in Speech Recognition. May 2007 Kjell Elenius

2 Chapter 1. Introduction

CSC242: Intro to AI. Lecture 5. Tuesday, February 26, 13

The Traveling Salesman Problem New Mexico Supercomputing Challenge Final Report April 6 th, 2016 Team 104 School of Dreams Academy

Principles of AI Planning

Outline What are CSPs? Standard search and CSPs Improvements. Constraint Satisfaction. Introduction. Introduction

A note on three water cups

CSL302/612 Artificial Intelligence End-Semester Exam 120 Minutes

Worst-Case Solution Quality Analysis When Not Re-Expanding Nodes in Best-First Search

Applied Integer Programming: Modeling and Solution

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

CMU-Q Lecture 5: Classical Planning Factored Representations STRIPS. Teacher: Gianni A. Di Caro

A scheme developed by Du Pont to figure out

Better Eager Than Lazy? How Agent Types Impact the Successfulness of Implicit Coordination

CS:4420 Artificial Intelligence

Teaching Computers To Make Plans

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Learning in State-Space Reinforcement Learning CIS 32

Introduction to Artificial Intelligence. Learning from Oberservations

Complexity Theory Part II

DES. 4. Petri Nets. Introduction. Different Classes of Petri Net. Petri net properties. Analysis of Petri net models

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Extended breadth-first search algorithm in practice

Bayes Nets III: Inference

What we will try to do...

Computational Complexity

CS221 Practice Midterm

CS 380: ARTIFICIAL INTELLIGENCE

Motivation for introducing probabilities

INFORMS ANNUAL MEETING WASHINGTON D.C. 2008

A Generic Framework and Solver for Synthesizing Finite-State Controllers

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

Transcription:

22c:145 Artificial Intelligence Fall 2005 Problem Solving by Search Cesare Tinelli The University of Iowa Copyright 2001-05 Cesare Tinelli and Hantao Zhang. a a These notes are copyrighted material and may not be used in other course settings outside of the University of Iowa in their current or modified form without the express written permission of the copyright holders. 22c:145 Artificial Intelligence, Fall 05 p.1/42

eadings Chap. 3 of [ussell and Norvig, 2003] 22c:145 Artificial Intelligence, Fall 05 p.2/42

Example: omania Problem: On holiday in omania; currently in Arad. Flight leaves tomorrow from Bucharest. Find a short route to drive to Bucharest. Formulate problem: states: various cities actions: drive between cities solution: sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest 22c:145 Artificial Intelligence, Fall 05 p.3/42

Example: omania 71 Oradea Neamt Zerind 75 Arad 140 118 Timisoara 111 70 75 Dobreta 151 Sibiu 99 Fagaras 80 imnicu Vilcea ugoj Mehadia 120 Pitesti 211 97 146 101 85 138 Bucharest Craiova 90 Giurgiu 87 Iasi 92 142 98 Urziceni Vaslui Hirsova 86 Eforie 22c:145 Artificial Intelligence, Fall 05 p.4/42

Problem Types Deterministic, fully observable environment = single-state problem Agent knows exactly which state it will be in. Solution is a sequence of actions. Non-observable environment = conformant problem Agent know it may be in any of a number of states. Solution, if any, is a sequence of actions. Nondeterministic and/or partially observable environment = contingency problem Percepts provide new information about current state. Solution is a tree or policy. Often interleave search and execution. 22c:145 Artificial Intelligence, Fall 05 p.5/42

Problem Types (cont.) Unknown state space = exploration problem ( online ) 22c:145 Artificial Intelligence, Fall 05 p.6/42

Example: Vacuum World Single-state problem, initial state = 5 Solution? 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.7/42

Example: Vacuum World Single-state problem, initial state = 5 Solution? [ight, Suck] 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.7/42

Example: Vacuum World Conformant problem, initial state = {1, 2, 3, 4, 5, 6, 7, 8} ight = {2, 4, 6, 8}, eft = {1, 3, 5, 7}, Suck = {5, 4, 7, 8} Solution? 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.8/42

Example: Vacuum World Conformant problem, initial state = {1, 2, 3, 4, 5, 6, 7, 8} ight = {2, 4, 6, 8}, eft = {1, 3, 5, 7}, Suck = {5, 4, 7, 8} Solution? [ight, Suck, ef t, Suck] 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.8/42

Example: Vacuum World Contingency problem, initial state = 5 Suck occasionally fails. ocal sensing: dirt, location. Solution? 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.9/42

Example: Vacuum World Contingency problem, initial state = 5 Suck occasionally fails. ocal sensing: dirt, location. Solution? [ight, if dirt then Suck] 1 2 3 4 5 6 7 8 22c:145 Artificial Intelligence, Fall 05 p.9/42

Problem Solving We start by considering the simpler cases in which the environment is fully observable, static and deterministic. ecall that in such a situation the following holds. The agent s world is representable by a discrete set of states. The agent s actions are representable by a discrete set of operators. The next world state is completely determined by the current state and the agent s actions. The world s state transitions are caused exclusively by the agent s actions. 22c:145 Artificial Intelligence, Fall 05 p.10/42

Single-state Problem Formulation Formally, a problem is defined by four components: An initial state e.g., In(Arad) A successor function S returning sets of action state pairs e.g., S(Arad) = { GoTo(Zerind), In(Zerind),...} A goal test explicit, e.g., x = In(Bucharest) or implicit, e.g., N odirt(x) A path cost e.g., sum of distances, number of actions executed, etc. Usually additive and given as c(x, a, y), the step cost from x to y by action a, assumed to be 0. A solution is a sequence of actions leading from the initial state to a goal state 22c:145 Artificial Intelligence, Fall 05 p.11/42

Selecting a State Space Since the real world is absurdly complex the state space must be abstracted for problem solving. Abstract state = set of real states. (Abstract) action = complex combination of real actions e.g., GoT o(zerind) from Arad represents a complex set of possible routes, detours, rest stops, etc. For guaranteed realizability, any real state corresponding to In(Arad) must get to some real state corresponding to In(Zerind). Each abstract action should be easier than the original problem! (Abstract) solution = set of real paths that are solutions in the real world 22c:145 Artificial Intelligence, Fall 05 p.12/42

Example: vacuum world state space graph S S S S S S S S States? Actions? Goal test? Path cost? 22c:145 Artificial Intelligence, Fall 05 p.13/42

Example: vacuum world state space graph S S S S S S S S States? Actions? Goal test? Path cost? dirt flag, robot location (ignore dirt amount) ef t, ight, Suck, N oop dirty 1 per action (0 for NoOp) 22c:145 Artificial Intelligence, Fall 05 p.14/42

Formulating Problem as a abeled Graph In the graph each node represents a possible state; a node is designated as the initial state; one or more nodes represent goal states, states in which the agent s goal is considered accomplished. each edge represents a state transition caused by a specific agent action; associated to each edge is the cost of performing that transition. 22c:145 Artificial Intelligence, Fall 05 p.15/42

Search Graph How do we reach a goal state? initial state 3 A 4 B 4 C S 5 2 5 7 F goal states 4 D There may be several possible ways. Or none! Factors to consider: 2 E 3 G cost of finding a path; cost of traversing a path. 22c:145 Artificial Intelligence, Fall 05 p.16/42

Problem Solving as Search Search space: set of states reachable from an initial state S 0 via a (possibly empty/finite/infinite) sequence of state transitions. To achieve the problem s goal search the space for a (possibly optimal) sequence of transitions starting from S 0 and leading to a goal state; execute (in order) the actions associated to each transition in the identified sequence. For contingency problems two steps above need to be interleaved. 22c:145 Artificial Intelligence, Fall 05 p.17/42

Example: The 8-puzzle 2 8 3 1 7 6 4 5 22c:145 Artificial Intelligence, Fall 05 p.18/42

Example: The 8-puzzle Problem: Go from state S to state G. 2 8 3 1 6 4 7 5 (S) 1 2 3 8 7 6 4 5 (G) 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 D D U D U D U 2 8 3 2 8 3 6 4 1 4 1 7 5 7 6 5 U 2 8 3 2 8 3 1 4 1 6 4 7 6 5 7 5 2 3 1 8 4 7 6 5 2 8 3 1 4 7 6 5 2 8 3 1 6 7 5 4 22c:145 Artificial Intelligence, Fall 05 p.19/42

Example: The 8-puzzle States: Operators: configurations of tiles move one tile Up/Down/eft/ight Note: There are 9! = 362, 880 possible states (all permutations of {0, 1, 2, 3, 4, 5, 6, 7, 8} where 0 is the empty space). Not all states are directly reachable from a given state. (In fact, exactly half of them are reachable from a given state.) How can an artificial agent represent the states and the state space for this problem? 22c:145 Artificial Intelligence, Fall 05 p.20/42

Problem Formulation 1. Choose an appropriate data structure to represent the world states. 2. Define each operator as a precondition/effects pair where the precondition holds exactly in the states the operator applies to, effects describe how a state changes into a successor state by the application of the operator. 3. Specify an initial state. 4. Provide a description of the goal (used to check if a reached state is a goal state). 22c:145 Artificial Intelligence, Fall 05 p.21/42

Formulating the 8-puzzle Problem States: each represented by a 3 3 array of numbers in [0...8], where value 0 is for the empty cell. 2 1 7 8 3 6 4 5 becomes A = 2 8 3 1 6 4 7 0 5 22c:145 Artificial Intelligence, Fall 05 p.22/42

Formulating the 8-puzzle Problem Operators: 24 operators of the form OP r,c,d where r, c {1, 2, 3}, d {,, U, D}. If the empty space is at position (r, c), OP r,c,d moves it in direction d. Example: 2 8 3 1 6 4 7 0 5 OP 3,2, = 2 8 3 1 6 4 0 7 5 22c:145 Artificial Intelligence, Fall 05 p.23/42

Preconditions and Effects Example: OP 3,2, 2 8 3 1 6 4 7 0 5 OP 3,2, = 2 8 3 1 6 4 7 5 0 Preconditions: A[3, 2] = 0 { A[3, 2] A[3, 3] Effects: A[3, 3] 0 We have 24 operators in this problem formulation... 20 too many! 22c:145 Artificial Intelligence, Fall 05 p.24/42

A Better Formulation States: each represented by a pair (A, (i, j)) where: A is a 3 3 array of numbers in [0...8] (i, j) is the position of the empty space (0) in the array. 2 1 7 8 3 6 4 5 becomes ( 2 8 3 1 6 4 7 0 5, (3, 2) ) 22c:145 Artificial Intelligence, Fall 05 p.25/42

A Better Formulation Operators: 4 operators of the form OP d where d {,, U, D}. Example: OP d moves the empty space in the direction d. ( 2 8 3 1 6 4 7 0 5, (3, 2) ) 2 8 3 OP = ( 1 6 4 0 7 5, (3, 1) ) 22c:145 Artificial Intelligence, Fall 05 p.26/42

Preconditions and Effects Example: OP ( 2 8 3 1 6 4 7 0 5, (3, 2) ) 2 8 3 OP = ( 1 6 4 0 7 5, (3, 1) ) et (r 0, c 0 ) be the position of 0 in A. Preconditions: c 0 > 1 Effects: A[r 0, c 0 ] A[r 0, c 0 1] A[r 0, c 0 1] 0 (r 0, c 0 ) (r 0, c 0 1) 22c:145 Artificial Intelligence, Fall 05 p.27/42

The Water Jugs Problem 3gl 4gl Get exactly 2 gallons of water into the 4gl jug. 22c:145 Artificial Intelligence, Fall 05 p.28/42

The Water Jugs Problem States: Determined by the amount of water in each jug. State epresentation: Two real-valued variables, J 3,J 4, indicating the amount of water in the two jugs, with the constraints: 0 J 3 3, 0 J 4 4 Initial State Description J 3 = 0, J 4 = 0 Goal State Description: J 4 = 2 (non exhaustive description) 22c:145 Artificial Intelligence, Fall 05 p.29/42

The Water Jugs Problem: Operators E4: empty jug4 on the ground. precond: J 4 > 0 effect: J 4 = 0 E4-3: pour water from jug4 into jug3 until jug3 is full. precond: J 3 < 3, effect: J 3 = 3, J 4 3 J 3 J 4 = J 4 (3 J 3 ) P3-4: pour water from jug3 into jug4 until jug4 is full. precond: J 4 < 4, effect: J 4 = 4, J 3 4 J 4 J 3 = J 3 (4 J 4 ) E3-4: pour water from jug3 into jug4 until jug3 is empty. precond: J 3 + J 4 < 4, effect: J 4 = J 3 + J 4, J 3 > 0 J 3 = 0... 22c:145 Artificial Intelligence, Fall 05 p.30/42

The Water Jugs Problem Problem Search Graph J_3 = 0 J_4 = 0 J_4 = 2 F4 J_3 = 0 J_4 = 0 F3 J_3 = 0 F3 J_4 = 4 P4-3 F4 J_3 = 3 J_4 = 0 E3-4 J_3 = 3 J_4 = 4 J_3 = 3 J_4 = 1 J_3 = 0 J_4 = 4 F3 J_3 = 0 J_4 = 3......... P3-4 J_3 = 3 J_4 = 3 E4 J_3 = 2 J_4 = 4... E3-4 J_3 = 2 J_4 = 0 J_3 = 0 J_4 = 2 22c:145 Artificial Intelligence, Fall 05 p.31/42

eal-world Search Problems oute Finding (computer networks, airline travel planning system,... ) Travelling Salesman Optimization Problem (package delivery, automatic drills,... ) ayout Problems (VSI layout, furniture layout, packaging,... ) Assembly Sequencing (assembly of electric motors,... ) Task Scheduling (manufacturing, timetables,... ) 22c:145 Artificial Intelligence, Fall 05 p.32/42

Problem Solution Typically, a problem s solution is a description of how to reach a goal state from the initial state: Examples: n-puzzle route-finding problem assembly sequencing Occasionally, a problem s solution is simply a description of the goal state itself: Examples: 8-queen problem scheduling problems layout problems 22c:145 Artificial Intelligence, Fall 05 p.33/42