160 likes | 261 Views
Advanced Higher Computing Based on Heriot-Watt University Scholar Materials. Problem abstraction and symbolic representation. Lesson Objectives. Problem Abstraction Symbolic Representation Graphs (tree, state space, AND/OR) Searching. Stages of Problem Solving in AI. Problem abstraction
E N D
Advanced Higher ComputingBased on Heriot-Watt University Scholar Materials Problem abstraction and symbolic representation Alford Academy Business Education and Computing
Lesson Objectives Problem Abstraction Symbolic Representation Graphs (tree, state space, AND/OR) Searching Alford Academy Business Education and Computing
Stages of Problem Solving in AI • Problem abstraction • Symbolic Representation • Search Technique Alford Academy Business Education and Computing
Problem Abstraction • Problem abstraction is the process of defining the problem clearly and unambiguously. • This includes defining the initial or start state, defining the goal or end state, and • defining the constraints that apply. Alford Academy Business Education and Computing
Chess Example • Start state - initial layout of the 32 chess pieces on the board - represented in the computer as a 2-dimensional array? • The end or goal state - definition of the end of a game eg the loser’s King unable to escape, or player has ’resigned’. • Constraints would be the rules of chess Alford Academy Business Education and Computing
Symbolic Representation • Consider the transitional states, all the possible positions between the start and goal • How do these states relate to each other? • Chess has a virtually infinite number of transitional states - Combinatorial explosion Alford Academy Business Education and Computing
Methods of Representation 1. State Space graphs 2. Trees 3. AND/OR graphs 4. Production Rules Each method has advantages and disadvantages Alford Academy Business Education and Computing
Search Technique • Breadth • Depth • Heuristic Alford Academy Business Education and Computing
Example Problem - Matches • Problem Abstraction • Start state - shown in diagram • Goal state – move matches to form 3 equal piles • Constraints - a. any move must double the number • of matches in the destination pile; • b. no move may result in a pile ending • up with 0 matches. Symbolic representation Start state represented as: (11,7,6) with rules 1. move matches from the left pile to the middle pile (LtoM); 2. move matches from the left pile to the right pile (LtoR); 3. move matches from the middle pile to the left pile (MtoL); 4. move matches from the middle pile to the right pile (MtoR); 5. move matches from the right pile to the left pile (RtoL); 6. move matches from the right pile to the middle pile (RtoM). Alford Academy Business Education and Computing
Matches – creating search tree • Establish root node – start state • Apply legal moves to generate descendents • Repeat until goal state is reached Alford Academy Business Education and Computing
Example problem – Rearranging blocks • Problem Abstraction • Start state - shown in diagram • Goal state – rearrange to produce new stack • Constraints – • a. Only one block may move at a time • b. Place block on table or on top of • another block Symbolic representation Alford Academy Business Education and Computing
Blocks – creating state space graph • Similar to search tree but: • it has no single root node • there are ’cross branches’ • some (in this case, all) of the arrows are • bi-directional Alford Academy Business Education and Computing
Trees and Graphs Can convert a tree to a graph replacing the two identical (2 4 6) nodes with a single node Alford Academy Business Education and Computing
Classic AI Problems • Route finding/travelling salesman Alford Academy Business Education and Computing
AND/OR Graphs Previous trees and graphs have OR branches - can go down one branch or down one of the others. Certain problems can be split into independent sub-problems and represented with AND branches -shown with an arc joining the branch lines. Start (S), finish (F) and intermediate point (I) Split the problem of finding routes from S to F into the sub-problems of finding routes from S to I and from I to F. Example – finding routes between start and finish points that must go through some intermediate point or points. Alford Academy Business Education and Computing
AND/OR graph representation Alford Academy Business Education and Computing