Top Banner
Artificial Intelligence Artificial Intelligence 人工智慧 L 2 Lecture 2 February 27, 2013 洪國寶 1
83

Artificial Intelligence Artificial Intelligence 人工智慧

Feb 13, 2022

Download

Documents

dariahiddleston
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
Page 1: Artificial Intelligence Artificial Intelligence 人工智慧

Artificial IntelligenceArtificial Intelligence 人工智慧人工智慧

L 2Lecture 2February 27, 2013

洪國寶

1

Page 2: Artificial Intelligence Artificial Intelligence 人工智慧

OutlineOutline

• Review• The Turing testg• Foundations of AI• Chapter 3• Chapter 3

– Knowledge Representation

2

Page 3: Artificial Intelligence Artificial Intelligence 人工智慧

Course informationCourse informationT b k• Textbook– Artificial Intelligence Illuminated

B C iBen Coppin, – Jones and Bartlett Publishers, Inc.

2004. (開發圖書公司)

– http://computerscience.jbpub.com/catalog/0763732303/g

– Try Google search (keywords: “artificial intelligence illuminated”)

C b• Course web page: http://ailab.cs.nchu.edu.tw/course/AI/101/main.htm

3

Page 4: Artificial Intelligence Artificial Intelligence 人工智慧

Course informationCourse information

• The objective of this course is to learn fundamental techniques of artificial intelligencefundamental techniques of artificial intelligence, including

symbolic programming– symbolic programming, – knowledge representation, – search,search, – inference, – machine learning, g,– planning, and– computer understanding of language and images.

4

Page 5: Artificial Intelligence Artificial Intelligence 人工智慧

Strong AI and Weak AIStrong AI and Weak AI• Artificial Intelligence involves using methods based on the

intelligent behavior of humans and other animals to solve complex problemscomplex problems.

• Strong AI:This is the view that a sufficiently programmed computer– This is the view that a sufficiently programmed computer would actually be intelligent and would think in the same way that a human does.y

• Weak AI:– This is the use of methods modeled on intelligent behaviorThis is the use of methods modeled on intelligent behavior

to make computers more efficient at solving problems.• This course is concerned with Weak AI.

5

Page 6: Artificial Intelligence Artificial Intelligence 人工智慧

Strong Methods and Weak MethodsStrong Methods and Weak Methods

• Not to be confused with Strong AI and Weak AI.• Strong methods use knowledge about the world to g g

solve problems.• Weak methods use logic and other symbolic systems.Weak methods use logic and other symbolic systems.• Strong method systems rely on weak methods, as

knowledge is useless without a way to handle thatknowledge is useless without a way to handle that knowledge.

6

Page 7: Artificial Intelligence Artificial Intelligence 人工智慧

AI history trends in popular hypeAI history – trends in popular hype

Early enthusiasmgreat expectations

booming industry

Big promises, great expectations, all fell short crude reality, again

1940 1950 1960 1970 1980 1990 2000 2010 2020

7

Page 8: Artificial Intelligence Artificial Intelligence 人工智慧

Outlook for AIOutlook for AI• AI has a long way to go.

– It may well be 100 years before any computer is as intelligent as a humanhuman.

• No single discovery will suffice.– Real AI will require hundreds of research breakthrough.ea w equ e u d eds o esea c b ea t oug .

• AI will continue to advance.– Progress will continue but no sudden and final successg

• Useful applications of AI are feasible now.• AI can enhance human performance.p

– The best overall system will often be a combination of AI programs and humans.

8

Page 9: Artificial Intelligence Artificial Intelligence 人工智慧

OutlineOutline

• Review• The Turing testg• Foundations of AI• Chapter 3• Chapter 3

– Knowledge Representation

9

Page 10: Artificial Intelligence Artificial Intelligence 人工智慧

A paper by TuringA paper by Turing

• Computing Machinery and Intelligence– Published in “Mind: A Quarterly Review of

P h l d Phil h ” i 1950Psychology and Philosophy”, in 1950.– “I propose to consider the question, ‘Can machines

think?’”think?• And if so, how?• And if not, why not?

– Describes the imitation game, now called the Turing Test.P ibl f t i t t d di t d t i i– Possibly one of most important and disputed topics in AI, philosophy of mind, cognitive science. ■

10

Page 11: Artificial Intelligence Artificial Intelligence 人工智慧

Turing TestTuring Test

• Alan Turing invented the Turing Test, designed to determine if a computer system can be called an de e e a co pu e sys e ca be ca ed aartificial intelligence or not, based on whether it can fool a human into thinking it is human too.g

• No system has yet passed the Turing Test. ■

11

Page 12: Artificial Intelligence Artificial Intelligence 人工智慧

Turing TestTuring TestTh i d• Three rooms contain a person, a computer, and an interrogator Th i i i h h h• The interrogator can communicate with the other two by teleprinter.Th i i d i hi h i h• The interrogator tries to determine which is the person and which is the machine. Th hi i f l h i i• The machine tries to fool the interrogator into believing that it is the person. If h hi d h l d h h• If the machine succeeds, then we conclude that the machine can think. ■

12

Page 13: Artificial Intelligence Artificial Intelligence 人工智慧

Turing TestThe Interrogator

The interrogator ask a set of questions that must be answered by a machine and by a human being.

If th i t t tIf the interrogator cannot differentiate the human from the machine, then, it is said that the machineis said that the machine is intelligent.

MachineHuman

The Turing test provides a basis for many of the schemes used to evaluate AI programs. For example we can use a variation of the Turing test to evaluate the performance of a KBS compared with the

13

Turing test to evaluate the performance of a KBS compared with the performance of a human expert (given set of problems).

Page 14: Artificial Intelligence Artificial Intelligence 人工智慧

A sample imitation gameA sample imitation game

• Turing suggests some specimen Q & A’s:Q: Please write me a sonnet on the subject of the Forth Bridge

hi ld iA: Count me out on this one, I never could write poetryQ: Add 34957 to 70764.

(pause about 30 seconds)(pause about 30 seconds)A: 105621Q: Do you play chess?A: YesQ: I have K at my K1, and no other pieces. You have only K at K6 and R at

R1 It is your move What do you play?R1. It is your move. What do you play?(pause about 15s)

A: R-R8 mate

14

Page 15: Artificial Intelligence Artificial Intelligence 人工智慧

Some Famous Imitation Games

• 1960s ELIZA– Written by Joseph Weizenbaum– Used simple pattern matching

• “Well, mymy boyfriend made meme come here”•• ““YourYour boyfriend made youyou come here?”

• 1970s SHRDLU– Written by Terry Winograd – Had a very limited domain

• 1990s Loebner prize– win $100,000 if you pass the test ■

15

, y p

Page 16: Artificial Intelligence Artificial Intelligence 人工智慧

The Loebner ContestThe Loebner Contest

• A modern version of the Turing Test, held annually, with a $100,000 cash prize.

• http://www.loebner.net/Prizef/loebner-prize.html• Restricted topic (removed in 1995) and limited time. • Participants include a set of humans and a set of computers

and a set of judges.• Scoring

– Rank from least human to most human. ■

16

Page 17: Artificial Intelligence Artificial Intelligence 人工智慧

The Loebner ContestThe Loebner Contest

• Loebner Prize 2013 Annual First Prize is: US$ 4000 + Annual Bronze Medal, Second Prize: US$ 1000, Third Prize: US$ 750 and Fourth Prize: US$ 250.US$ 250.

• The Silver Medal Prize of $25,000 + Silver Medal will be awarded if any program fools two or more judges.

• At that point the contest will progress to the MultiModal stage in which entries in subsequent years will necessitate processing of MultiModalinput (e.g. music, speech, pictures, videos).

• During the MultiModal stage, if any entry fools half the judges compared to half of the humans, the program's creator(s) will receive the Grand Prize of $100 000 + 18kt Gold Medal and the competition will bePrize of $100,000 + 18kt Gold Medal, and the competition will be discontinued. ■

17

Page 18: Artificial Intelligence Artificial Intelligence 人工智慧

The Loebner ContestThe Loebner Contest Set 1 - Questions relating to time:Background facts:a The system clock will be accurate to within a minute or twoa. The system clock will be accurate to within a minute or two.b. The competition is scheduled to start at 10:00 AM Sunday, 6

Sept 2009c. There will be 7 rounds of 30 minutes each.

S l Q tiSample Questions• What time is it? • What round is this?What round is this? • Is it morning, noon, or night? Etc.

18http://loebner.net/Prizef/2009_Contest/LP_2009.html

Page 19: Artificial Intelligence Artificial Intelligence 人工智慧

The Loebner ContestThe Loebner Contest Set 2 - General questions about things.Sample Questions:• What is a hammer? • What would I use a hammer for? • Of what use is a taxi? Etc.Etc.

Set 3 Questions relating to comparisonsSample QuestionsSample Questions• Which is larger, a grape or a grapefruit? • Which is faster, a train or a plane?

John is older than Mar and Mar is older than Sarah Which of them is• John is older than Mary, and Mary is older than Sarah. Which of them is the oldest?

Etc:

19

Page 20: Artificial Intelligence Artificial Intelligence 人工智慧

The Loebner ContestThe Loebner Contest

Set 4 - Questions demonstrating "memory" or persistence.Sample Questions

I h f i d d H h lik t l t i <O• I have a friend named Harry who likes to play tennis. <One or more intervening questions or statements>

• What is the name of the friend I just told you about? • Do you know what game Harry likes to play? Etc.

20

Page 21: Artificial Intelligence Artificial Intelligence 人工智慧

Searle’s “Chinese Room”Searle s Chinese Room

• A thought experiment used to argue against strong AI.• A non-Chinese speaker is in a room with a set of cardsA non Chinese speaker is in a room with a set of cards

with Chinese characters, and a set of instructions in English.

• Questions in Chinese are fed into the room and by• Questions in Chinese are fed into the room, and by following the instructions, the human is able to produce answers.

• The room appears to understand Chinese – it can answer questions in the language – but the human inside cannot.

• But does this mean the room knows Chinese??• But does this mean the room knows Chinese??• Conclusion: TT only tests for “weak” AI, not

“strong” AI. ■21

g ■

Page 22: Artificial Intelligence Artificial Intelligence 人工智慧

Summary: The Turing TestSummary: The Turing Test

• The Turing test turns a philosophical question ...• Can Machines think?

• … into an operational one• Can machines play the imitation game?

• We are not near writing programs to pass the test• The Turing test does NOT drive much AI researchg• Improving the capabilities of computers DOES ■

22

Page 23: Artificial Intelligence Artificial Intelligence 人工智慧

OutlineOutline

• Review• The Turing testg• Foundations of AI• Chapter 3• Chapter 3

– Knowledge Representation

23

Page 24: Artificial Intelligence Artificial Intelligence 人工智慧

Foundations of AIFoundations of AIComputerS i &Science &

EngineeringMathematics Philosophy

AIAI BiologyEconomics AICognitiveS i

Psychology Linguistics

24Science

Page 25: Artificial Intelligence Artificial Intelligence 人工智慧

Philosophy ( 1 7)Philosophy (sec 1.7)

• Philosophy provides an important background to a study of AI.• The philosophy of great thinkers, from Plato to Descartes and

t D i l D tt h h d t d l f i fl thto Daniel Dennett, has had a great deal of influence on the modern study of Artificial Intelligence.

• Descartes’ dualism described a universe consisting of two• Descartes dualism described a universe consisting of two separate things: mind and matter.

• Descartes believed that humans possessed minds but that• Descartes believed that humans possessed minds, but that animals were simply biological machines.

• The work of Aristotle, Descartes and more recently DanielThe work of Aristotle, Descartes and more recently Daniel Dennett (born March 28, 1942 in Boston, Massachusetts) are worth studying. ■

25

Page 26: Artificial Intelligence Artificial Intelligence 人工智慧

Linguistics ( 1 8)Linguistics (sec 1.8)

• The study of human language has a vital role to play in Artificial Intelligence.

• For computers to interact with humans properly, they need to understand human language.g g

• Noam Chomsky’s work on grammars has informed the study of natural language processing (NLP).the study of natural language processing (NLP).

• Knowledge representation which is fundamental to AI is essential to understanding language ■AI is essential to understanding language. ■

26

Page 27: Artificial Intelligence Artificial Intelligence 人工智慧

Human Psychology and Biology (sec 1 9)Human Psychology and Biology (sec 1.9)

Whil AI h i d l l• While most AI techniques do not map neatly onto real biological systems, some, such as neural networks, dodo.

• Cognitive Psychology has many links with AI: It involves the idea that the human brain usesinvolves the idea that the human brain uses processing methods on knowledge to solve problems, make decisions draw conclusions and carry outmake decisions, draw conclusions, and carry out other intelligent acts..

• This contrasts with behaviorism which is the viewThis contrasts with behaviorism, which is the view that behavior is linked directly to stimuli. ■

27

Page 28: Artificial Intelligence Artificial Intelligence 人工智慧

OutlineOutline

• Review• The Turing testg• Foundations of AI• Chapter 3• Chapter 3

– Knowledge Representation

28

Page 29: Artificial Intelligence Artificial Intelligence 人工智慧

Chapter 3Knowledge Representation

• Introduction: The need for a good representation• Semantic nets, Inheritance, Frames• Search trees• Problem reduction• Problem reduction

29

Page 30: Artificial Intelligence Artificial Intelligence 人工智慧

IntroductionIntroduction• This chapter focuses on the important topic of

knowledge representation. • Common representational methods used in Artificial

Intelligence – frames, semantic nets, and search trees g– are discussed.

• Also, the chapter provides a number of exampleAlso, the chapter provides a number of example problems and explains how the representational methods introduced can be used to solve themethods introduced can be used to solve the problems. ■

30Continued in the next slide.

Page 31: Artificial Intelligence Artificial Intelligence 人工智慧

IntroductionIntroduction• The Need for a Good Representation

– A computer needs a representation of a problem in order to solve it.

– In AI, both problem representation and knowledge t ti d drepresentation are needed.

• A representation must be:– Efficient – not wasteful in time or resources.– Useful – allows the computer to solve the problem.– Meaningful – really relates to the problem. ■

31Continued in the next slide.

Page 32: Artificial Intelligence Artificial Intelligence 人工智慧

IntroductionIntroduction• The topic of representation is immensely important in

Artificial Intelligence because to solve a problem that relates to the real world, a computer must have some way of internally representing the real world.

• Assumption of (traditional) AI work is that:– Knowledge may be represented as “symbol structures”g y p y

(essentially, complex data structures) representing bits of knowledge (objects, concepts, facts, rules, strategies..).

– Intelligent behavior can be achieved through manipulation of symbol structures ■

32Continued in the next slide.

Page 33: Artificial Intelligence Artificial Intelligence 人工智慧

IntroductionIntroduction• Intelligent systems require that we have• Intelligent systems require that we have

– Knowledge formally representedN i f / l i ibl– New inferences/conclusions possible.

Real World Real World

Map to computer memory Map back to real world

Representationof facts in World

New conclusionsInference

33

of facts in World conclusions

Computer Computer

Page 34: Artificial Intelligence Artificial Intelligence 人工智慧

Inferential Adequacyq y• Representing knowledge not very interesting unless

i k i fyou can use it to make inferences:– Draw new conclusions from existing facts.

• “If its raining John never goes out” + “It’s raining today” so..

– Come up with solutions to complex problems, using the t d k l drepresented knowledge.

• Inferential adequacy refers to how easy it is to draw i f i d k l dinferences using represented knowledge.

• Representing everything as natural language stringshas good representational adequacy and naturalness, but very poor inferential adequacy. ■

34

Page 35: Artificial Intelligence Artificial Intelligence 人工智慧

f i ffi iInferential Efficiency• You may be able, in principle, to make complex

deductions given knowledge represented in a sophisticated way.

• But it may be just too inefficient.y j• Generally the more complex the possible deductions,

the less efficient will be the reasoner.the less efficient will be the reasoner.• Need representation and inference system sufficient

for the task without being hopelessly inefficient ■for the task, without being hopelessly inefficient. ■

35

Page 36: Artificial Intelligence Artificial Intelligence 人工智慧

i AMain KR Approaches

• Logic– Will be covered in Lecture 7

• Frames/Semantic Networks• Rule-based systems

– Will be covered in Lecture 8 W be cove ed ec u e 8

• Advanced Knowledge RepresentationThe blackboard architecture scripts and the Copycat– The blackboard architecture, scripts, and the Copycat architecture ■

36

Page 37: Artificial Intelligence Artificial Intelligence 人工智慧

Chapter 3Knowledge Representation

• Introduction: The need for a good representation• Semantic nets, Inheritance, Frames• Search trees• Problem reduction• Problem reduction

37

Page 38: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networks

• Semantic network– Proposed by psychologists to represent associative abilities

• Knowledge represented in a graph– Objects and concepts are represented by nodesj p p y– The relations between objects and concepts by directed

links ■

38

Page 39: Artificial Intelligence Artificial Intelligence 人工智慧

A Simple Semantic NetA Simple Semantic Net

39

Page 40: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networks“A i bi d”• “A sparrow is a bird”– Two concepts: “sparrow” and “bird”

A sparro is a kind of bird so connect the t o concepts

Spar Bird

– A sparrow is a kind of bird, so connect the two concepts with a IS-A relation

• This is an higher-lower relation or abstract-concrete relationg

BirdSparIS-A

40

Page 41: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networks“A bi d h f h ”• “A bird has feathers”– This is a different relation: the part-whole relation

R d b HAS A li k PART OF li k– Represented by a HAS-A link or PART-OF link– The link is from whole to part, so the direction is the

opposite of the IS-A linkopposite of the IS-A link

BirdSparIS-A

Feat

HAS-A

41

Page 42: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networks

IS-AFeatHAS-A

BirdSparS

IS-A IS-A FlyProperty

Sweety Tweety

IS A

Child f

Crow IS-A

Adding:•Tweety and Sweety are birds

Child-of

Beak

HAS-A

•Tweety has a red beak•Sweety is Tweety’s child•A crow is a bird

Beak

Red Color

42

•A crow is a bird•Birds can fly

Page 43: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networksS ti t k i• Semantic networks can answer queries– Query: “Which birds have red beaks?”– Answer: Tweety ?Answer: Tweety– Method: Direct match of subgraph

Beak

HAS-A

– Query: “Can Tweety fly?”– Answer: Yes

Beak

Red Color

– Method: Following the IS-A link from “Tweety” to “bird” and the property link of “bird” to “fly”

– This process is called inheritance– This process is called inheritance

43

Page 44: Artificial Intelligence Artificial Intelligence 人工智慧

InheritanceInheritanceI h i i h b hi h b l• Inheritance is the process by which a subclassinherits properties from a superclass.E l• Example:– Mammals give birth to live young.

Fid i l– Fido is a mammal.– Therefore fido gives birth to live young.

I i th l b i h it d• In some cases, as in the example above, inherited values may need to be overridden. (Fido may be a mammal but if he’s male then he probably won’tmammal, but if he s male then he probably won t give birth). ■

44

Page 45: Artificial Intelligence Artificial Intelligence 人工智慧

Semantic networksSemantic networks

• Advantages of semantic networks– Simple representation, easy to read– Associations possible– Inheritance possible

• Disadvantages of semantic networks– A separate inference procedure (interpreter) must be buildp p ( p )– The validity of the inferences is not guaranteed– For large networks the processing is inefficient ■For large networks the processing is inefficient ■

45

Page 46: Artificial Intelligence Artificial Intelligence 人工智慧

Frame systemsFrame systems

• Frame theory– When humans encounter something new, a basic structure

called a frame is selected from memory– A frame is a fixed framework in which all kinds of

i f i i dinformation is stored– For more details about the information in a frame, a

different frame is selecteddifferent frame is selected– A frame is connected to other frames, so this is a network

of frames ■of frames ■

46

Page 47: Artificial Intelligence Artificial Intelligence 人工智慧

Frame systemsFrame systems

• Frame– Frame name: represents an object or a

concept, so similar to node in the semantic network

Frame name

Frame typenetwork

– Frame type: shows if this a concept (class) or an object (instance)

• Slotbird classIS-A value animal

yp

– Consists of slot name and facets– Slot name: property or relation name

• Facet– A facet gives information about the slot

IS A value animalHAS-A default feather

default leg– A facet gives information about the slot,

i.e. the value and name– Value: the value of the property– Default: connecting frames can have a

different value for this property

#Leg default 2Weight If-Needed calc-weight

different value for this property• Demon

– Perform a certain action if a condition is satisfied ■

47

Page 48: Artificial Intelligence Artificial Intelligence 人工智慧

Frame systemsFrame systems

bird classIS-A value animal

Tweety instanceIS-A value bird

HAS-A default featherdefault leg

#Leg default 2

HAS-A value beakBeakcol value redChild value Sweety#Leg default 2

Weight If-Needed calc-weightChild value SweetyBirthday value 1990.1.1

If-Added calc-age

crow class beak class

IS-A value birdColor default black

Beakcol default yellow

48

Page 49: Artificial Intelligence Artificial Intelligence 人工智慧

Frame systemsFrame systems

• Inference in frame systems– Query: “How many legs has a crow?”– Answer: 2– Inference

• No information about this in the “crow” frame• Try to find it in the “bird” frame

f l l i 2• Default value is 2– Also called inheritance

As soon as the birthday of Tweety is added the “calc age” procedure is– As soon as the birthday of Tweety is added, the calc-age procedure is invoked

– Query: “What is the weight of Tweety?”Query: What is the weight of Tweety?– The answer is obtained by the procedure “calc-weight” in bird ■

49

Page 50: Artificial Intelligence Artificial Intelligence 人工智慧

Why frames are useful?Why frames are useful?• The main advantage of using frame-based systems for

expert systems over the rule-based approach is that all the information about a particular object is stored in one placeinformation about a particular object is stored in one place. – In a rule-based system, information about Fido might be stored in a

number of otherwise unrelated rules, and so if Fido changes, or a deduction needs to be made about Fido, time may be wasted examining irrelevant rules and facts in the system, whereas with the frame system, the Fido frame could be quickly examined.q y

– This difference becomes particularly clear when we consider frames that have a very large number of slots and where a large number of relationships exist between frames (i e a situation in which objectsrelationships exist between frames (i.e., a situation in which objects have a lot of properties, and a lot of objects are related to each other).

50

Page 51: Artificial Intelligence Artificial Intelligence 人工智慧

InheritanceInheritance

51

Page 52: Artificial Intelligence Artificial Intelligence 人工智慧

Slots as framesSlots as frames

• It is possible to express a range of values that a slot can take.

• One way to express this kind of restriction is by allowing slots to be frames.g

52

Page 53: Artificial Intelligence Artificial Intelligence 人工智慧

Multiple inheritanceMultiple inheritance

• It is possible for a frame to inherit properties from more than one other frame. In other words, a class can be a subclass of two superclasses, and an object can be an instance of more than one class. This is known as multiple inheritance.

53

Page 54: Artificial Intelligence Artificial Intelligence 人工智慧

Multiple inheritanceMultiple inheritance• In some cases, we will encounter conflicts, where multiple

inheritance leads us to conclude contradictory information about a frameabout a frame.

• In this case, we need a mechanism to decide which features to inherit from which superclassesinherit from which superclasses. – One simple method is to simply say that conflicts are resolved by the

order in which they appear. So if a fact is established by inheritance, and then that fact is contradicted by inheritance, the first fact is kept because it appeared first, and the contradiction is discarded.

• Multiple inheritance is a key feature of most object-orientedMultiple inheritance is a key feature of most object oriented programming languages. ■

54

Page 55: Artificial Intelligence Artificial Intelligence 人工智慧

Procedures and DemonsProcedures and DemonsA d i t f i t ti i t d ith f ( l t)• A procedure is a set of instructions associated with a frame (or a slot).– For example, a slot reader procedure might return the value of a particular slot

within the frame. A h d i h i l i l ( l i )– Another procedure might insert a value into a slot (a slot writer).

– Another important procedure is the instance constructor, which creates an instance of a class.S h d ll d h d d d ll d WHEN NEEDED– Such procedures are called when needed and so are called WHEN NEEDEDprocedures.

• The procedure can be run upon request.• A demon is a procedure that is run automatically, usually triggered by an

event such as when a value is:– Read: when a particular value is read.– Written: when the value of a slot is changed.– Created– Changed ■

55

g

Page 56: Artificial Intelligence Artificial Intelligence 人工智慧

Inference in FramesInference in FramesWh i f d d f t i i f t b t l t l ThWhen using frames we need a procedure for retrieving facts about slot values. There

are 3 inference techniques that can be used when using frames:

1 E li it i f ti Wh F t i l t ith h th i d1. Explicit information: When a Frame contains a slot with where the required value is explicitly stated, then, that is the value, otherwise the value is obtained through inference (e.g., inheritance).

2. Inheritance: To find a value by inheritance, we need to move from the current frame to a more general frame according to the relations between frames (e.g., instance of, a kind of). Such a move leads to a “parent frame” & a value may be _ f, _ _ f) p yfound in this frame explicitly, or through further inheritance.

3. Using Procedural slots: When a procedure is given in a slot instead of the value g p gitself, simply execute the procedure. This type of inference may require the use of types 1 and 2, described above. ■

56

Page 57: Artificial Intelligence Artificial Intelligence 人工智慧

Object Oriented ProgrammingObject Oriented Programming

• Object oriented programming languages such as Java, C++.

• Use ideas such as:– inheritance– multiple inheritance– overriding default valuesg– procedures and demons

• Languages such as IBM’s APL2 use a frame basedLanguages such as IBM s APL2 use a frame based data structure. ■

57

Page 58: Artificial Intelligence Artificial Intelligence 人工智慧

Chapter 3Knowledge Representation

• Introduction: The need for a good representation• Semantic nets, Inheritance, Frames• Search trees• Problem reduction• Problem reduction

58

Page 59: Artificial Intelligence Artificial Intelligence 人工智慧

Search SpacesSearch Spaces M bl i A ifi i l I lli b• Many problems in Artificial Intelligence can be represented as search spaces. I i l h i i f• In simple terms, a search space is a representation of the set of possible choices in a given problem, one or more of which are the solution to the problemmore of which are the solution to the problem.

• Figure 3.3 shows a very simple state-space diagram for a robot that lives in an environment with threefor a robot that lives in an environment with three rooms (room A, room B, and room C) and with a block that he can move from room to roomblock that he can move from room to room.– Each state consists of a possible arrangement of the robot

and the block. ■

59

Page 60: Artificial Intelligence Artificial Intelligence 人工智慧

A simple state space diagramA simple state-space diagram

60

Page 61: Artificial Intelligence Artificial Intelligence 人工智慧

Search TreesSearch Trees

• Used to represent search spaces.• Root node has no predecessor.p• Leaf nodes have no successors.• Goal nodes (of which there may be more than one)• Goal nodes (of which there may be more than one)

represent solutions to a problem. ■

61

Page 62: Artificial Intelligence Artificial Intelligence 人工智慧

Search Trees: An Examplep

• A is the root node.

• L is the goal node.

H, I, J, K, M, N and O are leaf nodes.H, I, J, K, M, N and O are leaf nodes.There is only one complete path:

62A, C, F, L

Page 63: Artificial Intelligence Artificial Intelligence 人工智慧

Example: Missionaries and Cannibals

• Three missionaries and three cannibals• Want to cross a river using one canoe.g• Canoe can hold up to two people.• Can never be more cannibals than missionaries on• Can never be more cannibals than missionaries on

either side of the river.Ai T t ll f l th i ith t• Aim: To get all safely across the river without any missionaries being eaten. ■

63

Page 64: Artificial Intelligence Artificial Intelligence 人工智慧

A RepresentationA Representation

• The first step in solving the problem is to choose a suitable representation.

• We will show number of cannibals, missionaries and canoes on each side of the river.

• Start state is therefore:– 3,3,1 0,0,0 ■3,3,1 0,0,0 ■

64

Page 65: Artificial Intelligence Artificial Intelligence 人工智慧

A Simpler RepresentationA Simpler Representation

• In fact, since the system is closed, we only need to represent one side of the river, as we can deduce the other side.

• We will represent the finishing side of the river, and p gomit the starting side.

• So start state is:So start state is:– 0,0,0 ■

65

Page 66: Artificial Intelligence Artificial Intelligence 人工智慧

OperatorsOperators

• Now we have to choose suitable operators that can be applied:1. Move one cannibal across the river.2. Move two cannibals across the river.3. Move one missionary across the river.4. Move two missionaries across the river.5. Move one missionary and one cannibal. ■

66

Page 67: Artificial Intelligence Artificial Intelligence 人工智慧

A partial search tree for the missionaries and cannibals problem

1. Move one cannibal across the river.2. Move two cannibals across the river.3. Move one missionary across the river.4. Move two missionaries across the river.5. Move one missionary and one cannibal.

3 4

x x

67

Page 68: Artificial Intelligence Artificial Intelligence 人工智慧

The Search Tree• Cycles have been removed.• Nodes represent states, edgesNodes represent states, edges

represent operators.• There are two shortest paths thatThere are two shortest paths that

lead to the solution.

1. Move one cannibal across the river.2. Move two cannibals across the river.3 M i i h i3. Move one missionary across the river.4. Move two missionaries across the river.5. Move one missionary and one cannibal.

68

Page 69: Artificial Intelligence Artificial Intelligence 人工智慧

More examplesMore examplesE l 2 Th T li S l• Example 2: The Traveling Salesman

• Example 3: The Towers of HanoiWe have three pegs and a number of disks of different sizes The aim is– We have three pegs and a number of disks of different sizes. The aim is to move from the starting state where all the disks are on the first peg, in size order (smallest at the top) to the goal state where all the pegs are on the third peg also in size orderon the third peg, also in size order.

– We are allowed to move one disk at a time, as long as there are no disks on top of it, and as long as we do not move it on top of a peg that is smaller than itsmaller than it.

• Example 4: Describe and Match– The Describe and Match method for identifying objects is to describe y g j

an object and then search for the same description in a database, which will identify the object. ■

69

Page 70: Artificial Intelligence Artificial Intelligence 人工智慧

Search tree representation used with Describe and match to identify a penguin

70

Page 71: Artificial Intelligence Artificial Intelligence 人工智慧

Chapter 3Knowledge Representation

• Introduction: The need for a good representation• Semantic nets, Inheritance, Frames• Search trees• Problem reduction• Problem reduction

71

Page 72: Artificial Intelligence Artificial Intelligence 人工智慧

Combinatorial ExplosionCombinatorial Explosion

• Problems that involve assigning values to a set of variables can grow exponentially with the number of variables.

• This is the problem of combinatorial explosion.p p• Some such problems can be extremely hard to solve

(NP-Complete, NP-Hard).(NP Complete, NP Hard).• Selecting the correct representation can help to reduce

this as can using heuristics (see chapter 4) ■this, as can using heuristics (see chapter 4). ■

72

Page 73: Artificial Intelligence Artificial Intelligence 人工智慧

Problem ReductionProblem Reduction

• Breaking a problem down into smaller sub-problems (or sub-goals).

• Can be represented using goal trees (or and-or trees).• Nodes in the tree represent sub-problems.Nodes in the tree represent sub problems. • The root node represents the overall problem.

S d d d i ll th i hild• Some nodes are and nodes, meaning all their children must be solved. ■

73

Page 74: Artificial Intelligence Artificial Intelligence 人工智慧

Problem Reduction: Examplep

• E.g. to solve the Towers of Hanoi gproblem with 4 disks, you can first solve the same problem with 3 disks.

• The solution is thus to get from the first diagram on the left, to the second,

d th t l th l tiand then to apply the solution recursively. ■

74

Page 75: Artificial Intelligence Artificial Intelligence 人工智慧

Goal TreesGoal Trees

• Also called and-or trees.• Nodes in the tree represent sub-problems. p p• The root node represents the overall problem.• Some nodes are and nodes meaning all their children• Some nodes are and nodes, meaning all their children

must be solved.A d d i h b d i th• An and-node is shown by drawing an arc across the arcs that join it to its subgoals (children). Or-nodes

t k d i thi ■are not marked in this way. ■

75

Page 76: Artificial Intelligence Artificial Intelligence 人工智慧

And/Or TreeAnd/Or Tree

Goal: Acquire TV

Buy TVSteal TV Buy TVSteal TV

and

Earn MoneyGet Job76

yGet Job

Page 77: Artificial Intelligence Artificial Intelligence 人工智慧

Goal tree for Towers of Hanoi problem with four disks

77

Page 78: Artificial Intelligence Artificial Intelligence 人工智慧

Goal TreesGoal TreesTh i h b ki d• There are two main approaches to breaking down a problem into subgoals—top down and bottom up.A d h i l fi b ki d• A top-down approach involves first breaking down the main problem into smaller goals and then recursively breaking down those goals into smallerrecursively breaking down those goals into smallergoals, and so on, until leaf nodes, or success nodes, are reached which can be solvedreached, which can be solved.

• A bottom-up approach involves first determining all of the subgoals that are necessary to solve the entireof the subgoals that are necessary to solve the entire problem, and then starting solve the success nodes, and working up until the complete solution is found. ■

78

g p p ■

Page 79: Artificial Intelligence Artificial Intelligence 人工智慧

Homework # 1Homework # 1

1. 3.1 (p. 65)2. 3.9 (p. 65)(p )3. 3.10 (p. 65)4 3 13 (p 66)4. 3.13 (p. 66)

Due March 6, 2013

79

Page 80: Artificial Intelligence Artificial Intelligence 人工智慧

Homework # 1Homework # 1

3.1 Why are representations so important in Artificial Intelligence? What risks are inherent in using the wrong representation?

3.9 What is the difference between a top-down approach to solving a problem and a bottom up approach? Into solving a problem and a bottom up approach? In what kinds of situations might each be more appropriate?appropriate?

80

Page 81: Artificial Intelligence Artificial Intelligence 人工智慧

Homework # 1Homework # 1

3.10 Convert the following information into: a) a semantic net)b) a frame-based representation

A Ford is a type of car Bob owns two cars BobA Ford is a type of car. Bob owns two cars. Bob parks his car at home. His house is in California, which is a state Sacramento is the state capital ofwhich is a state. Sacramento is the state capital of California. Cars drive on the freeway, such as Route 101 and Highway 81101 and Highway 81.

81

Page 82: Artificial Intelligence Artificial Intelligence 人工智慧

Homework # 1Homework # 1

3.13 Design a suitable representation and draw the complete search tree for the following problem:A farmer is on one side of a river, and wishes to cross the river with a wolf, a chicken and a bag of grain. f g f gHe can only take one item at a time in his boat with him. He can’t leave the chicken alone with the grain, or it will eat the grain, and he can’t leave the wolf alone with the chicken, or the wolf will eat the chicken. How does he get all three safely across to the other side?

82

Page 83: Artificial Intelligence Artificial Intelligence 人工智慧

LispLisp CLISP ANSI C Li• CLISP – an ANSI Common Lisphttp://sourceforge.net/project/showfiles.php?group_id=1355=1355

• Common Lisp the Language, 2nd Edition by Guy L Steele Jrby Guy L. Steele Jr.http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/clm htmlrepository/ai/html/cltl/clm/clm.html

• Association of Lisp Usershttp://alu org/alu/homehttp://alu.org/alu/home

• http://www.international-lisp-conference org/2012/index html

83

conference.org/2012/index.html