Document Sample

Introduction to Artificial Intelligence Dr. Osama fathy Problems, Problem space and Search Some AI task Domains Mundane tasks: Natural language: generation, understanding, translation,… Perception: vision, smelling, hearing, …… Robot control Commonsense reasoning: is a reasoning about physical object and their relation ships to each other , reasoning about actions and reaction 3 Some AI task Domains Formal tasks: Math : logic, geometry, integral calculus,….. , Games : chess, checkers, backgammon, …….. Expert tasks: Engineering: design, fault finding manufacturing planning Analysis: Scientific, Military, Medical, Financial ……. 4 AI What AI can do? Intelligence systems can help experts to solve difficult analysis problems (military, financial, ..) Intelligence systems can help to design new devices (car's, airplane, ……….) Intelligence systems can learn from examples (artificial neural networks , expert sys's) Intelligence systems can provide answer to English questions using both structured data and free text (Asimo. politic, ……) 5 Script problem Draw a script (is a structure that represents the system's knowledge about a subject) of shopping text. Then, write an algorithm to solve the questions. 6 Script problem Mary went to store. Mary went shopping for a new coat. Mary walked up to sales person. She asked her if she needed any help. She asked where the coat department. She found a red one she really liked. When she got it home, she discovered that it went perfectly with here favorite dress 7 Script problem Q1: What did Mary go shopping for? Q2: What did Mary find that she liked? Q3: Did Mary buy any thing? 8 Solution 1. Arrange actions Time. 2. Coding: C……...customer S………store P………sales person M….......merchandize D………money R………color T…….…department 9 1- C enter S 3. Script: 2- C looking around 3- C looks for a specific M 4- C looks for interesting M 5- C ask P for help 6- 7- C find M 8- C fails to find M 9- C buy m 10- C leaves s 11- C leaves s 12- C go to step 2 13- C takes M 14- C leaves S 10 4. Algorithms: 11 Assignment-2: Prepare two different texts about two different subjects, and three questions about each one then: ►Draw a script for each one ► Write an algorithm to solve the questions for each one Note: Last date to receipt (hard & soft copy the assignments, next -------------- 12 Problem representation State space representation: States. Operators. Initial and goal states. Problem reduction representation: Initial problem description. Set of operators for transforming problems to sub problems. Set of primitive problem description. Game tree. 13 A-State space representation: Define the state space that contain all the possible configurations of the relevant objects. Specify one or more states within that space from which the problem solving process will start (initial states). Specify one or more states that would be acceptable as solution to the problem (goal state). Specify a set of rules that describe the actions (operators) available. 14 Example: Water Jug Problem: You are given to jugs 4-gallon one and 3-gallon one, neither has measuring markers on it. There is a pump that can be used to fill the jugs with water. How can you get exactly 2-gallon of water into the 4-gallon jug? 4-G 3-G 15 In order to solve the problem: Define the problem state space including the start and the goal states and a set of operators for moving in that space. The problem can then be solved by searching for a path through the space from the initial state to the goal state, So the process of search is fundamental to the problem solving process. Examples of basic search techniques: Breadth-first search. Depth-first search. 16 Example: Water Jug Problem Solution: State Space: order pairs of integers (x, y) such that x = 0, 1, 2, 3, 4 and y = 0, 1, 2, 3. Start state: is (0, 0). Goal state: is (2, n) for any value of n. 17 Example: Water Jug Problem Operators: # Current New Condition Description State State 1 (x, y) (4, y) x<4 Fill 4-G jug 2 (x, y) (x, 3) y<3 Fill 3-G jug 3 (x, y) (x-d, y) x>0 Pour some water from the 4-G jug 4 (x, y) (x, y-d) y>0 Pour some water from the 3-G jug 18 Example: Water Jug Problem # Current New Condition Description State State 5 (x, y) (0, y) x>0 Empty the 4-G jug on the ground 6 (x, y) (x, 0) y>0 Empty the 3-G jug on the ground 7 (x, y) (4,y-(4-x)) x+y≥4 & pour water from y>0 3-G jug into 4-G jug until it is full 19 Example: Water Jug Problem # Current New Condition Description State State 8 (x, y) (x-(3-y),3) x+y≥3 & pour water from x>0 4-G jug into 3-G jug until it is full 9 (x, y) (x+y,0) x+y≤4 & pour all the water y>0 from 3-G jug into 4-G jug 10 (x, y) (0, x+y) x+y≤3 & pour all the water x>0 from 4-G jug into 3-G jug 20 Example: Water Jug Problem Tree: (0,0) (4,0) (0,3) (4,3) (0,0) (1,3) (4,3) (0,0) (3,0) (0,3) (1,0) (4,0) (4,3) (2,0) (2,3) 21 Example: travel salesman problem A sales man has a list of cites, each of which he must visit once. There are direct roads between each pair of cites. Find the route the salesman should follow for the shortest possible round trip. S,G 22 Example: travel salesman problem State space for the problem: A simple control structure solve the problem so it will simply explore all paths in the tree and return the shortest one. If there are N cites, the number of different paths among them is (N-1)! if N= 10 cites, then different paths = 9!=362880 So, the time required to perform this search is proportional to N! if N= 10 cites, then time = 10!=3628800 which is very large 23 Example: travel salesman problem A AB AC AD ABC ABD ACB ACD ADB ADC ABCD ABDC ACBD ACDB ADBC ADCB A B N= 4 cites, then different paths = 3!=6 D C 24 Problem representation State space representation: States. Operators. Initial and goal states. Problem reduction representation: Initial problem description. Set of operators for transforming problems to sub problems. Set of primitive problem description. Game tree. 25 B- Problem reduction representation In this approach the initial problem description is given and it is solved by a sequence of transformations (operators) that changes it into a set of sub-problems whose solutions are immediate (primitive problems). Problem representation: Initial problem description. A set of operators for transforming problem to sub-problems. A set of primitive problem descriptions. 26 Example: Tower of Hanoi puzzle A A B B C C 1 2 3 1 2 3 initial state final state There are three pegs, 1, 2 and 3, and three disks, a, b and c (a being the smallest and c being the biggest). Initially, all the disks are stacked on peg 1. The problem is to transfer them all on to peg 3. Only one disk can be moved at a time, and no disk can ever be placed on top of a smaller disk. 27 Example: Tower of Hanoi puzzle The problem of moving a stack of size N from peg (1) to peg (3) can replaced by three problems: Moving a stack of size (n-1) from (1) (2). Moving a stack of size (1) from (1) (3). Moving a stack of size (n-1) from (2) (3). Primitive problem: Moving a single disk from one peg to another provided no smaller disk is on the receiving peg. 28 Solution: 29 Example: Measuring problem! 9l 3l 5l Problem: Using these three buckets, measure 7 liters of water. 30 Example: Measuring problem! (one possible) Solution: a b c 9l 0 0 0 start 3l 5l 3 0 0 0 0 3 a b c 3 0 3 0 0 6 3 0 6 0 3 6 3 3 6 1 5 6 0 5 7 goal 31 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 32 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 33 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 34 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 35 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 36 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 37 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 38 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 39 0 3 6 Example: Measuring problem! (one possible) Solution: 9l 3l 5l a b c a b c 0 0 0 start 3 0 0 0 0 3 3 0 3 0 0 6 3 0 6 40 0 3 6 Example: Measuring problem! Another Solution: 9l 3l 5l a b c 0 0 0 start a b c 0 5 0 0 0 3 3 0 3 0 0 6 3 0 6 0 3 6 41 3 3 6 Example: Measuring problem! Another Solution: 9l 3l 5l a b c 0 0 0 start a b c 0 5 0 3 2 0 0 0 3 3 0 3 0 0 6 3 0 6 42 0 3 6 Example: Measuring problem! Another Solution: 9l a b c 3l 5l 0 0 0 start 0 5 0 a b c 3 2 0 3 0 2 3 0 3 0 0 6 3 0 6 0 3 6 3 3 6 1 5 6 0 5 7 goal 43 Example: Measuring problem! Another Solution: 9l 3l 5l a b c 0 0 0 start a b c 0 5 0 3 2 0 3 0 2 3 5 2 0 0 6 3 0 6 44 0 3 6 Example: Measuring problem! Another Solution: 9l 3l 5l a b c 0 0 0 start a b c 0 5 0 3 2 0 3 0 2 3 5 2 3 0 7 goal 3 0 6 45 0 3 6 Which solution• do we prefer? • Solution 1: Solution 2: a b c a b c 0 0 0 start 0 0 0 start 3 0 0 0 5 0 0 0 3 3 2 0 3 0 3 3 0 2 0 0 6 3 5 2 3 0 6 3 0 7 goal 0 3 6 3 3 6 1 5 6 0 5 7 goal 46

DOCUMENT INFO

Shared By:

Tags:

Stats:

views: | 15 |

posted: | 6/27/2012 |

language: | |

pages: | 46 |

OTHER DOCS BY mohamed-fathi

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.