Tutorial 1 Uninformed Search

Slides:



Advertisements
Similar presentations
Uninformed Search in Prolog
Advertisements

Review: Search problem formulation
Announcements Course TA: Danny Kumar
PROBLEM SOLVING AND SEARCH
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
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.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Using Search in Problem Solving
Uninformed Search (cont.)
Solving problems by searching
Problem-solving agents
Solving Problems by Searching
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Artificial Intelligence
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
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
Fahiem Bacchus © 2005 University of Toronto 1 CSC384: Intro to Artificial Intelligence Search II ● Announcements.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Search: Advanced Topics Computer Science cpsc322, Lecture 9
Last time: Problem-Solving
Introduction to Artificial Intelligence
Uninformed Search Chapter 3.4.
Problem Solving by Searching
Uninformed Search Strategies
Artificial Intelligence Problem solving by searching CSC 361
Search: Advanced Topics Computer Science cpsc322, Lecture 9
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
هوش مصنوعی فصل سوم: حل مسئله با جستجو
Uninformed Search Introduction to Artificial Intelligence
Prof. Dechter ICS 270A Winter 2003
Solving problems by searching
Graphs Representation, BFS, DFS
Tutorial 5 Adversary Search
SOLVING PROBLEMS BY SEARCHING
Problem Solving and Searching
EA C461 – Artificial Intelligence
Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Tree Searching.
Tutorial 3 Empirical evaluation in AI
A General Backtracking Algorithm
Solving problems by searching
Tree Searching.
Tree Searching.
Tree Searching.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
State-Space Searches.
Graphs.
State-Space Searches.
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #2
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
State-Space Searches.
Solving problems by searching
Presentation transcript:

Tutorial 1 Uninformed Search CS 236501 Introduction to AI Tutorial 1 Uninformed Search

Problem Representation Initial state (InitState) Successor function (Succ) Goal predicate (Goal-p) 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Problem Example - Binary Tree The problem is to find the number 12 in a binary tree A state is represented by a number Initial State: 1 Successor Function: Succ(x) = {2*x, 2*x + 1} Goal predicate: Goal-p(x) == true iff x == 12 1 2 3 4 5 6 7 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

General Search Routine SearchFunction (States, Problem, Combiner) { If States == {} return ‘Search Failed’ CurrState <- Get and Remove first state in States if (Problem.Goal-p(CurrState) == true) return CurrState //or any other solution form else successors <- Problem.Succ(CurrState) States <- Combiner(successors,States) SearchFunction(States, Problem, Combiner) } 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Combiner examples Append-Combiner(states1, states2) { // First nodes in states1, then nodes in states2 Result <- states1 For s in states2 Result <- Add s to the end of Result } Prepend-Combiner(states1, states2) { // First nodes in states2, then nodes in states1 Result <- states2 For s in states1 Result <- Add s to the end of Result } 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

General Search Routine First call to the search function: Problem <- Initialize problem with appropriate data Combiner <- Choose state combination method that will characterize the search States <- Problem.InitState Solution = SearchFunction(States, Problem, Combiner) 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich DFS States <- Problem.InitState Solution = SearchFunction(States, Problem, Append-Combiner) 1 2 3 4 5 8 9 16 17 (For this example, solution will not be found) 32 33 … 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Depth Limited DFS LimDepth-Append-Combiner(states1, states2) { Result <- {} For s in states1 if s.depth <= DepthLimit Result <- Add s to the end of Result For s in states2 } DepthLimit is a property of LimDepth-Append-Combiner 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Depth Limited DFS LimDepth-Append-Combiner.DepthLimit <- 5 States <- Problem.InitState Solution = SearchFunction(States, Problem, LimDepth-Append-Combiner) 1 2 3 4 5 6 7 8 9 10 11 12 13 16 17 18 19 20 21 22 23 X X X X X X X X 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Iterative deepening DFS Iterative-Deepening-DFS(Problem, MaxDepth) { for i from 1 to MaxDepth LimDepth-Append-Combiner.DepthLimit <- i States <- Problem.InitState Solution = SearchFunction(States, Problem, LimDepth-Append-Combiner) If Solution != {} return Solution } 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich BFS States <- Problem.InitState Solution = SearchFunction(States, Problem, Prepend-Combiner) 1 2 3 4 5 6 7 8 9 10 11 12 13 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Discussion: DFS Vs. BFS DFS BFS Completeness   Optimality of Solution   Time complexity O(bd) O(bd) Space complexity O(bd) O(bd) Search in graphs?   25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Example: 9-number puzzle The numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9 must be put in the depicted square, in such a way that the sums of the numbers in each row, column, and diagonal are equal. Solution: 9 5 1 8 3 4 6 7 2 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Example: 9-number puzzle Problem representation Initial state: Empty board Successors: Put one of the missing numbers in an empty place Goal-p: Board is full, sums are equal, as required 5 6 1 2 … 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Example: 9-number puzzle Which search algorithm should we use? Note that the solution length is exactly 9 DFS with depth limit = 9 will find the solution and will use little memory (linear in solution depth) BFS will find the solution at depth 9, however will require a lot of memory (will eventually hold all the tree till depth 9 in memory) Iterative deepening DFS is unnecessary here, since we know the solution depth in advance. The solution will not be found at shallower depth. 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Example: LightzOut http://www.gamesgnome.com/logicpuzzles/lights/ http://games.hughesclan.com/lights/ http://javaboutique.internet.com/LightzOut/ 5x5 board Each cell can be “On” or “Off” Click on a cell inverts the states of its 4 neighbors The goal is to turn off the lights 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Example: LightzOut Click on the central cell Goal: 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Example: LightzOut Problem representation: Initial state: The board to solve Successors: Boards that are the result of a single click on the current board Goal-p: Empty board 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

LightzOut – solution example . . . . . . 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Example: LightzOut Which search algorithm should we use? Given a board, we cannot predict solution length! Note that if we are in state1, and click on the same cell twice, we return back to state1 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Example: LightzOut DFS with no restrictions might never find a solution for the problem – can get stuck in a loop Depth limited DFS can be used if we know the problem difficulty in advance Iterative deepening DFS is a good solution, especially when we do not know how difficult the problem is BFS? The branching factor is O(N2) BFS may be suitable for very simple problems For difficult problems, the memory amounts required for BFS are immense 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich

Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich Multiple Solutions Do not stop at the first solution MultGoal-SearchFunction (States, Problem, Combiner) { Solutions <- {} If States == {} return ‘Search Failed’ CurrState <- Get and remove first state in States if (Problem.Goal-p(CurrState) == true) Solutions <- Solutions + CurrState successors <- Problem.Succ(CurrState) States <-Combiner.combine(successors,States) SearchFunction(States, Problem, Combiner) } 25-Dec-18 Intro. to AI – Tutorial 1 – By Saher Esmeir & Nela Gurevich