# Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Problem abstraction and symbolic.

## Presentation on theme: "Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Problem abstraction and symbolic."— Presentation transcript:

Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Problem abstraction and symbolic representation

Alford Academy Business Education and Computing2 Lesson Objectives Problem Abstraction Symbolic Representation Graphs (tree, state space, AND/OR) Searching

Alford Academy Business Education and Computing 3 Stages of Problem Solving in AI 1. Problem abstraction 1. Symbolic Representation 1. Search Technique

Alford Academy Business Education and Computing 4 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 5 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 6 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 7 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 9 Example Problem - Matches Problem Abstraction 1.Start state - shown in diagram 2.Goal state – move matches to form 3 equal piles 3. 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 10 Matches – creating search tree 1.Establish root node – start state 2.Apply legal moves to generate descendents 3.Repeat until goal state is reached

Alford Academy Business Education and Computing 11 Example problem – Rearranging blocks Problem Abstraction 1.Start state - shown in diagram 2.Goal state – rearrange to produce new stack 3. 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 12 Blocks – creating state space graph Similar to search tree but: 1. it has no single root node 2. there are ’cross branches’ 3. some (in this case, all) of the arrows are bi-directional

Alford Academy Business Education and Computing 13 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 14 Classic AI Problems Route finding/travelling salesman

Alford Academy Business Education and Computing 15 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. Example – finding routes between start and finish points that must go through some intermediate point or points. 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.