Heuristics & Pattern Databases for Search Dan Weld

Similar documents
Informed search algorithms. Chapter 3 (Based on Slides by Stuart Russell, Richard Korf, Subbarao Kambhampati, and UW-AI faculty)

Heuristics & Pattern Databases for Search Dan Weld

Chapter 4 Heuristics & Local Search

Heuristic Search with Pre-Computed Databases

22c:145 Artificial Intelligence

Recent Progress in the Design and Analysis of Admissible Heuristic Functions

AIMA 3.5. Smarter Search. David Cline

Compressing Pattern Databases

Midterm. CS440, Fall 2003

: Principles of Automated Reasoning and Decision Making Midterm

Practice Session 2. HW 1 Review

COMP9414: Artificial Intelligence Problem Solving and Search

UMBC 671 Midterm Exam 19 October 2009

Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing

Informed search algorithms

Foundations of AI. 3. Solving Problems by Searching. Problem-Solving Agents, Formulating Problems, Search Strategies

Search then involves moving from state-to-state in the problem space to find a goal (or to terminate without finding a goal).

Heuristics, and what to do if you don t know what to do. Carl Hultquist

CSC384 Introduction to Artificial Intelligence : Heuristic Search

CSE 573: Artificial Intelligence Autumn 2010

Craiova. Dobreta. Eforie. 99 Fagaras. Giurgiu. Hirsova. Iasi. Lugoj. Mehadia. Neamt. Oradea. 97 Pitesti. Sibiu. Urziceni Vaslui.

Foundations of AI. 3. Solving Problems by Searching. Problem-Solving Agents, Formulating Problems, Search Strategies

Unit 12: Artificial Intelligence CS 101, Fall 2018

Game Playing State-of-the-Art CSE 473: Artificial Intelligence Fall Deterministic Games. Zero-Sum Games 10/13/17. Adversarial Search

Experimental Comparison of Uninformed and Heuristic AI Algorithms for N Puzzle Solution

Problem Solving and Search

Improved Heuristic and Tie-Breaking for Optimally Solving Sokoban

Informed Search. Read AIMA Some materials will not be covered in lecture, but will be on the midterm.

Solving Several Planning Problems with Picat

Your Name and ID. (a) ( 3 points) Breadth First Search is complete even if zero step-costs are allowed.

Searching with Pattern Databases

COMP5211 Lecture 3: Agents that Search

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46

Homework Assignment #1

6.034 Quiz 1 October 13, 2005

A Memory-Efficient Method for Fast Computation of Short 15-Puzzle Solutions

5.4 Imperfect, Real-Time Decisions

CPS331 Lecture: Heuristic Search last revised 6/18/09

Announcements. CS 188: Artificial Intelligence Fall Today. Tree-Structured CSPs. Nearly Tree-Structured CSPs. Tree Decompositions*

I am not claiming this report is perfect, or that it is the only way to do a high-quality project. It is simply an example of high-quality work.

CSE 573 Problem Set 1. Answers on 10/17/08

CS 188: Artificial Intelligence Spring 2007

Administrivia. CS 188: Artificial Intelligence Spring Agents and Environments. Today. Vacuum-Cleaner World. A Reflex Vacuum-Cleaner

CS 188: Artificial Intelligence. Overview

CMPT 310 Assignment 1

Corticon - Making Change Possible

5.1 State-Space Search Problems

Problem 1. (15 points) Consider the so-called Cryptarithmetic problem shown below.

Solving Problems by Searching

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

Artificial Intelligence

CSE 473: Artificial Intelligence Fall Outline. Types of Games. Deterministic Games. Previously: Single-Agent Trees. Previously: Value of a State

CS 171, Intro to A.I. Midterm Exam Fall Quarter, 2016

ARTIFICIAL INTELLIGENCE (CS 370D)

Sokoban: Reversed Solving

Game Playing. Dr. Richard J. Povinelli. Page 1. rev 1.1, 9/14/2003

CSC 396 : Introduction to Artificial Intelligence

Problem. Operator or successor function - for any state x returns s(x), the set of states reachable from x with one action

Spring 06 Assignment 2: Constraint Satisfaction Problems

Artificial Intelligence Search III

Computing Science (CMPUT) 496

Generalized Game Trees

Written examination TIN175/DIT411, Introduction to Artificial Intelligence

Game Theory and Randomized Algorithms

15-381: Artificial Intelligence Assignment 3: Midterm Review

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010

Artificial Intelligence Adversarial Search

Solving Problems by Searching

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

CSE 473: Artificial Intelligence. Outline

Generation of Patterns With External Conditions for the Game of Go

Intelligent Agents. Introduction to Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 23.

Solving Sudoku Using Artificial Intelligence

5.4 Imperfect, Real-Time Decisions

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

Retrograde Analysis of Woodpush

Q1. [11 pts] Foodie Pacman

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

On Variable Dependencies and Compressed Pattern Databases

UMBC CMSC 671 Midterm Exam 22 October 2012

Constraint Satisfaction Problems: Formulation

CSE 473 Midterm Exam Feb 8, 2018

Intelligent Agents & Search Problem Formulation. AIMA, Chapters 2,

Free Cell Solver. Copyright 2001 Kevin Atkinson Shari Holstege December 11, 2001

Five-In-Row with Local Evaluation and Beam Search

Artificial Intelligence. Minimax and alpha-beta pruning

CSE 573: Artificial Intelligence

Hinojosa Kinder Math Vocabulary Words. Topic 1. number. zero. one

Lecture 7. Review Blind search Chess & search. CS-424 Gregory Dudek

Documentation and Discussion

Lecture 20 November 13, 2014

Scheduling. Radek Mařík. April 28, 2015 FEE CTU, K Radek Mařík Scheduling April 28, / 48

Multitree Decoding and Multitree-Aided LDPC Decoding

Foundations of Artificial Intelligence Introduction State of the Art Summary. classification: Board Games: Overview

A Historical Example One of the most famous problems in graph theory is the bridges of Konigsberg. The Real Koningsberg

Game-Playing & Adversarial Search

Game playing. Chapter 5, Sections 1 6

Second Annual University of Oregon Programming Contest, 1998

Spring 06 Assignment 2: Constraint Satisfaction Problems

Foundations of Artificial Intelligence

Transcription:

10//01 CSE 57: Artificial Intelligence Autumn01 Heuristics & Pattern Databases for Search Dan Weld Recap: Search Problem States configurations of the world Successor function: function from states to lists of (state, action, cost) triples Start state Goal test With many slides from Dan Klein, Richard Korf, Stuart Russell, Andrew Moore, & UW Faculty General Graph Search Paradigm Which Algorithm? function tree-search(root-node) fringe successors(root-node) explored empty while ( notempty(fringe) ) {node remove-first(fringe) state state(node) if goal-test(state) return solution(node) explored explored l d {node} fringe fringe (successors(node) - explored) } return failure end tree-search Uniform cost search Fringe = priority queue, ranked by heuristic Often: f(x) = g(x) + h(x) Which Algorithm? Which Algorithm? A* using Manhattan Best-first search using Manhattan 1

10//01 Admissable Heuristics Heuristics f(x) = g(x) + h(x) g: cost so far h: underestimate of remaining costs Where do heuristics come from? It s what makes search actually work Daniel S. Weld 8 Relaxed Problems What s being relaxed? Derive admissible heuristic from exact cost of a solution to a relaxed version of problem For transportation planning, relax requirement that car has to stay on road Euclidean dist For blocks world, distance = # move operations heuristic = number of misplaced blocks What is relaxed problem? # out of place =, true distance to goal = Cost of optimal soln to relaxed problem cost of optimal soln for real problem 9 Example: Pancake Problem Example: Pancake Problem Action: Flip over the top n pancakes Cost: Number of pancakes flipped Goal: Pancakes in size order

10//01 Example: Pancake Problem State space graph with costs as weights Example: Heuristic Function Heuristic: h(x) = the largest pancake that is still out of place What is being relaxed? 0 Counterfeit Coin Problem Twelve coins One is counterfeit: maybe heavier, maybe light Objective: Which is phony & is it heavier or lighter? Max three weighings Coins State = coin possibilities Action = weighing two subsets of coins Heuristic? What is being relaxed? 15 16 Traveling Salesman Problem Traveling Salesman Problem What can be relaxed? What can be relaxed? Path = 1) Graph ) Degree (except ends, degree 1) ) Connected Relax degree constraint Assume can teleport to past nodes on path Minimum spanning tree Kruskal s Algo: (Greedily add cheapest useful edges) 17 Kruskal s Algorithm: O(n ) (Greedily add cheapest useful edges) 18

10//01 Traveling Salesman Problem Relax connected constraint Cheapest degree graph What can be relaxed? Automated Generation of Relaxed Problems Need to reason about search problems Represent search problems in formal language Optimal assignment O(n ) 19 0 Planning I have a plan - a plan that cannot possibly fail. - Inspector Clousseau Classical Planning Given a logical description of the initial situation, a logical description of the goal conditions, and a logical description of a set of possible actions, Find a sequence of actions (a plan of actions) that brings us from the initial situation to a situation in which the goal conditions hold. D. Weld, D. Fox Example: BlocksWorld Planning Input: State Variables/Propositions C A B A B C Types: block --- a, b, c (on-table a) (on-table b) (on-table c) (clear a) (clear b) (clear c) (arm-empty) (holding a) (holding b) (holding c) (on a b) (on a c) (on b a) (on b c) (on c a) (on c b) No. of state variables =16 No. of states = 16 No. of reachable states =? Daniel S. Weld D. Weld, D. Fox

10//01 Planning Input: Actions pickup a b, pickup a c, place a b, place a c, pickup-table a, pickup-table b, place-table a, place-table b, Total: 6 + 6 + + = 18 ground actions Total: action schemata D. Weld, D. Fox 5 Planning Input: Actions (contd) :action pickup?b1?b :precondition (on?b1?b) (clear?b1) (arm-empty) :effect (holding?b1) (not (on?b1?b)) (clear?b) (not (arm-empty)) :action pickup-table?b :precondition (on-table?b) (clear?b) (arm-empty) :effect (holding?b) (not (on-table?b)) (not (arm-empty)) D. Weld, D. Fox 6 Planning Input: Initial State Planning Input: Goal (on-table a) (on-table b) (arm-empty) (clear c) (clear b) (on c a) C A B (on-table c) AND (on b c) AND (on a b) Is this a state? A B C D All other propositions false not mentioned assumed false Closed world assumption D. Weld, D. Fox 7 In planning a goal is a set of states Like the goal test in problem solving search But specified declaratively (in logic) rather than with code D. Weld, D. Fox 8 Specifying a Planning Problem Description of initial state of world Set of propositions Description of goal: E.g., Logical conjunction Any world satisfying conjunction is a goal Description of available actions Forward State-Space Search Initial state: set of positive ground literals CWA: literals not appearing are false Actions: applicable if preconditions satisfied add positive effect literals remove negative effect literals Goal test: does state logically satisfy goal? Step cost: typically 1 D. Weld, D. Fox 9 D. Weld, D. Fox 0 5

10//01 Heuristics for State-Space Search Count number of false goal propositions in current state Admissible? NO Subgoal independence assumption: Cost of solving conjunction is sum of cost of solving each subgoal independently Optimistic: ignores negative interactions Pessimistic: ignores redundancy Admissible? No Can you make this admissible? D. Weld, D. Fox 1 Heuristics for State Space Search (contd) Delete all preconditions from actions, solve easy relaxed problem, use length Admissible? YES :action pickup-table?b :precondition (and (on-table?b) (clear?b) (arm-empty)) :effect (and (holding?b) (not (on-table?b)) (not (arm-empty))) CSE 57 Heuristics for eight puzzle What can we relax? 7 1 5 1 6 5 6 8 7 8 start goal Importance of Heuristics h1 = number of tiles in wrong place D IDS A*(h1) A*(h) 10 6 6 11 1 1 6 680 0 18 8 68 9 5 10 717 9 9 1 60 7 7 1 791 59 11 18 056 6 915 161 7 1 6 8 5 Importance of Heuristics h1 = number of tiles in wrong place h = distances of tiles from correct loc D IDS A*(h1) A*(h) 10 6 6 11 1 1 6 680 0 18 8 68 9 5 10 717 9 9 1 60 7 7 1 791 59 11 18 056 6 915 161 Decrease effective branching factor 7 1 6 8 5 Combining Admissible Heuristics Can always take max Could add several heuristic values Doesn t preserve admissibility in general 5 6 6

10//01 Performance of IDA* on 15 Puzzle Random 15 puzzle instances were first solved optimally using IDA* with Manhattan distance heuristic (Korf, 1985). Optimal solution lengths average 5 moves. 00 million nodes generated on average. Average solution time is about 50 seconds on current machines. Limitation of Manhattan Distance Solving a -Puzzle instance, IDA* with Manhattan distance 65,000 years on average. Assumes that each tile moves independently In fact, tiles interfere with each other. Accounting for these interactions is the key to more accurate heuristic functions. 1 1 1 1 Manhattan distance is += moves Manhattan distance is += moves 1 1 1 1 Manhattan distance is += moves Manhattan distance is += moves 7

10//01 1 1 1 1 Manhattan distance is += moves Manhattan distance is += moves 1 1 Linear Conflict Heuristic Hansson, Mayer, and Yung, 1991 Given two tiles in their goal row, but reversed in position, additional vertical moves can be added to Manhattan distance. Still not accurate enough to solve -Puzzle We can generalize this idea further. Manhattan distance is += moves, but linear conflict adds additional moves. Pattern Database Heuristics Culberson and Schaeffer, 1996 A pattern database is a complete set of such positions, with associated number of moves. e.g. a 7-tile pattern database for the Fifteen Puzzle contains 519 million entries. Heuristics from Pattern Databases 5 10 1 7 1 8 6 1 5 6 7 15 1 9 8 9 10 11 11 1 1 1 1 15 1 moves is a lower bound on the total number of moves needed to solve this particular state. 8

10//01 Precomputing Pattern Databases Entire database is computed with one backward breadth-first search from goal. All non-pattern tiles are indistinguishable, But all tile moves are counted. The first time each state is encountered, the total number of moves made so far is stored. Once computed, the same table is used for all problems with the same goal state. Combining Multiple Databases 5 10 1 7 1 8 6 1 5 6 7 15 1 9 8 9 10 11 11 1 1 1 1 15 1 moves needed to solve red tiles moves need to solve blue tiles Overall heuristic is maximum of 1 moves Drawbacks of Standard Pattern DBs Since we can only take max Diminishing returns on additional DBs Would like to be able to add values Additive Pattern Databases Culberson and Schaeffer counted all moves needed to correctly position the pattern tiles. In contrast, we could count only moves of the pattern tiles, ignoring non-pattern moves. If no tile belongs to more than one pattern, then we can add their heuristic values. Manhattan distance is a special case of this, where each pattern contains a single tile. Daniel S. Weld Adapted from Richard Korf presentation 51 Example Additive Databases Computing the Heuristic 1 5 6 7 8 9 10 11 1 1 15 1 The 7-tile database contains 58 million entries. The 8-tile database contains 519 million entries. 5 10 1 7 8 6 1 15 1 9 11 1 0 moves needed to solve red tiles 5 moves needed to solve blue tiles Overall heuristic is sum, or 0+5=5 moves 1 5 6 7 8 9 10 11 1 1 1 15 9

10//01 Performance 15 Puzzle: 000x speedup vs Manhattan dist IDA* with the two DBs shown previously solves 15 Puzzles optimally in 0 milliseconds Puzzle: 1 million x speedup vs Manhattan IDA* can solve random instances in days. Requires DBs as shown Each DB has 18 million entries Without PDBs: 65,000 years Daniel S. Weld Adapted from Richard Korf presentation 55 10