Top Banner
Introduction to Artificial Intelligence Assoc. Prof. Osama fathy
33

Lecture AI Problems Space

Sep 25, 2015

Download

Documents

adragon64

Get familiar with solving complex and arbitary ai problems using problem spaces
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Introduction to Artificial Intelligence

    Assoc. Prof. Osama fathy

  • Problems, Problem spaceand Search

  • 3Some 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

  • 4Some 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 .

  • 5AI 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, )

  • 6Script 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.

  • 7Script 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

  • 8Script problem

    Q1: What did Mary go shopping for?Q2: What did Mary find that she liked?Q3: Did Mary buy any thing?

  • 91. Arrange actions Time.2. Coding:

    C...customerSstorePsales personM.......merchandizeDmoneyRcolorT.department

    Solution

  • 10

    1- C enter S

    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

    3. Script:

  • 11

    4. Algorithms:

  • 12

    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 --------------

  • 13

    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.

    Problem representation

  • 14

    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.

  • 15

    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

  • 16

    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 searchingfor 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.

  • 17

    Example: Water Jug ProblemSolution:

    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.

  • 18

    Example: Water Jug Problem

    Pour some water from the 3-G jug

    y>0(x, y-d)(x, y)4

    Pour some water from the 4-G jug

    x>0(x-d, y)(x, y)3Fill 3-G jugy

  • 19

    Example: Water Jug Problem

    pour water from 3-G jug into 4-G jug until it is full

    x+y4 & y>0

    (4,y-(4-x))(x, y)7

    Empty the 3-G jug on the ground

    y>0(x, 0)(x, y)6

    Empty the 4-G jug on the ground

    x>0(0, y)(x, y)5

    Description Condition NewState

    Current State

    #

  • 20

    Example: Water Jug Problem

    pour all the water from 4-G jug into

    3-G jug

    x+y3 & x>0

    (0, x+y)(x, y)10

    pour all the water from 3-G jug into

    4-G jug

    x+y4 & y>0

    (x+y,0)(x, y)9

    pour water from 4-G jug into 3-G jug until it is full

    x+y3 & x>0

    (x-(3-y),3)(x, y)8

    Description Condition NewState

    Current State

    #

  • 21

    Example: Water Jug Problem Tree: (0,0)

    (0,3)(4,0)

    (0,0) (1,3) (4,3) (0,0) (3,0)

    (0,3) (1,0) (4,0) (4,3)

    (4,3)

    (2,0) (2,3)

  • 22

    Example: travel salesman problemA 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

  • 23

    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

    Example: travel salesman problem

  • 24

    A

    AB AC

    ABC ABD ACB ACD

    AD

    ADCADB

    ABCD ABDC ACBD ACDB ADCBADBC

    A B

    CDN= 4 cites, then different paths = 3!=6

    Example: travel salesman problem

  • 25

    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.

    Problem representation

  • 26

    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.

  • 27

    Example: Tower of Hanoi puzzle

    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.

    1 2 3 1 2 3initial state final state

    BA

    CBA

    C

  • 28

    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.

    Example: Tower of Hanoi puzzle

  • 29

    An animated solution of the Tower of Hanoi puzzle for T(4,3)

  • 30

    A model set of the Towers of Hanoi (with 8 disks)

  • 31

    The state-space for the Eight -Puzzle problem

  • 32

    Example: Measuring problem!

    3 l 5 l9 l

    Problem : You are given three jugs 3-liter, 5-liter and 9-liter 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 7-liter of water into the 9-liter jug?

  • 33

    Which solution do we prefer?

    Solution 1:

    a b c

    0 0 0 start

    3 0 0

    0 0 3

    3 0 3

    0 0 6

    3 0 6

    0 3 6

    3 3 6

    1 5 6

    0 5 7 goal

    Solution 2:

    a b c

    0 0 0 start

    0 5 0

    3 2 0

    3 0 2

    3 5 2

    3 0 7 goal