lib. umn. edu/torre107/si/pics/superficialintelligence2

Slides:



Advertisements
Similar presentations
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Advertisements

Additional Topics ARTIFICIAL INTELLIGENCE
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
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.
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Chapter 3 Solving Problems by Searching. 2 Outline Problem-solving agentsProblem-solving agents Problem typesProblem types Problem formulationProblem.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
SEARCH ALGORITHMS David Kauchak CS30 – Spring 2015.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CHAPTER 3 CMPT Blind Search 1 Search and Sequential Action.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Russell & Norvig Chapter 3]
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Uninformed Search CMSC 471 Chapter 3 Adapted from slides by
Solving Problems by Searching
CMU Snake Robot
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Class #3/4 – Thursday, September 8 / Tuesday, September 13
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.

CMSC 471 Spring 2014 Class #3 Tue 2/4/14 Problem Solving as Search Professor Marie desJardins,
Problem solving.
Uninformed Search. Big Idea Allen Newell and Herb Simon developed the problem space principle as an AI approach in the late 60s/early 70s "The rational.
CSC 463.
Uninformed Search Chapter 3 Some material adopted from notes by Charles R. Dyer, University of Wisconsin-Madison.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
CMSC 671 Fall 2001 Class #3/4 – Monday, September 9 / Wednesday, September 11.
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Prof. Carla P. Gomes Module: Search I (Reading R&N: Chapter.
Uninformed Search Chapter 3 Some material adopted from notes by Charles R. Dyer, University of Wisconsin-Madison.
1 Solving problems by searching 171, Class 2 Chapter 3.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Lecture 3: 18/4/1435 Searching for solutions. Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
Problem solving by search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Problem Solving Agents
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 3 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Uninformed Search.
Solving problems by searching A I C h a p t e r 3.
1 Solving problems by searching Chapter 3. 2 Outline Problem types Example problems Assumptions in Basic Search State Implementation Tree search Example.
CMSC 671 Fall 2010 Class #3 – Monday, September 13.
CMSC 671 Fall 2003 Class #3/4 – Monday, September 8 / Wednesday, September 10.
WEEK 5 LECTURE -A- 23/02/2012 lec 5a CSC 102 by Asma Tabouk Introduction 1 CSC AI Basic Search Strategies.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
David Kauchak CS30 – Spring 2016
Problem Solving as Search
Solving problems by searching
CS 2710, ISSP 2160 Foundations of Artificial Intelligence
ARTIFICIAL INTELLIGENCE
David Kauchak CS51A – Spring 2019
Presentation transcript:

http://blog. lib. umn. edu/torre107/si/pics/superficialintelligence2 http://blog.lib.umn.edu/torre107/si/pics/superficialintelligence2.jpg

CS311 David Kauchak Spring 2013 Uninformed Search CS311 David Kauchak Spring 2013 Adapted from notes from: Sara Owsley Sood, Eric Eaton

Administrative Send me videos! Written problems will be posted today Programming assignment 1 due before class on Tue. Anyone started? My office hours posted: Mon/Wed 1-2:30pm Fri 11am-12 and by appointment

Python Whether importing or running, python executes code from the top down Be careful about calling functions before they’re defined Comments and docstrings Don’t mix tabs and spaces! (setup your text editor to only use spaces)

How do we make a computer "smart?" clean the house! Um… OK…?? Assume that we want this vacuum to clean this house To us - if someone told us to use a vacuum to clean a house, the sequence of events that should follow are pretty clear We’d walk into the house, figure out what rooms needed to be vacuumed and start vacuuming We’d methodically go through the room, not vacuuming over places we’ve already been, until we cover the whole room, then move to the next room This one's got no chance…

Fundamental problem of AI Reasoning with knowledge and uncertainty Search Many different ways of making an agent intelligent Learning Reasoning with Utility

Act like a human Turing Test Today: search Brute force approach Very unlikely how humans do it Enumerate out possibilities in a reasonable order Think like a human Cognitive Modeling Think rationally Logic-based Systems Act like a human Turing Test Act rationally Rational Agents

What is an “agent”? Human agent Software agent “anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators” Human agent sensors = eyes, ears, etc actuators = hands, legs, mouth, etc Software agent sensors = any input devices - keyboard gives it keystrokes, commands over the network, files give it text or data actuators = any output devices - using the screen to display things, pass things over the network, write things to files, etc

search agents done offline! Search agent is an agent that approaches problem solving via search To accomplish a task: Formulate problem and goal Search for a sequence of actions that will lead to the goal (the policy) Execute the actions one at a time done offline!

Formulating the problem: What information does a search agent need to know to plan out a solution?

Formulating the problem: Initial state: where are we starting from what are the states? Actions: what are the possible actions Transition model: aka state-space, mapping from action x state to state Goal/goal test: what is the end result we’re trying to achieve? Cost: what are the costs of the different actions

Let’s start with our vacuum cleaner example State space Just two possible spaces in the house (though this generalizes easily to more) each space can either be dirty or clean vaccum is in one space at a time

Let’s start with our vacuum cleaner example State space Just two possible spaces in the house (though this generalizes easily to more) each space can either be dirty or clean vaccum is in one space at a time How many states?

Vacuum world Only 8 states

Vacuum world goal state(s)?

Vacuum world

Vacuum world Actions? move left move right suck no-op

Vacuum world: state space/transition model

Problem characteristics Fully observable vs. partially observable do we have access to all of the relevant information noisy information, inaccurate sensors, missing information Deterministic vs. non-deterministic (stochastic) outcome of an action are not always certain probabilistic sometimes Known/unknown environment Do we know a priori what the problem space is like (e.g. do we have a map)

Search problem types Deterministic, fully observable Agent knows exactly which state it will be in solution is a sequence of actions Non-observable  sensorless problem Agent may have no idea where it is solution is still a sequence Non-deterministic and/or partially observable  contingency problem percepts provide new information about current state often interleave search, execution Unknown state space  exploration problem this is how roomba works

Example: vacuum world Deterministic, fully observable start in #5. Solution? [Right, Suck]

Example: vacuum world Sensorless start in {1,2,3,4,5,6,7,8} Solution? [Right,Suck,Left,Suck]

Example: Vacuum world Non-deterministic and/or partially observable Nondeterministic: Suck may dirty a clean carpet Partially observable: location, dirt at current location. Percept: [L, Clean], i.e., start in #5 or #7 Solution? [Right, if dirt then Suck]

Vacuum world Cost?

Toy problems and micro-worlds Some example problems Toy problems and micro-worlds 8-Puzzle Missionaries and Cannibals Cryptarithmetic Remove 5 Sticks Water Jug Problem Real-world problems

Another problem: 8-Puzzle

8-puzzle goal states? actions? path cost?

8-Puzzle state: actions: path cost: all 3 x 3 configurations of the tiles on the board actions: Move Blank Square Left, Right, Up or Down. This is a more efficient encoding than moving each of the 8 distinct tiles path cost: +1 for each action

The 8-Queens Problem State transition:? Initial State? Actions? Goal: Place eight queens on a chessboard such that no queen attacks any other!

Missionaries and Cannibals Three missionaries and three cannibals wish to cross the river. They have a small boat that will carry up to two people. Everyone can navigate the boat. If at any time the Cannibals outnumber the Missionaries on either bank of the river, they will eat the Missionaries. Find the smallest number of crossings that will allow everyone to cross the river safely.

Cryptarithmetic Find an assignment of digits (0, ..., 9) to letters so that a given arithmetic expression is true. examples: SEND + MORE = MONEY FORTY Solution: 29786 + TEN 850 ----- ----- SIXTY 31486 F=2, O=9, R=7, etc.

Remove 5 Sticks Given the following configuration of sticks, remove exactly 5 sticks in such a way that the remaining configuration forms exactly 3 squares.

Water Jug Problem Given a full 5-gallon jug and a full 2-gallon jug, fill the 2-gallon jug with exactly one gallon of water. 5 2

Water Jug Problem 5 State = (x,y), where x is the number of gallons of water in the 5-gallon jug and y is # of gallons in the 2-gallon jug Initial State = (5,2) Goal State = (*,1), where * means any amount Operator table 2 Name Cond. Transition Effect Empty5 – (x,y)→(0,y) Empty 5-gal. jug Empty2 (x,y)→(x,0) Empty 2-gal. jug 2to5 x ≤ 3 (x,2)→(x+2,0) Pour 2-gal. into 5-gal. 5to2 x ≥ 2 (x,0)→(x-2,2) Pour 5-gal. into 2-gal. 5to2part y < 2 (1,y)→(0,y+1) Pour partial 5-gal. into 2-gal.

Some real-world problems Route finding directions, maps computer networks airline travel VLSI layout Touring (traveling salesman) Agent planning

Search algorithms We’ve defined the problem Now we want to find the solution! Use search techniques offline, simulated exploration of state space by generating successors of already-explored states (a.k.a. expanding states) Start at the initial state and search for a goal state What are candidate search techniques? BFS DFS Uniform-cost search Depth limited DFS Depth-first iterative deepening

Finding the path: Tree search algorithms Basic idea: keep a set of nodes to visit next (frontier) pick a node from this set check if it’s the goal state if not, expand out adjacent nodes and repeat def treeSearch(start): add start to the frontier while frontier isn’t empty: get the next node from the frontier if node contains goal state: return solution else: expand node and add resulting nodes to frontier

BFS and DFS How do we get BFS and DFS from this? def treeSearch(start): add start to the frontier while frontier isn’t empty: get the next node from the frontier if node contains goal state: return solution else: expand node and add resulting nodes to frontier

Breadth-first search Expand shallowest unexpanded node Nodes are expanded a level at a time (i.e. all nodes at a given depth) Implementation: frontier is a FIFO queue, i.e., new successors go at end Curr = D Fringe = [E, F, G] And so on and so forth until we either reach a goal state or have no more leaf nodes to expand (fringe is empty) frontier

Depth-first search Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front frontier

Search algorithm properties Time (using Big-O) Space (using Big-O) Complete If a solution exists, will we find it? Optimal If we return a solution, will it be the best/optimal solution A divergence from algorithms/data structures we generally won’t use V and E to define time and space. Why? Often V and E are infinite! Instead, we often use the branching factor (b) and depth (d)

Activity Analyze DFS and BFS according to the criteria time, space, completeness and optimality (for time and space, analyze in terms of b, d, and m (max depth); for complete and optimal - simply YES or NO) Which strategy would you use and why? Brainstorm improvements to DFS and BFS

BFS O(bd) O(bd) YES YES if action costs are fixed, NO otherwise Time: Space: Complete: Optimal: O(bd) b = branching factor d = depth m = max depth of tree O(bd) YES YES if action costs are fixed, NO otherwise

Time and Memory requirements for BFS Depth Nodes Time Memory 2 1100 .11 sec 1 MB 4 111,100 11 sec 106 MB 6 107 19 min 10 GB 8 109 31 hours 1 terabyte 10 1011 129 days 101 terabytes 12 1013 35 years 10 petabytes 14 1015 3,523 years 1 exabyte 10^15, 2^50 1 billion gigabytes 10^18, 2^60 DFS requires only 118KB, 10 billion times less space BFS with b=10, 10,000 nodes/sec; 10 bytes/node

DFS Time: Space: Complete: Optimal: O(bm) b = branching factor d = depth m = max depth of tree O(bm) YES, if space is finite (and no circular paths), NO otherwise NO

Problems with BFS and DFS doesn’t take into account costs memory!  DFS not optimal can’t handle infinite spaces loops

Uniform-cost search Expand unexpanded node with the smallest path cost, g(x) Implementation?

Uniform-cost search Expand unexpanded node with the smallest path cost, g(x) Implementation: frontier = priority queue ordered by path cost similar to Dijkstra’s algorithm How does it relate to bfs? equivalent if costs are fixed

Uniform-cost search Time? and Space? Complete? Optimal? dependent on the costs and optimal path cost, so cannot be represented in terms of b and d Space will still be expensive (e.g. take uniform costs) Complete? YES, assuming costs > 0 Optimal? Yes, assuming costs > 0 This helped us tackle the issue of costs, but still going to be expensive from a memory standpoint!

Ideas? Can we combined the optimality and completeness of BFS with the memory of DFS? + =

Depth limited DFS DFS, but with a depth limit L specified Time? Space? nodes at depth L are treated as if they have no successors we only search down to depth L Time? O(bL) Space? Complete? NO, if solution is longer than L Optimal NO, for same reasons DFS isn’t

Ideas?

Iterative deepening search For depth 0, 1, …., ∞ run depth limited DFS if solution found, return result Blends the benefits of BFS and DFS searches in a similar order to BFS but has the memory requirements of DFS Will find the solution when L is the depth of the shallowest goal

Iterative deepening search L =0

Iterative deepening search L =1

Iterative deepening search L =2

Iterative deepening search L =3

Time? L = 0: 1 L = 1: 1 + b L = 2: 1 + b + b2 L = 3: 1 + b + b2 + b3 … L = d: 1 + b + b2 + b3 + … + bd Overall: d(1) + (d-1)b + (d-2)b2 + (d-3)b3 + … + bd O(bd) the cost of the repeat of the lower levels is subsumed by the cost at the highest level

Properties of iterative deepening search Space? O(bd) Complete? YES Optimal? YES, if step size = 1

Missionaries and Cannibals Solution Near side Far side 0 Initial setup: MMMCCC B - 1 Two cannibals cross over: MMMC B CC 2 One comes back: MMMCC B C 3 Two cannibals go over again: MMM B CCC 4 One comes back: MMMC B CC 5 Two missionaries cross: MC B MMCC 6 A missionary & cannibal return: MMCC B MC 7 Two missionaries cross again: CC B MMMC 8 A cannibal returns: CCC B MMM 9 Two cannibals cross: C B MMMCC 10 One returns: CC B MMMC 11 And brings over the third: - B MMMCCC