Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Email Methods for Intelligently/Efficiently Searching a Space.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Review: Search problem formulation
Heuristic Search techniques
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.
January 26, 2003AI: Chapter 3: Solving Problems by Searching 1 Artificial Intelligence Chapter 3: Solving Problems by Searching Michael Scherger Department.
Problem Solving and Search Andrea Danyluk September 9, 2013.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
Review: Search problem formulation
Using Search in Problem Solving
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Using Search in Problem Solving
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
Using Search in Problem Solving
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Breadth-first search (BFS) 8-puzzle problem The breadth-first search uses a queue to hold all expanded nodes.
Uninformed Search (cont.)
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
Solving Problems by Searching
State-Space Searches.
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
WAES 3308 Numerical Methods for AI
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
How are things going? Core AI Problem Mobile robot path planning: identifying a trajectory that, when executed, will enable the robot to reach the goal.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
Graphs. Made up of vertices and arcs Digraph (directed graph) –All arcs have arrows that give direction –You can only traverse the graph in the direction.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
Today’s Topics Exam Thursday Oct 22. 5:30-7:3-pm, same room as lecture Makeup Thursday Oct 29? Or that Monday or Wednesday? Exam Covers Material through.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
ECE 448 Lecture 4: Search Intro
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
CS Fall 2016 (Shavlik©), Lecture 8, Week 5
CS 188: Artificial Intelligence Fall 2008
CS Fall 2016 (Shavlik©), Lecture 9, Week 5
Artificial Intelligence
CS Fall 2016 (Shavlik©), Lecture 10, Week 6
Artificial Intelligence
ARTIFICIAL INTELLIGENCE
Presentation transcript:

Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Methods for Intelligently/Efficiently Searching a Space of Possible Solutions –Depth, Breadth, Best first search Casting a Task as a Search Problem An Infinite Space 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 41

Generating Great Text is Easy, Discarding the Junk is Hard WriteMyThesis(int expectedLengthInChars) let text = “” while (random() > 1.0 / expectedLengthInChars) text += getRandomASCIIcharacter() if (acceptable(text)) return text else return WriteMyThesis(expectedLengthInChars) 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 2

Visualizing AI Search as Discrete Graphs Nodes: an importance aspect of the problem Directed Arcs: legal transitions between nodes Weights (optional): cost of traversing an arc 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 3 Note: nodes usually a complex data structure (eg, a tree)

CS Fall 2015 (Shavlik©), Lecture 9, Week 4 Recall: Aspects of an AI Search Algorithm Search Space Where we are looking; for now this will be a DISCRETE SPACE Operators Legal ways to move from one node to another Search Strategy How we decide which move to make next Heuristic Function Some search methods score nodes to help guide search strategy (optional) Start Node(s) Where we start (usually a single node, but could be a set) Goal Node(s) How we know we are done (sometimes we’ll have an end test, ie code that says ‘DONE!’) 9/29/154

Another Task Viewed as AI Search – the ‘8 Puzzle’ 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week Start State Goal State Legal moves: slide number into empty cell (‘state space’ drawn on paper using document camera) In AI we build the state space as we go, and rarely generate the whole space. In HWs and textbooks, we often are given the WHOLE space, but that is misleading. Possible heuristic (for scoring nodes)? i) Count of #’s in wrong cell ii) Sum of moves if ‘collisions’ allowed

Designing Heuristics One good method is to think of a ‘relaxed’ (ie, simplified version) of the task –This guides the search algo, while the search algo works out the details of the unrelaxed version Eg, in ROUTE PLANNING, assume one can ‘drive as the crow flies’ directly to the goal state (aka, ‘straight-line’ or Euclidean distance) 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 46

The KEY Question of AI Search Given a set of search-space nodes, which one should we ‘consider’ next? 1.The youngest (most recently created)? This is DEPTH-FIRST SEARCH (DFS) 2.The oldest (least recently created)? This is BREATH-FIRST SEARCH (BFS) 3.A random choice? SIMULATED ANNEALING (SA) does this 4.The best (need some scoring function)? This is BEST-FIRST SEARCH (BEST) 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 47

General Pseudocode for Searching The following is the basic outline for the various search algorithms (some steps need to be modified depending on the specifics of the search being used). OPEN = { startNode } // Nodes under consideration. CLOSED = { } // Nodes that have been expanded. While OPEN is not empty Remove the first item from OPEN. Call this item X. If goalState?(X) return the solution found. // Expand node X if it isn’t a goal state. Add X to CLOSED. // Prevents infinite loops. Generate the immediate neighbors (i.e., children) of X. Eliminate those children already in OPEN or CLOSED. Based on the search strategy, insert the remaining children into OPEN. Return FAILURE // Failed if OPEN exhausted w/o a goal found. 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 48 Called ‘expanding’ a node

Variations of “Return Solution” Might simply return SUCCESS Or return the GOAL node (this is what ID3 does) Or return PATH found from START to GOAL eg, if planning a route to travel in a GPS Proper choice is problem specific 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 49

Data Structures for OPEN Breadth-first Use a ‘queue’ (first in, first out; FIFO) OPEN  OPEN + RemainingChildren Depth-first Use a ‘stack’ (last in, first out; LIFO) OPEN  RemainingChildren + OPEN Best-first Use a ‘priority queue’ OPEN  sort(OPEN + RemainingChildren) 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 10

Example (via Doc Camera) - assume LOWER scores are better 9/29/15 CS Fall 2015 (Shavlik©), Lecture 9, Week 4 11 Start score = 9 B score = 11 C score = 8 D score = 4 E score = 3 Goal score = 0 Step# OPEN CLOSED X CHILDREN RemainingCHILDREN (this part done on doc camera for BFS, DFS, and BEST) Use these headers for HW2, Problem 2

BFS - remember we fill out line n+1 while working on line n Step# OPEN CLOSED X CHILDREN RemainingCHILDREN 1 { S } { } S { S, B, C} { B, C } 2 { B, C } { S } B { D } { D } 3 { C, D } { S, B } C { G } { G } 4 { D, G } { S, B, C} D { E } { E } 5 { G, E} { S, B, C, D} G DONE - note we check for GOALS upon removal from OPEN in order to get SHORTEST PATHS in later algo’s BEST - we now need to record the heuristic score and sort OPEN Step# OPEN CLOSED X CHILDREN RemainingCHILDREN 1 { S 9 } { } S 9 { S 9, B 11, C 8 } { B 11, C 8 } 2 { C 8, B 11 } { S 9 } C 8 { G 0 } { G 0 } 3 { G 0, B 11 } { S 9, C 8 } G 0 DONE 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 Lecture 1, Slide 12

LOWER Better or Worse? Need to carefully check if lower scores are better or worse Our default is lower is better, because often the score is ‘estimated distance to goal’ For algo’s where HIGHER is better (hill climbing, simulated annealing), use score toUse = - score original Think before you compute! 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 13

A ‘Blocks World’ Example ‘Preconditions’ of a legal move(?x, ?y) action: clearTop(?x) ˄ clearTop(?y) ˄ ?x ≠ ?y Heuristic? One possibility: # blocks in correct final position 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 414 C BA Initial State C B A Goal State

An INFINITE Space 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 15 Legal actions: A) add TWO blocks (from an infinite bin) to an existing tower B) add ONE block to an existing tower Initial state: ONE block on the table (ie, a tower of height 1) Goal state: a tower of height TWO What might go wrong? might produce tower of height 3, of height 5, …

A (Hollywood) Famous AI Puzzle Task: put exactly 4 gallons of water in a 5 gallon jug, given –a hose and an infinite supply of water –a 3 gallon jug (no ‘depth’ markings on the jug) –a 5 gallon jug Operators –Can fully empty or fill either jug –Can pour Jug ?A into Jug ?B until ?A empty or ?B full 9/29/15CS Fall 2015 (Shavlik©), Lecture 9, Week 4 16 From the movie ‘Die Hard’