Using Search in Problem Solving

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Heuristic Search techniques
PROBLEM SOLVING AND SEARCH
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.
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
1 Tree Searching Strategies Updated: 2010/12/27. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these.
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Search in AI.
Artificial Intelligence Lecture
Review: Search problem formulation
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Using Search in Problem Solving
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Informed Search CSE 473 University of Washington.
Using Search in Problem Solving
Graphs & Graph Algorithms Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
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.
Solving problems by searching
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Search  Exhaustive/Blind Search Methods Depth First Search Breadth First Search  Heuristic Methods Hill Climbing Beam Search Best First Search…
Problem-solving agents
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.
Informed Search Idea: be smart about what paths to try.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed Search Strategies
Problem Solving and Search Andrea Danyluk September 11, 2013.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Tree Searching Breadth First Search Dept First Search.
GRAPHS
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.
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.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
Lecture 7: Uninformed Search Dr John Levine Algorithms and Complexity February 13th 2006.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
COMP261 Lecture 6 Dijkstra’s Algorithm. Connectedness Is this graph connected or not? A Z FF C M N B Y BB S P DDGG AA R F G J L EE CC Q O V D T H W E.
Search exploring the consequences of possible actions.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
Informed Search CSE 473 University of Washington.
COSC 2007 Data Structures II
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Searching for Solutions
Graphs Upon completion you will be able to:
Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.
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: Uninformed Search
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
Graphs Chapter 11 Objectives Upon completion you will be able to:
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Informed Search Idea: be smart about what paths to try.
Lecture 4: Tree Search Strategies
Presentation transcript:

Using Search in Problem Solving Part I

Basic Concepts Initial state Goal/Target state Intermediate states Path from the initial to the target state Operators/rules to get from one state to another All states - search space We search for a path / sequence of operators to go from the initial state to the goal state

Initial state Target state

Search Space Search problems can be represented as graphs, where the nodes are states and the arcs correspond to operations. The set of all states: search space

Graphs and Trees 1 Graph: a set of nodes (vertices) with links (edges) between them. A link is represented usually as a pair of nodes, connected by the link. Undirected graphs: the links do not have orientation Directed graphs: the links have orientation

Graphs and Trees 2 Path: Sequence of nodes such that each two neighbors represent an edge Cycle: a path with the first node equal to the last and no other nodes are repeated Acyclic graph: a graph without cycles Tree: undirected acyclic graph, where one node is chosen to be the root

Graphs and Trees 3 Given a graph and a node: Out-going edges: all edges that start in that node In-coming edges : all edges that end up in that node Successors (Children): the end nodes of all out-going edges Ancestors (Parents): the nodes that are start points of in-coming edges

G1: Undirected graph Path: ABDCAE Cycle: CABEC Successors of A: E, C, B Parents of A: E, C, B

G2: Directed graph Path: ABDC Cycle: no cycles Successors of A: C, B Parent of A: E

Search Trees More solutions: More than one path from the initial state to a goal state Different paths may have common arcs The search process can be represented by a search tree In the search tree the different solutions will be represented as different paths from the initial state One and the same state may be represented by different nodes

Search methods Basic (uninformed, blind, exhaustive): breadth-first depth-first Heuristic (informed): hill climbing best-first A*

Breadth-First Search Algorithm: using a queue 1. Queue = [initial_node] , FOUND = False 2. While queue not empty and FOUND = False do: Remove the first node N If N = target node then FOUND = true Else find all successor nodes of N and put them into the queue. In essence this is Dijkstra's algorithm of finding the shortest path between two nodes in a graph.

Depth-first search Algorithm: using a stack 1. Stack = [initial_node] , FOUND = False 2. While stack not empty and FOUND = False do: Remove the top node N If N = target node then FOUND = true Else find all successor nodes of N and put them onto the stack.

Comparison of depth-first and breadth-first search Breadth-first: without backtracking Depth-first : backtracking. Length of path: breadth-first finds the shortest path first. Memory: depth-first uses less memory Time: If the solution is on a short path - breadth first is better, if the path is long - depth first is better.

Heuristic Search Heuristic search is used to reduce the search space. Basic idea: explore only promising states/paths. We need an evaluation function to estimate each state/path.

Hill climbing Basic idea: always head towards a state which is better than the current one. There is no exhaustive search, so no node list is maintained.

Hill Climbing - Algorithm Start with current-state = initial-state. Until current-state = goal-state OR there is no change in current-state do: Get the successors of the current state and use the evaluation function to assign a score to each successor. If one of the successors has a better score than the current-state then set the new current-state to be the successor with the best score.

Hill Climbing Node list is not maintained No problems with loops since we move to a better node If a solution is found, it is found for a very short time with minimal memory requirements Finding a solution is not guaranteed – the local maxima problem

Best First Search The node with the best score is chosen to be expanded. Works in breadth-first manner, keeps a data structure (called agenda, based on priority queues) of all successors and their scores. If a node that has been chosen does not lead to a solution, the next "best" node is chosen, so eventually the solution is found Always finds a solution, not guaranteed to be the optimal one.

Best First Search Algorithm 1. Start with agenda = [initial-state]. 2. While agenda is not empty do A. Pick the best node on agenda. B. If it is the goal node then return with success. Otherwise find its successors. C. Assign the successor nodes a score using the evaluation function and add the scored nodes to the agenda

Comparison with hill-climbing Similarities: best-first always chooses the best node Difference: best-first search keeps an agenda as in breadth-first search, and in case of a dead end it will backtrack, choosing the next-best node.

The A* Algorithm An evaluation function that accounts for - the cost of the paths - the score of the nodes F(Node) = g(Node) + h(Node) g(Node) - the costs from the initial state to the current node h(Node) - future costs, i.e. node score Disadvantage of A* is the memory requirement - the algorithm keeps records for the entire tree.

The A* Algorithm A* always finds the best solution, provided that h(Node) does not overestimate the future costs.

Example Start: A Goal: G 10 7 8 4 6 9 2 A B: 9 D : 10 F : 6 H : 5 C: 8 K: 5 G: 0 J: 4 Start: A Goal: G