artificial intelligence rt804 prof. shoby b mathew department of information technology caarmel...

56
Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

Upload: aldous-waters

Post on 13-Jan-2016

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

Artificial IntelligenceRT804

Prof. Shoby B Mathew

Department of Information Technology

Caarmel Engineering College

Perunadu, Kerala

Page 2: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

2Teaching notes available at: http://www.shobymathew.com

Page 3: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

3

What is Artificial Intelligence?

Page 4: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

4

What is AI?What is AI?

A broad field that means different things to different peopleA broad field that means different things to different people

Defining “artificial” is easy but no broad consensus in Defining “artificial” is easy but no broad consensus in precise, concrete terms for “intelligence”: precise, concrete terms for “intelligence”:

exclusive province of human being?exclusive province of human being?

natural phenomenon exhibited by living organisms?natural phenomenon exhibited by living organisms?

an arbitrarily specified set of abilities?an arbitrarily specified set of abilities?

other definitions??other definitions??

Page 5: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

5

Artificial

Artificial – usually has a negative connotation (synthetic – i.e. man made)

e.g. artificial flower : look …maybe

feel no

smell no

Page 6: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

6

Artificial

artificial motion natural motionplanes walkingtrains horseautomobiles

artificial light natural lightelectric light sunlightcandlesKerosene lamp

Page 7: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

7

What is Intelligence?

Is there a “holistic” definition for intelligence?

We might list elements of intelligence: understanding, reasoning, problem solving, learning,

common sense, generalizing, inference, analogy, recall, intuition, emotion, self-awareness

Page 8: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

8

What is Intelligence?

• Intelligence: “ability to learn, understand and think” (Oxford dictionary)

Intelligence might be defined broadly as facility at solving problems

“Intelligence is the ability to learn, to deal with different situations, to acquire, understand, and apply knowledge and to analyze and reason.”

Varying kinds and degrees of intelligence occur in people, many animals and some machines.

Page 9: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

9

What is Artificial Intelligence (AI)?

• A.I. is the study of how to make computers do things at which, at the moment, people are better.

• It is the science and engineering of making intelligent machines, especially intelligent computer programs

• Artificial Intelligence is the science of making machines do things that would require intelligence if done by man.

• Artificial Intelligence is concerned with the design of intelligence in an artificial device.

Page 10: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

10

What is AI ?...contd.

The term was coined by John McCarthy in 1956.

There are two ideas in the definition. 1. Intelligence 2. artificial device

John McCarthy (Born 1927) in 2006

Page 11: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

11

What is AI?

Thinking humanly Thinking rationally

Acting humanly Acting rationally

Page 12: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

12

AI DefinitionsAI Definitions

Definitions organized into four categories Definitions organized into four categories

The exciting new effort to The exciting new effort to make computers make computers think think … … machines machines with mindswith minds, in , in the full and literal sense. the full and literal sense. [Haugeland 85].[Haugeland 85].

The study of the The study of the computations that make it computations that make it possible to possible to perceive, perceive, reason, reason, andand act act. . [Winston, [Winston, 1992]1992]

The study of how to make The study of how to make computers computers dodo things at things at which, at the moment, which, at the moment, peoplepeople are better. are better. [Rich & [Rich & Knight, 1991]Knight, 1991]

The branch of computer The branch of computer science that is concerned science that is concerned with the automation of with the automation of intelligent behaviorintelligent behavior. . [Luger [Luger and Stubblefield, 1993]and Stubblefield, 1993]

Page 13: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

13

Areas of Study Computer Science – algorithms, data representations,

programs to test theories Psychology – theories of mind, memory, learning,

experiments with human and animal intelligence Philosophy – mind/body problem, study of logic Linguistics – study of language (syntax, semantics) Neurology/Biology – study of the brain (both human

and animal), study of memory, learning Engineering – many AI domains are in engineering

disciplines Mathematics – many algorithms are mathematical in

nature (neural networks, statistical approaches)

Page 14: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

14

System with Intelligence

There are two possibilities: – A system with intelligence is expected to

behave as intelligently as a human – A system with intelligence is expected to

behave in the best possible manner

Page 15: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

15

Turing Test

Alan Turing's 1950 article Computing Machinery and Intelligence discussed conditions for considering a machine to be intelligent. He argued that if the machine could successfully pretend to be human to a knowledgeable observer then you certainly should consider it intelligent.

He stated that a computer would deserves to be called intelligent if it could deceive a human into believing that it was human.

Considered as the basic test for intelligence

Page 16: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

16

Turing Test Mathematician Alan

Turing devised a test for defining artificial intelligence: an interrogator poses

questions to two entities, a human and a computer

If the interrogator cannot tell which is the human and which is the computer, then the computer passes the Turing Test and should be considered intelligent Turing Test – a test for

machine intelligence

Page 17: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

17

Turing Test

Page 18: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

18

Turing Test

Page 19: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

19

Eliza Person: Men are all alike. Eliza: In what way? Person: They’re always bugging us

about something or other. Eliza: Can you think of a specific

example? Person: Well, my boyfriend made me

come here. Eliza: You’re boyfriend made you

come here? Person: He says I’m depressed much

of the time. Eliza: I am sorry to hear you are

depressed. Person: It is true, I am unhappy. Eliza: Do you think coming here will

help you not to be unhappy? Person: I need some help, that much

seems certain. Eliza: What would it mean to you if

you got some help? Person: Perhaps I could learn to get

along with my mother. Eliza: Tell me more about your family.

Eliza consists of a series of rules (if-then statements) sample syntactic manipulations:

<X> me <Y> <X> you <Y>? I like <Y> Why do you like

<Y>? <X> are like <Y> In what

way? <X> {mother | father | brother |

sister} Tell me more about your family

<X> Can you think of a specific example?

Eliza had no understanding of the text input or its own responses try a non-sensical sentence, you will

get a non-sensical response!

Page 20: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

20

What can AI systems do?

Today’s AI systems have been able to achieve limited success in some of these tasks. Face recognition (Computer vision ) Vehicles that are mostly autonomous ( Robotics ) Simple machine translation (Natural language

processing) Medical diagnosis in a narrow domain (Expert systems ) Recognizing several thousand words continuous speech

(Speech Understanding ) AI systems can play at the Grand Master level in chess

(Games)

Page 21: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

21

What can AI systems NOT do yet?

Understand natural language robustly (e.g., read and understand articles in a newspaper)

Surf the web Interpret an arbitrary visual scene Learn a natural language

Page 22: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

22

Applications of AIApplications of AI

• Computer beats human in a chess game.

• Computer-human conversation using speech

recognition.

• Expert system controls a spacecraft.

• Robot can walk on stairs and hold a cup of water.

• Language translation for webpages.

• Home appliances use fuzzy logic

• ......

Page 23: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

23

Applications of AIApplications of AI

Search enginesSearch engines

LaborLabor

ScienceScience

Medicine/Medicine/DiagnosisDiagnosis

AppliancesAppliances

What else?Games

Page 24: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

24

Some Task Domains of AI Mundane tasks

Perception (Vision, Speech) Natural language (Understanding, Generation, Translation) Commonsense reasoning Robot control

Formal Tasks Games (Chess, checkers) Mathematics (Geometry, logic, integral calculus)

Expert tasks Engineering (design, fault finding, manufacturing planning) Scientific analysis Medical diagnosis Financial analysis

Page 25: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

25

AI ProblemsAI Problems

MundaneMundane tasks correspond to the following AI problems areas: tasks correspond to the following AI problems areas:

Planning : Planning :

Vision :Vision :

Robotics:Robotics:

Natural Language:Natural Language:

The ability to decide on a good sequence of The ability to decide on a good sequence of actions to achieve our goalsactions to achieve our goals

The ability to make sense of what we seeThe ability to make sense of what we see

The ability to move and act in the world, possibly The ability to move and act in the world, possibly responding to new perceptionsresponding to new perceptions

The ability to communicate with others in The ability to communicate with others in any human languageany human language

Mundane tasks are generally much harder to automate

Page 26: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

26

To Build an Intelligent System

Why? To solve a particular problem We need to do four things

Define the problem precisely Analyze the problem Isolate and represent the task knowledge that is

necessary to solve the problem Choose the best problem-solving techniques and

apply it to the particular problem

Page 27: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

27

Problem Solving through AI

Problem: It is the question which is to be solved For solving a problem it needs to be precisely

defined Problem definition means, defining the start goal,

goal state, other valid states and transitions

Page 28: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

28

Problem Solving through AI

The method of solving problem through AI involves the process of defining the search space, deciding start and goal states and then finding the path from start state to goal state through search space

Page 29: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

29

Production rules

The movement from start state to goal state is guided by set of rules specifically designed for that particular problem (sometimes called production rules)

The production rules are nothing but valid moves described by the problems

Page 30: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

30

Search Space & Search

Search space: It is the complete set of states including start and goal states, where the answer of the problem is to be searched

Search: It is the process of finding the solution in search space. The input to search space algorithm is problem and output is solution in form of action sequences

Page 31: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

31

Well defined problem

A problem description has three major components. Initial state, final state, space including transition function or path function.

A path cost function assigns some numeric value to each path that indicates the goodness of that path.

Sometimes a problem may have additional component in form of heuristic information

Page 32: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

32

Solution of the problem

A solution of the problem is a path from initial state to goal state. The movement from start states to goal states is guided by transition rules.

Among all the solutions, whichever solution has least path cost is called optimal solution

Page 33: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

33

Method of solving problems through AI techniques

It involves the process of defining the search space, deciding about start and goal state and then finding a path from start state to goal state through search space

The search techniques are methods which are used to find a way from start to goal state

Page 34: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

34

Defining the problem as a state space search

Problem solving Searching for a goal state The state space representation forms the

basis of most of the AI problems Search is a very important process in the

solution of hard problems for which no more direct techniques are available.

Page 35: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

35

State Space Search1. Define a state space that contains all the

possible configurations of the relevant objects.

2. Specify the initial states.

3. Specify the goal states.

4. Specify a set of rules: What are unstated assumptions?

How general should the rules be?

How much knowledge for solutions should be in the rules?

Page 36: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

36

Famous Problems for Illustrating AI Concepts

Water Jug Problem Chess Problem Tic-Tac-Toe 8-Puzzle Problem 8-Queens Problem Tower of Hanoi Problem Traveling Salesperson Problem Magic Square Monkey and Bananas problem Missionaries and Cannibals problem Cryptarithmetic

Page 37: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

37

State Space Search: Water Jug Problem“You are given two jugs, a 4-gallon (litre) one

and a 3-gallon (litre) one. Neither has any

measuring markers on it. There is a pump

(tap) that can be used to fill the jugs with

water. How can you get exactly 2 litres of

water into 4-litre jug.”

Page 38: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

38

State Space Search: Water Jug Problem

• State: (x, y) i.e

Where X is gallons of water in 4 gallon jug

& y is gallons of water in 3 gallon jug

• x = 0, 1, 2, 3, or 4 y = 0, 1, 2, 3

• Start state: (0, 0).

• Goal state: (2, n) for any n.

• Attempting to end up in a goal state.

Page 39: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

39

Production rules for Water Jug Problem

1. (x, y) (4, y)if x 4

2. (x, y) (x, 3)if y 3

3. (x, y) (x d, y)if x 0

4. (x, y) (x, y d)if y 0

Page 40: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

40

Production rules for Water Jug Problem5. (x, y) (0, y)

if x 0

6. (x, y) (x, 0)if y 0

7. (x, y) (4, y (4 x))if x y 4, y 0

8. (x, y) (x (3 y), 3)if x y 3, x 0

Page 41: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

41

Production rules for Water Jug Problem9. (x, y) (x y, 0)

if x y 4, y 0

10.(x, y) (0, x y)if x y 3, x 0

11.(0, 2) (2, 0)

12.(2, y) (0, y)

Page 42: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

42

Production rules for Water Jug Problem

Page 43: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

43

Production rules for Water Jug Problem

Page 44: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

44

State Space Search: Water Jug Problem

1. Current state = (0, 0)

2. Loop until reaching the goal state (2, 0) Apply a rule whose left side matches the

current state Set the new current state to be the

resulting state(0, 0)(0, 3)(3, 0)(3, 3)(4, 2)(0, 2)(2, 0)

Page 45: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

45

One Solution to the Water jug Problem

Page 46: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

46

State Space Search: Water Jug Problem

The role of the condition in the left side of a rule restrict the application of the rule more efficient

1. (x, y) (4, y)if x 4

2. (x, y) (x, 3)if y 3

Page 47: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

47

State Space Search: Water Jug Problem

Special-purpose rules to capture special-case knowledge that can be used at some stage in

solving a problem

11.(0, 2) (2, 0)

12.(2, y) (0, y)

Page 48: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

48

Partial Search Tree of Water Jug Problem

(0, 0)

(4, 0) (0, 3)

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

Page 49: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

49

Formal Description of the Problem: Summary

Define a state space that contains all the possible configurations of the relevant objects.

Specify one or more states within that space that describe possible situations from which the problem solving process may start (initial state)

Specify one or more states that would be acceptable as solutions to the problem. (goal states)

Specify a set of rules that describe the actions (operations) available.

Page 50: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

50

Problem Solving: Chess Game playing

Game playing is considered an intelligent human activity. Games of perfect information are really just search problems

Page 51: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

51

Problem Solving: Chess

Number of possible unique chess games is 10120.

In 1957, artificial intelligence pioneers Herbert Simon and Allen Newell predicted that a computer would beat a human at chess within 10 years.

BELLE, a chess program by Ken Thompson and Joe Condon, became the first computer to be awarded the title of US chess master, in 1983.

BELLE didn’t try to do what a human would do. Instead, BELLE took advantage of what computers do well.

In May 1997, IBM's Deep Blue Supercomputer played a fascinating match with the reigning World Chess Champion, Garry Kasparov and won 3 ½ to 2 ½

Page 52: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

52

Defining chess problem as State Space search

• State space is a set of legal positions.

• Starting at the initial state.

• Using the set of rules to move from one state to another.

• Attempting to end up in a goal state.• Define the problem of playing chess as a problem of

moving around in a state space, where each state corresponds to a legal position of the board

Page 53: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

53

Defining chess problem as State Space search

• Each position can be described by an 8-by-8 array.

• Initial position is the game opening position.

• Goal position is any position in which the opponent does not have a legal move and his or her king is under attack.

• Legal moves can be described by a set of rules: Left sides are matched against the current state.

Right sides describe the new resulting state.

Page 54: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

54

Cryptarithmetic Consider an arithmetic problem represented by letters, as shown

below: SEND DONALD

+MORE +GERALD ---------- --------------MONEY ROBERT

Assign a decimal digit to each of the letters in such a way that the answer to the problem is correct. If the same letter occurs more than once, it must be assigned the same digit each time. No two different letters may be assigned the same digit.

Page 55: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

55

Tic-Tac-Toe - Game Trees

Tic-tac-toe

xx

x

o xxxxx o

oo o

xxx

ooo

1 ply 1 move

Page 56: Artificial Intelligence RT804 Prof. Shoby B Mathew Department of Information Technology Caarmel Engineering College Perunadu, Kerala

56

Tic-Tac-Toe - Game Trees

win

lose

draw

xxo

o

ox

xxo

o

ox

xxo

o

oxx

xxo

o

ox

x x

xxo

o

oxx

xxo

o

oxx

xxo

o

ox

x

xxo

o

ox

x

xxo

o

ox

x

xxo

o

ox

xo

oo oo

o

xxo

o

oxx

o x xxx

xxo

o

oxx

o

xxo

o

ox

xo

xxo

o

ox

x

o xxx

oo

ox

xo