Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called.

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

State Space Representation and Search
Problem Solving Well-formed predicate calculus expressions provide a means of describing objects and relations in a problem domain and inference rule.
CSC411Artificial Intelligence 1 Chapter 3 Structures and Strategies For Space State Search Contents Graph Theory Strategies for Space State Search Using.
PROBLEM SOLVING AND SEARCH
Iterative Deepening A* & Constraint Satisfaction Problems Lecture Module 6.
Formal Description of a Problem
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Part2 AI as Representation and Search
KU NLP Artificial Intelligence1 Ch 3. Structures and Strategies for State Space Search q Introduction q Graph Theory  Structures for state space search.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Structures and Strategies For Space State Search
CSC 423 ARTIFICIAL INTELLIGENCE
Lecture 3 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Best-First Search: Agendas
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.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
State-Space Searches. State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
Structures and Strategies for State Space Search
Structures and Strategies for State Space Search
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.
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?
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
Dr Eleni Mangina – COURSE: LOGIC PROGRAMMING (during a joint degree with Fudan University in Software Engineering) DEPT. OF COMPUTER SCIENCE UCD Problem.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Using Search in Problem Solving
Ch 13 – Backtracking + Branch-and-Bound
Structures and Strategies For Space State Search
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.
Backtracking.
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.
Solving Problems by Searching
State-Space Searches.
Brute Force Search Depth-first or Breadth-first search
1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called.
Problem solving.
Artificial Intelligence LECTURE 3 ARTIFICIAL INTELLIGENCE LECTURES BY ENGR. QAZI ZIA 1.
KU NLP Structures and Strategies for State Space Search Depth-First and Breadth-First Search q A search algorithm must determine the order in which.
Propositional Calculus Composed of symbols –P – some true statement P might represent something like “It is Monday” or “the car is red” And sentences –a.
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.
Chapter 2 Problems, Problem Spaces, and Search?
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
1 CS 385 Fall 2006 Chapter 3 Structures and Strategies for State Space Search.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
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.
Chapter 2 Problems, Problem Spaces, and Search?
1 Solving problems by searching 171, Class 2 Chapter 3.
Problem solving by search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
PROBLEM SOLVING – BASIC SEARCH METHODS 12/8/2015Dr. Sunil Kumar 1.
Algorithms April-May 2013 Dr. Youn-Hee Han The Project for the Establishing the Korea ㅡ Vietnam College of Technology in Bac Giang.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
1 Solving Problems by Searching. 2 Terminology State State Space Goal Action Cost State Change Function Problem-Solving Agent State-Space Search.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
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.
Chapter 13 Backtracking Introduction The 3-coloring problem
CSCE350 Algorithms and Data Structure Lecture 21 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
State space search Represented by a four-tuple [N,A,S,GD], where: N is the problem space A is the set of arcs (or links) between nodes. These correspond.
G5AIAI Introduction to AI
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
BackTracking CS255.
State-Space Searches.
State-Space Searches.
Chapter 2 Problems, Problem Spaces, and Search?
State-Space Searches.
Presentation transcript:

Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called a state thus, we use the term state space –an initial state –one or more goal states –a set of rules/operators which move the problem from one state to the next In some cases, we may enumerate all possible states (see monkey & banana problem on the next slide) –but usually, such an enumeration will be overwhelmingly large so we only generate a portion of the state space, the portion we are currently examining Powered by DeSiaMore1

The Monkey & Bananas Problem A monkey is in a cage and bananas are suspended from the ceiling, the monkey wants to eat a banana but cannot reach them –in the room are a chair and a stick –if the monkey stands on the chair and waves the stick, he can knock a banana down to eat it –what are the actions the monkey should take? Initial state: monkey on ground with empty hand bananas suspended Goal state: monkey eating Actions: climb chair/get off grab X wave X eat X Powered by DeSiaMore2

Missionaries and Cannibals 3 missionaries and 3 cannibals are on one side of the river with a boat that can take exactly 2 people across the river –how can we move the 3 missionaries and 3 cannibals across the river –with the constraint that the cannibals never outnumber the missionaries on either side of the river (lest the cannibals start eating the missionaries!)?? We can represent a state as a 6-item tuple: –(a, b, c, d, e, f) a/b = number of missionaries/cannibals on left shore c/d = number of missionaries/cannibals in boat e/f = number of missionaries/cannibals on right shore where a + b + c + d + e + f = 6 and a >= b unless a = 0, c >= d unless c = 0, and e >= f unless e = 0 Legal operations (moves) are –0, 1, 2 missionaries get into boat –0, 1, 2 missionaries get out of boat –0, 1, 2 cannibals get into boat –0, 1, 2 missionaries get out of boat –boat sails from left shore to right shore –boat sails from right shore to left shore drawing the state space will be left as a homework problem Powered by DeSiaMore3

Graphs/Trees We often visualize a state space (or a search space) as a graph –a tree is a special form of graph where every node has 1 parent and 0 to many children, in a graph, there is no parent/child relationship implied some problems will use trees, others can use graphs To the right is an example of representing a situation as a graph –on the top is the city of Konigsberg where there are 2 shores, 2 islands and 7 bridges the graph below shows the connectivity –the question asked in this problem was: is there a single path that takes you to both shores and islands and covers every bridge exactly once? by representing the problem as a graph, it is easier to solve the answer by the way is no, the graph has four nodes whose degree is an odd number, the problem, finding an Euler path, is only solvable if a graph has exactly 0 or 2 nodes whose degrees are odd Powered by DeSiaMore4

8 Puzzle The 8 puzzle search space consists of 8! states (40320) Powered by DeSiaMore5

Problem Characteristics Is the problem decomposable? –if yes, the problem becomes simpler to solve because each lesser problem can be tackled and the solutions combined together at the end Can solution steps be undone or ignored? –a game for instance often does not allow for steps to be undone (can you take back a chess move?) Is the problem’s universe predictable? –will applying the action result in the state we expect? for instance, in the monkey and banana problem, waving the stick on a chair does not guarantee that a banana will fall to the ground! Is a good solution absolute or relative? –for instance, do we care how many steps it took to get there? Is the desired solution a state or a path? –is the problem solved by knowing the steps, or reaching the goal? Is a large amount of knowledge absolutely required? Is problem solving interactive? Powered by DeSiaMore6

Search Given a problem expressed as a state space (whether explicitly or implicitly) –with operators/actions, an initial state and a goal state, how do we find the sequence of operators needed to solve the problem? –this requires search Formally, we define a search space as [N, A, S, GD] –N = set of nodes or states of a graph –A = set of arcs (edges) between nodes that correspond to the steps in the problem (the legal actions or operators) –S = a nonempty subset of N that represents start states –GD = a nonempty subset of N that represents goal states Our problem becomes one of traversing the graph from a node in S to a node in GD –we can use any of the numerous graph traversal techniques for this but in general, they divide into two categories: brute force – unguided search heuristic – guided search Powered by DeSiaMore7

Consequences of Search As shown a few slides back, the 8-puzzle has over different states –what about the 15 puzzle? A brute force search means trying all possible states blindly until you find the solution –for a state space for a problem requiring n moves where each move consists of m choices, there are 2 m*n possible states –two forms of brute force search are: depth first search, breath first search A guided search examines a state and uses some heuristic (usually a function) to determine how good that state is (how close you might be to a solution) to help determine what state to move to –hill climbing –best-first search –A/A* algorithm –Minimax While a good heuristic can reduce the complexity from 2 m*n to something tractable, there is no guarantee so any form of search is O(2 n ) in the worst case Powered by DeSiaMore8

Forward vs Backward Search The common form of reasoning starts with data and leads to conclusions –for instance, diagnosis is data-driven – given the patient symptoms, we work toward disease hypotheses we often think of this form of reasoning as “forward chaining” through rules Backward search reasons from goals to actions –Planning and design are often goal-driven “backward chaining” Powered by DeSiaMore9

Depth-first Search Starting at node A, our search gives us: A, B, E, K, S, L, T, F, M, C, G, N, H, O, P, U, D, I, Q, J, R Powered by DeSiaMore10

Depth-first Search Example Powered by DeSiaMore11

Traveling Salesman Problem Powered by DeSiaMore12

Breadth-First Search Starting at node A, our search would generate the nodes in alphabetical order from A to U Powered by DeSiaMore13

Breadth-First Search Example Powered by DeSiaMore14

DFS with Iterative Deepening We might assume that most solutions to a given problem are toward the bottom of the state space –the DFS then is superior because it reaches the lower levels much more rapidly –however, DFS can get “lost” in the lower levels, spending too much time on solutions that are very similar An alternative is to use DFS but with iterative deepening –here, we continue to go down the same branch until we reach some pre-specified maximum depth this depth may be set because we suspect a solution to exist somewhere around that location, or because of time constraints, or some other factor –once that depth has been reached, continue the search at that level in a breadth-first manner see figure 3.19 on page 105 for an example of the 8-puzzle with a depth bound at 5 Powered by DeSiaMore15

Backtracking Search Algorithm Powered by DeSiaMore16

8 Queens Can you place 8 queens on a chess board such that no queen can capture another? –uses a recursive algorithm with backtracking –the more general problem is the N-queens problem (N queens on an NxN chess board) solve(board, col, row) if col = n then return true; // success else row = 0; placed = false; while(row < n && !placed) board[row][col] = true // place the queen if(cannotCapture(board, col)) placed = true else board[row][col] = false; row++ if(row = n) col--; placed = false; row = 0; // backtrack Powered by DeSiaMore17

And/Or Graphs To this point in our consideration of search spaces, a single state (or the path to that state) represents a solution –in some problems, a solution is a combination of states or a combination of paths –we pursue a single path, until we reach a dead end in which case we backtrack, or we find the solution (or we run out of possibilities if no solution exists) –so our state space is an Or graph – every different branch is a different solution, only one of which is required to solve the problem However, some problems can be decomposed into subproblems where each subproblem must be solved –consider for instance integrating some complex function which can be handled by integration by parts –such as state space would comprise an And/Or graph where a path may lead to a solution, but another path may have multiple subpaths, all of which must lead to solutions Powered by DeSiaMore18

And/Or Graphs as Search Spaces Integration by parts, as used in the MACSYMA expert system – if we use the middle branch, we must solve all 3 parts (in the final row) Our Financial Advisor system from chapter 2 – each possible investment solution requires proving 3 things Powered by DeSiaMore19

Goal-driven Example: Find Fred Powered by DeSiaMore20

Solution We want to know location(fred, Y) As a goal-driven problem, we start with this and find a rule that can conclude location(X, Y), which is rule 7, 8 or 9 Rule 8 will fail because we cannot prove warm(Saturday) Rule 9 is applied since day(saturday) is true and ~warm(saturday) is true Rule 9’s conclusion is that sam is in the museum Rule 7 tells us that fred is with his master, sam, so fred is in the museum Powered by DeSiaMore21

Data-driven Example: Parsing We wrap up this chapter by considering an example of syntactically parsing an English sentence –we have the following five rules: sentence  np vp np  n np  art n vp  v vp  v np –n is noun man or dog –v is verb likes or bites –Art is article a or the Parse the following sentence: –The dog bites the man. Powered by DeSiaMore22