L2. Problem Solving Using Search

Slides:



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

Solving problems by searching
Announcements Course TA: Danny Kumar
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Search: Representation and General Search Procedure CPSC 322 – Search 1 January 12, 2011 Textbook § 3.0 –
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Intelligent agents Intelligent agents are supposed to act in such a way that the environment goes through a sequence of states that maximizes the performance.
Structures and Strategies for State Space Search
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?
Intelligent agents Intelligent agents are supposed to act in such a way that the environment goes through a sequence of states that maximizes the performance.
Solving problems by searching
1 Structures and Strategies for State Space Search 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
Search  Exhaustive/Blind Search Methods Depth First Search Breadth First Search  Heuristic Methods Hill Climbing Beam Search Best First Search…
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.
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.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
WAES 3308 Numerical Methods for AI
L5: Searching Program in Java Breadth-first search vs depth-first search.
1 Review of search strategies Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Review of search strategies Decisions in games Minimax.
1 Solving problems by searching 171, Class 2 Chapter 3.
1 PAGE of designing an agent Problem types Search Strategies PAGE of designing an agent Problem types Search Strategies.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
Artificial Intelligence
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.
Artificial Intelligence Lecture No. 6 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
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.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Solving problems by searching Chapter 3. Types of agents Reflex agent Consider how the world IS Choose action based on current percept Do not consider.
ARTIFICIAL INTELLIGENCE
Solving problems by searching
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Last time: Problem-Solving
ECE 448 Lecture 4: Search Intro
Introduction to Artificial Intelligence
Artificial Intelligence Lecture No. 6
Problem Solving by Searching
Problem Solving as Search
Artificial Intelligence
Solving problems by searching
CSE 4705 Artificial Intelligence
Problem Solving and Searching
Searching for Solutions
Artificial Intelligence
Problem Solving and Searching
Solving problems by searching
Solving problems by searching
Tree Searching.
Tree Searching.
Tree Searching.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
State-Space Searches.
ARTIFICIAL INTELLIGENCE
State-Space Searches.
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #2
Solving problems by searching
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
State-Space Searches.
Solving Problems by Searching
CS440/ECE 448 Lecture 4: Search Intro
Solving problems by searching
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

L2. Problem Solving Using Search PAGE of designing an agent Problem types Problem formulation Search Strategies

PAGE: Percepts, Actions, Goals, Environment Sensors:eyes, camera, … percepts environment agent actions Effectors:hands, motors, … Fig1. A generic agent diagram e.g. Percepts cameras, speedometer, GPS, sonar Actions steer, accelerate, brake Goals safely to destination Environment traffic light, other traffic, pedestrians, in Japan Fig 1. The taxi driver agent and its PAGE description

More e.g.: Vacuum-clearning Agent Percepts touch sensor, photo sensor, infrared sensor go forward, turn right by 90o,turn left by 90o, such up dirt, and turn off Actions Goals clean up the room A grid of squares that may have obstacles (wall or furniture), dirt, or may be open space (having nothing) Environment Fig 2. The Vacuum-cleaning agent and its PAGE description Notes: Touch sensor is to check if the machine has bumped into something. Photo sensor is to check if there is dirt there. Infrared sensor is to check if the agent is in its home location.

Problem types Deterministic, accessible => single-state problem The agent sensors give it enough information to tell exactly which state it is in. technique  search Deterministic, inaccessible => multiple-state problem The agent knows all the effects of its actions but has limited access to the world state so that it must reason about sets of states that it might get to. Nondeterministic, inaccessible => Contingency problem There is no fixed action sequence that guarantees a solution to the problem. It must sensors during execution. solution is a tree or policy, not a single sequence of actions. techniques: interleave search + execution Unknown state space => exploration problem The agent must experiment, gradually discovering what its actions do and what sorts of states exist. techniques: experiment + discovery more knowledge less

Define a problem A problem is defined by four items: initial state: The world initial state. operators: A set of possible actions. goal-test: To check if it reaches goal state or states. path-cost-fucntion: It is the sum of cost of the individual actions along the path, which is from one state to another. Notes: State space is the set of all states reachable from the initial state by any sequence of actions. Solution is a path (a sequence of operators) from the initial state to a state that satisfies the goal test. ? How to find a solution? search

? Some examples - e.g. 1 5 4 1 2 3 6 1 8 8 4 7 3 2 7 6 5 The 8-puzzle Start state Goal state state: the location of each of the eight tiles in one of the nine squares. operators: blank tile moves left, right, up, or down. goal-test: state matches the goal state. path-cost-fucntion: each step costs 1so the total cost is the length of the path. ? Can you write a Java program that can find a solution, i.e. path from the initial state to the goal state?

? Some examples – e.g. 2 The vacuum world: 2 squares 1 3 5 7 dirt 2 4 6 8 state: one of the eight states above. operators: move left, move right, suck. goal-test: no dirt left in any square. path-cost-fucntion: each action costs 1. Can you write a Java program that can find a solution, i.e. path from any initial state to the goal state? ?

Breath-first search The algorithm follows: The breadth-first search algorithm searches a state space by constructing a hierarchical tree structure consisting of a set of nodes and links. The algorithm defines a way to move through the tree structure, examining the value at nodes. From the start, it looks at each node one edge away. Then it moves out from those nodes to all two edges away from the start. This continues until either the goal node is found or the entire tree is searched. The algorithm follows: Create a queue and add the first node to it. Loop: If the queue is empty, quit. Remove the first node from the queue. If the node contains the goal state, then exit with the node as the solution. For each child of the current node: add the new state to the back of the queue.

An example of breadth-first search: Rochester  Wausau InternationalFalls GrandForks Bemidji Duluth Fargo GreenBay Minneapolis St.Cloud Wausau LaCrosse Madison Milwaukee Rochester Sioux Dubuque Rockford Chicago [Rochester]->[Sioux Falls, Minneapolis, LaCrosse, Dubuque]->[Minneapolis, LaCrosse, Dubuque, Frago, Rochester]-> [LaCrosse, Dubuque, Frago, Rochester, St.Cloud, Duluth, Wausau, LaCrosse, Rochester]->……(after 5 goal test and expansion) -> [Wausau, LaCrosse, Rochester, Minneapolis, GreenBay, ……] Finally, we get to Wausau, the goal test succeeds.

A demo Source code for your reference public SearchNode breadthFirstSearch(SearchNode initialNode, Object goalState) { Vector queue = new Vector() ; queue.addElement(initialNode) ; initialNode.setTested(true) ; // test each node once while (queue.size()> 0) { SearchNode testNode = (SearchNode)queue.firstElement() ; queue.removeElementAt(0) ; testNode.trace() ; if (testNode.state.equals(goalState)) return testNode ; // found it if (!testNode.expanded) { testNode.expand(queue,SearchNode.BACK) ; } return null ;

Depth-first search The algorithm follows: The depth-first algorithm follows a single branch of the tree down as many levels as possible until we either reach a solution or a dead end. It searches from the start or root node all the way down to a leaf node. If it does not find the goal node, it backtracks up the tree and searches down the next untested path until it reaches the next leaf. The algorithm follows: Create a queue and add the first node to it. Loop: If the queue is empty, quit. Remove the first node from the queue. If the node contains the goal state, then exit with the node as the solution. For each child of the current node: add the new state to the front of the queue.

An example of depth-first search: Rochester  Wausau InternationalFalls GrandForks Bemidji Duluth Fargo GreenBay Minneapolis St.Cloud Wausau LaCrosse Madison Milwaukee Rochester Sioux Dubuque Rockford Chicago [Rochester]->[Dubuque, LaCrosse, Minneapolis, Sioux Falls]->[Rockford, LaCrosse, Rochester,LaCrosse, Minneapolis, Sioux Falls]-> …… (after 3 goal test and expansion) -> [GreenBay, Madison, Chicago, Rockford, Chicago, Madison, Dubuque, LaCrosse, Rochester,LaCrosse, Minneapolis, Sioux Falls] We remove GreenBay and add Milwaukee, LaCrosse, and Wausau to the queue in that order. Finally, we get to Wausau, at the front of the queue and the goal test succeeds.

A demo Source code for your reference public SearchNode depthFirstSearch(SearchNode initialNode, Object goalState) { Vector queue = new Vector() ; queue.addElement(initialNode) ; initialNode.setTested(true) ; // test each node once while (queue.size()> 0) { SearchNode testNode = (SearchNode)queue.firstElement() ; queue.removeElementAt(0) ; testNode.trace() ; // display trace information if (testNode.state.equals(goalState)) return testNode ; // found it if (!testNode.expanded) { testNode.expand(queue,SearchNode.FRONT); } return null ;