Introduction to Artificial Intelligence

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
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
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.
CSC 423 ARTIFICIAL INTELLIGENCE
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
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 and Search in AI Part I Search and Intelligence Search is one of the most powerful approaches to problem solving in AI Search is a universal.
A RTIFICIAL I NTELLIGENCE Problem-Solving Solving problems by searching.
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.
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Russell & Norvig Chapter 3]
Artificial Intelligence Chapter 3: Solving Problems by Searching
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?
Problem-solving agents
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.
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
Artificial Intelligence Course outline Introduction Problem solving Generic algorithms Knowledge Representation and Reasoning Expert Systems Uncertainty.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
Chapter 2 Problems, Problem Spaces, and Search?
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Chapter 2 Problems, Problem Spaces, and Search?
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
1 Solving problems by searching 171, Class 2 Chapter 3.
A General Introduction to Artificial Intelligence.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
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
ARTIFICIAL INTELLIGENCE
Solving problems by searching
Problem Solving Agents
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
ECE 448 Lecture 4: Search Intro
Artificial Intelligence Lecture No. 6
Uninformed Search Chapter 3.4.
Problem Solving by Searching
Problem Solving as Search
Artificial Intelligence (CS 370D)
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
Artificial Intelligence
Search Tuomas Sandholm Read Russell & Norvig Sections
Solving problems by searching
Search Tuomas Sandholm Read Russell & Norvig Sections
SOLVING PROBLEMS BY SEARCHING
Problem Solving and Searching
Searching for Solutions
Artificial Intelligence
Problem Solving and Searching
CS 2710, ISSP 2160 Foundations of Artificial Intelligence
Russell and Norvig: Chapter 3, Sections 3.1 – 3.3
Chap 4: Searching Techniques
Solving problems by searching
Solving problems by searching
ARTIFICIAL INTELLIGENCE
Solving problems by searching
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Chapter 2 Problems, Problem Spaces, and Search?
Solving Problems by Searching
Solving problems by searching
Presentation transcript:

Introduction to Artificial Intelligence Lecture # 5

Problems, Problems Spaces and Search

To build a system to solve a problem Define the problem precisely. Analyze the problem. Isolate and represent the task knowledge that is necessary to solve the problem. Choose the best problem-solving techniques and apply it to the particular problem.

Defining a Problem as State Space Search A problem can be solved by examining the steps which might be taken towards its solution. Each action takes the solver to a new state. A typical problem is when the agent is in one state, it has a set of deterministic actions it can carry out, and wants to get to a goal state. State Space: the set of all states reachable from the initial state by any sequence of actions.

Well-Defined Problems problems with a readily available formal specification initial state starting point from which the agent sets out actions (operators, successor functions) describe the set of possible actions state space set of all states reachable from the initial state by any sequence of actions path sequence of actions leading from one state in the state space to another goal test determines if a given state is the goal state

Well-Defined Problems (cont.) solution path from the initial state to a goal state search cost time and memory required to calculate a solution path cost determines the expenses of the agent for executing the actions in a path sum of the costs of the individual actions in a path total cost sum of search cost and path cost overall cost for finding a solution

Defining a Problem as State Space Search The classic example is of the Farmer who needs to transport a Goose, a Fox and some Grain across a river one at a time. The Fox will eat the Goose if left unsupervised. Likewise the Goose will eat the Grain. In this case, the State is described by the positions of the Farmer, Goose, Fox and Grain. The solver can move between States by making a legal move. Non-legal moves are not worth examining.( Cannot take the two together)

Example

Performing a State Space Search State space search involves finding a path from the initial state of a search problem to a goal state. To do this, we build a search graph, starting from the initial state (or the goal state) We expand a state by applying the search operators to that state, generating ALL of its successor states. These successors are in the next level down of the search graph The order in which we choose states for expansion is determined by the search strategy Different strategies result in (sometimes masively) different behaviour KEY CONCEPT: We want to find the solution while realizing in memory as few as possible of the nodes in the search space.

State Space Search Measuring effectiveness/performance: Does the method find a solution at all? Is it a good solution (low path cost) What is the search cost? The total cost is the sum of the search cost and the path cost (which may not be commensurate!) the search cost--how long the agent takes to come up with the solution to the problem, and the path cost--how expensive the actions in the solution are. The total cost of the solution is the sum of the above two quantities.

Example Problems toy problems real-world problems vacuum world 8-puzzle 8-queens cryptarithmetic vacuum agent missionaries and cannibals real-world problems route finding touring problems traveling salesperson VLSI layout robot navigation assembly sequencing Web search

State Space

Structure of a State Space

State Space Graph versus Search Trees

State Space Graph versus Search Trees

Trees and Graphs

The travelling salesman problem, an example

The travelling salesman problem, an example

Production System A production system (or production rule system) is a computer program typically used to provide some form of artificial intelligence, which consists primarily of a set of rules about behavior. These rules, termed productions, are a basic representation found useful in automated planning, expert systems and action selection. A production system provides the mechanism necessary to execute productions in order to achieve some goal for the system.

Production system Collection of states – Start (or initial) state. – Goal state or states). Collection of productions: rules or moves p - Each production may have preconditions. Control system: decides which production to apply next

Formal Description of the problem Define a state space that contains all the possible configurations of the relevant objects. Specify one or more states within that space that describe possible situations from which the problem solving process may start ( initial state) Specify one or more states that would be acceptable as solutions to the problem. ( goal states) Specify a set of rules that describe the actions ( operations) available.

Water Jug Problem

State Space Search: Water Jug Problem State: (x, y) x = 0, 1, 2, 3, or 4 y = 0, 1, 2, 3 Start state: (0, 0). Goal state: (2, n) for any n. Attempting to end up in a goal state.

Production rules for Water Jug Problem

Water Jug Problem Through Graph Search, the following solution is found :

Problem: Sort a string Input: a string, e.g., cbaca Output: the sorted string, aabcc Write a program to sort a string. What are the space and time complexities? Instead of a programming language, use production system to solve this problem. No program to write.

Production system: example

Example: The 8-puzzle states? actions? goal test? path cost? [Note: optimal solution of n-Puzzle family is NP-hard]

8-Puzzle states initial state successor function (operators) goal test location of tiles (including blank tile) initial state any legitimate configuration successor function (operators) move tile alternatively: move blank goal test any legitimate configuration of tiles path cost one unit per move Properties: abstraction leads to discrete configurations, discrete moves, deterministic 9!/2 = 181,440 reachable states

Search tree for 8-puzzle

Example: n-queens Put n queens on an n × n board with no two queens on the same row, column, or diagonal

8-Queens incremental formulation complete-state formulation states arrangement of up to 8 queens on the board initial state empty board successor function (operators) add a queen to any square goal test all queens on board no queen attacked path cost irrelevant (all solutions equally valid) Properties: 3*1014 possible sequences; can be reduced to 2,057 complete-state formulation states arrangement of 8 queens on the board initial state all 8 queens on board successor function (operators) move a queen to a different square goal test no queen attacked path cost irrelevant (all solutions equally valid) Properties: good strategies can reduce the number of possible sequences considerably

Control Strategies How to decide which rule to apply next during the process of searching for a solution to a problem? Requirements of good control strategy It causes motion Otherwise, it will never lead to a solution. 2. It is systematic Otherwise, it may use more steps than necessary. 3. It is efficient Find a good, but not necessarily the best, answer.

Search Strategies 1. Uninformed search (blind search) Having no information about the number of steps from the current state to the goal.(e.g. breadth first search, depth first search) 2. Informed search (heuristic search) More efficient than uninformed search.

Uninformed Search Strategies Uninformed Search : strategies that order nodes without using any domain specific information, i.e., don’t use any information stored in a state BFS: breadth-first search – Queue (FIFO) used for the Frontier list – remove from front, add to back DFS: depth-first search – Stack (LIFO) used for the Frontier list – remove from front, add to front

Breadth-first search Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on. In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded.

Breadth-first search Expand the shallowest node first: 1. Examine states one step away from the initial states 2. Examine states two steps away from the initial states 3. and so on

Breadth First Search

Another Example

Breadth-First Search Example

Advantages of BFS BFS will not get trapped exploring a blind alley. If there is a solution, BFS is guaranteed to find it. If there are multiple solutions, then a minimal solution will be found.

Depth First Search A depth-first search (DFS) explores a path all the way to a leaf before backtracking and exploring another path The deepest node is expanded first Backtrack when the path cannot be further expanded

Depth First Search

Algorithm: Depth First Search If the initial state is a goal state, quit and return success Otherwise, do the following until success or failure is signaled: Generate a successor, E, of initial state. If there are no more successors, signal failure. Call Depth-First Search, with E as the initial state If success is returned, signal success. Otherwise continue in this loop.

Depth First Search

Depth First Search

And so on… till the last node

Backtracking We pursue a single branch of the tree until it yields a solution or until a decision to terminate the path is made. It makes sense to terminate a path if it reaches dead-end, produces a previous state. In such a state backtracking occurs Chronological Backtracking: Order in which steps are undone depends only on the temporal sequence in which steps were initially made. Specifically most recent step is always the first to be undone. This is also simple backtracking.

Depth-first Search Example

Advantages of Depth-First Search DFS requires less memory since only the nodes on the current path are stored. By chance, DFS may find a solution without examining much of the search space at all.

Search Strategies

For BFS

For DFS

Breadth First Search Vs Depth First Search

END OF LECTURE # 5