5 Automated problem solving

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

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

Y. Xiang, Constraint Satisfaction Problems

An Introduction to The A* Algorithm

Satisfiability Checking

Cpt S 223. School of EECS, WSU

The Goldberg Rao Algorithm for the Maximum Flow Problem

Scheduling Shop Scheduling. Tim Nieberg

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

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

Smart Graphics: Methoden 3 Suche, Constraints

Social Media Mining. Graph Essentials

Dave Sly, PhD, MBA, PE Iowa State University

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

Measuring the Performance of an Agent

Static Load Balancing

Load Balancing. Load Balancing 1 / 24

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

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

Analysis of Algorithms, I

The Clar Structure of Fullerenes

New Admissible Heuristics for Domain-Independent Planning

A Review And Evaluations Of Shortest Path Algorithms

Reliability Guarantees in Automata Based Scheduling for Embedded Control Software

Search methods motivation 1

Approximation Algorithms

Graph Theory Problems and Solutions

Seminar. Path planning using Voronoi diagrams and B-Splines. Stefano Martina

M. Sugumaran / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 2 (3), 2011,

Informed search algorithms. Chapter 4, Sections 1 2 1

Graph Mining and Social Network Analysis

6.852: Distributed Algorithms Fall, Class 2

Problem Set 7 Solutions

WAN Wide Area Networks. Packet Switch Operation. Packet Switches. COMP476 Networked Computer Systems. WANs are made of store and forward switches.

Heuristics for Dynamically Adapting Constraint Propagation in Constraint Programming

Integration of ACO in a Constraint Programming Language

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Efficient Incremental Search for Moving Target Search

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, Connect Four

Connectivity and cuts

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

Efficient Computation of Multiple Group By Queries Zhimin Chen Vivek Narasayya

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

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

USING BACKTRACKING TO SOLVE THE SCRAMBLE SQUARES PUZZLE

CS711008Z Algorithm Design and Analysis

Graph Database Proof of Concept Report

Algorithmic Software Verification

STUDY OF PROJECT SCHEDULING AND RESOURCE ALLOCATION USING ANT COLONY OPTIMIZATION 1

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

Mining Social Network Graphs

Branch-and-Price Approach to the Vehicle Routing Problem with Time Windows

Cpt S 223. School of EECS, WSU

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

THE APPLICATION OF ARTIFICIAL INTELLIGENCE TO SOLVE A PHYSICAL PUZZLE. Dana Cremer

Analysis of Micromouse Maze Solving Algorithms

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

How To Solve The Stable Roommates Problem

Dynamic Programming. Lecture Overview Introduction

Static Analysis. Find the Bug! : Analysis of Software Artifacts. Jonathan Aldrich. disable interrupts. ERROR: returning with interrupts disabled

University of Potsdam Faculty of Computer Science. Clause Learning in SAT Seminar Automatic Problem Solving WS 2005/06

Abstract Title: Planned Preemption for Flexible Resource Constrained Project Scheduling

Warshall s Algorithm: Transitive Closure

Scenario: Optimization of Conference Schedule.

Optimization of Cable Cycles: A Trade-off between Reliability and Cost

The number of marks is given in brackets [ ] at the end of each question or part question. The total number of marks for this paper is 72.

SEMITOTAL AND TOTAL BLOCK-CUTVERTEX GRAPH

Lecture 1: Course overview, circuits, and formulas

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

Section IV.1: Recursive Algorithms and Recursion Trees

3 Abstract Data Types and Search

Graphs without proper subgraphs of minimum degree 3 and short cycles

Chapter 6. Decoding. Statistical Machine Translation

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

Policy Analysis for Administrative Role Based Access Control without Separate Administration

2.3 Convex Constrained Optimization Problems

Chapter 13: Binary and Mixed-Integer Programming

Incremental Routing Algorithms For Dynamic Transportation Networks

Introduction to Graph Theory

A Computer Application for Scheduling in MS Project

CS 2302 Data Structures Spring 2015

Data Structures. Chapter 8

Elevator Simulation and Scheduling: Automated Guided Vehicles in a Hospital

A hybrid approach for solving real-world nurse rostering problems

Offline sorting buffers on Line

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...

Fast nondeterministic recognition of context-free languages using two queues

Efficient Data Structures for Decision Diagrams

Continuous Fastest Path Planning in Road Networks by Mining Real-Time Traffic Event Information

MuACOsm A New Mutation-Based Ant Colony Optimization Algorithm for Learning Finite-State Machines

A Beam Search Heuristic for Multi-Mode Single Resource Constrained Project Scheduling

THE SECURITY AND PRIVACY ISSUES OF RFID SYSTEM

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,

H.Calculating Normal Vectors

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

Follow the Perturbed Leader

Generalized Widening

Programming Using Python

Data Structure with C

Midterm Practice Problems

Transcription:

CMPUT 366 Intelligent Systems: Dale Schuurmans 1 5 Automated problem solving Last time: represented problem as a CSP This time: represent problem as a state space search problem 5.1 State space search problem Given: initial state s 0 set of possible actions: a 1,..., a k where a i : s s goal test Goal: find a sequence of actions that transforms initial state into a goal state. (Thus, the search space is an implicit graph generated by objects and operators on objects.) 5.2 Generalizes CSPs state = partial assignment action = assign value to an unassigned variable initial state = empty assignment goal test = conjunction of constraints But, now solutions may not have a bounded length. 5.3 Examples Water jugs problem 1 Given a 3 liter jug and a 4 liter jug, where jugs can be filled with water, emptied, or water can be poured from one jug into another until either the source jug is empty or the destination jug is full. Consider a problem where the jugs are initially empty and the goal is to achieve 2 gallons in the 4 gallon jug.

CMPUT 366 Intelligent Systems: Dale Schuurmans 2 Solution: Systematically expand a search tree for the problem to find the solution as follows 00 34 30 00 03 04... Water jugs problem 04 230 33 30 04 00 Given three jugs of capacity 2, 5, and 24 7 gallons respectively. Initially the 7 gallon jug is full and the other jugs are emtpy. The goal is to achieve 1 gallon of water in some jug, without spilling 20 any water, and using no external sources of water. 02 (Ignoring repeated states, 007 is crossed out for the sake of il- Solution: lustration.) 007 205 052 In general, the search graph for this problem is given as follows 025 007 250 223 043 241 Missionaries and cannibals problem 3 missionaries and 3 cannibals want to cross a river using a boat that holds 2 people. Cannibals can never outnumber missionaries, and an empty boat

Other examples: CMPUT towers 366 of Hanoi Intelligent Systems: Dale Schuurmans 3 Rubik s cube cannot cross the river. 8 puzzle Initial state: MMMCCCB 5.4 Automating problem solving search: Graph search Goal state: BMMMCCC Automated problem solving search is graph search: states Action: = vertices take 1 or 2 people across the river actions = labeled edges Solution: General graph search strategies 5.5 Depth-First Search(DFS) Algorithm 1 Depth-First Search(DFS) 1: list {s 0 } 2: while list is not empty do 3: s head(list) 4: list rest(list) 5: if s is a goal then 6: return s 7: else 8: newstates apply actions to s 9: list prepend(newstates, list) 10: end if 11: end while 12: return fail Problem: - graph may be infinite, or have cycles 5.6 Breadth-first search (BFS) Same as DFS, except: 9: list append(list, newstates)

CMPUT 366 Intelligent Systems: Dale Schuurmans 4 5.7 DFS versus BFS BFS: DFS: guaranteed to find solution (if one exists) not space efficient b solution depth, where b is the branching factor space efficient not guaranteed How to be space efficient and guaranteed? 5.8 Iterative deepening search (IDS) Space efficient BFS Algorithm 2 Iterative deepening search (IDS) 1: for depth bound = 1, 2,... do 2: list {s 0 } 3: while list is not empty do 4: s head(list) 5: list rest(list) 6: if s is a goal then 7: return s 8: else if depth(s) < depth bound then 9: newstates apply actions to s 10: list prepend(newstates, list) 11: end if 12: end while 13: end for Same space as DFS Guaranteed to find solution like BFS

CMPUT 366 Intelligent Systems: Dale Schuurmans 5 Almost the same time as BFS: BFS running time = b d where b is the branching factor (i.e., the number of actions per state) IDS running time = 1 + b + b 2 +... + b d = bd+1 1 b d b 1 5.9 Speedups Pruning: May determine that goal constraints are already violated Do not revisit states! Put states in a hash table; check if visited already Heuristics: Use heuristic function ĥ(s) that estimates distance from s to goal 5.10 Best first search Same as DFS, except that lines 3 and 4 are replaced by: 3: s extract best ĥ value(list) Allows big speedups e.g., if ĥ is perfect, walk straight to the goal Problem: can be space inefficient Note For DFS the appropriate data structure for the list is a stack, for BFS it is a FIFO queue, and for best first search it is a heap (i.e., a priority queue). 5.11 Harder problem: Finding shortest solution Constrained optimization task Definition: Algorithm that is guaranteed to find shortest solutions is called admissible BFS, IDS DFS, best first admissible not admissible

CMPUT 366 Intelligent Systems: Dale Schuurmans 6 How to make best first admissible? Let: g(s) = shortest distance from s 0 to s ĝ(s) = shortest distance from s 0 to s (that we know at certain moment during algorithm execution) h(s) = shortest distance from s to a goal ĥ(s) = our heuristic function, which approximates h d(s) = shortest distance from s 0 to a goal through s i.e., d(s) = g(s) + h(s) ˆd(s) = our approximation of d i.e., ˆd(s) = ĝ(s) + ĥ(s) Definition An admissible heuristic is a heuristic function ĥ(s) that underestimates h(s). That is, ĥ(s) h(s), and it does not lie about the goal, i.e., ĥ(s) = 0 iff s is goal, ĥ(s) > 0 otherwise. 5.12 Admissible best first search (A ) Uses an admissible heuristic, and it is same as best first search, except: 3: s extract min ˆd value(list) 5.13 Proof that A finds shortest path Proof Let k be the length of the optimal solution, and let s 1,..., s k be an optimal solution path (where s 1 = s 0 ). Assume the algorithm finds a non-optimal solution s 1, s 2,..., s l for l > k. (Note that ĝ(s j ) = j for all 1 j l, or else the algorithm would have found a shorter path.) Now consider the time when s l 1 is on the list. In this case we must have ˆd(s l 1 ) = ĝ(s l 1 ) + ĥ(s l 1) l 1 + 1 = l.

CMPUT 366 Intelligent Systems: Dale Schuurmans 7 Claim 1 The algorithm must expand s 1 before s l 1. Pf: Expanding s 0 immediately puts s 1 on the list, therefore ˆd(s 1) = ĝ(s 1) + ĥ(s 1) = 1 + ĥ(s 1) 1 + k 1 = k < l. Claim 2 For any s i 1, if s i 1 is expanded with ĝ(s i 1) = i 1, then s i must be expanded before s l 1. Pf: Expanding s i 1 puts s i on the list with ĝ(s i ) = i, therefore ˆd(s i ) = ĝ(s i ) + ĥ(s i ) i + k i = k < l. This implies that s 1, s 2,... must all be expanded before s l 1. 5.14 Generalized A The distance does not have to be expressed as the number of states expanded. One can associate a weight w(a) (distance or cost) with each action a and define the distance as the sum of those weights along a path. (Note w(a) = 1 for the previous version of A.) The problem is to find a shortest path in terms of this distance. The basic algorithm is the same, and the proof of optimality is almost the same, with a couple of details changed. 5.15 Iterative deepening A Problem: A is space inefficient IDA : Iterative deepening on ˆd bound. Guaranteed Admissible Space efficient Time efficient? (depends on ĥ)

CMPUT 366 Intelligent Systems: Dale Schuurmans 8 Algorithm 3 Iterative deepening A search (IDA ) 1: ˆd limit ˆd(s0 ) 2: while ˆd limit < do 3: next ˆd limit 4: list {s 0 } 5: while list is not empty do 6: s head(list) 7: list rest(list) 8: if ˆd(s) > ˆd limit then 9: next ˆd limit min(next ˆd limit, ˆd(s)) 10: else 11: if s is a goal then 12: return s 13: end if 14: newstates apply actions to s 15: list prepend(newstates, list) 16: end if 17: end while 18: ˆd limit next ˆd limit 19: end while 20: return fail 5.16 Incomplete search beam search genetic algorithm 5.17 Readings Russell and Norvig 2nd Ed.: Sect 3.2-3.7, 4.1-4.2 Dean, Allen, Aloimonos: Sect 4.1 4.3