Top Banner
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012
34

CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Jan 01, 2016

Download

Documents

Jerome Reeves
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: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

CS 4100 Artificial Intelligence

Prof. C. HafnerClass Notes Feb 16, 2012

Page 2: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

AI Planning – 3 approaches

• 1. Strips approach: uses plan operators with preconditions and effects (addlist and deletelist)

• Solves sub-goals (preconditions) sequentially keeping track of all current knowledge as the state changes.

• Flaw: actions to implement a sub-goal must be contiguous, preventing clever solutions when there is subgoal interference.

• 2. Partial order planning uses a graph instead of a tree. “Threat links” can be inserted and resolved by re-ordering the graph mixing actions from different sub-goals.

Page 3: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Remember the “Sussman Anomaly”

State I: (On A Table) (On C A) (On B Table) (Cleartop B) (Cleartop C)

Goal: (On A B) (On B C)

A B

C

A

B

C

Initial State: Goal:

Page 4: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Nets Of Action Hierarchies

on(a, b)

on(b, c)S J

puton(a, b)

puton(b, c)

S J

clear(a)

clear(b)S J

clear(b)

clear(c)S J

Add a “threat” link to the network of plan actions

Page 5: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Resolve threat with an “order” link

puton(a, b)

puton(b, c)

S J

clear(a)

clear(b)S J

clear(b)

clear(c)S J

puton(a, b)

puton(b, c)

S J

clear(a)

clear(b)S J

clear(b)

clear(c)S J

Page 6: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

puton(a, b)

puton(b, c)

S

clear(a)J

clear(b)

clear(c)S J

puton(a, b)

puton(b, c)

S

J

clear(b)

clear(c)S J

puton(c, X)clear(a)

Page 7: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Final plan

puton(a, b)puton(b, c)

Sclear(b)

J

puton(c, X)clear(a)

Page 8: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

3. Planning using logic and resolution: The situation calculus

• Key idea: represent a snapshot of the world, called a ‘situation’ or ‘state’ using first order logic (FOL) sentences.

• ‘Fluents’ are statements that are true or false in a given world state, but can change e.g. ‘I am at home’

• States are object in the model space which constants, variables, and functions can reference.

• Actions are FOL functions that map states to states.

• A Result predicate exists to express the effects of actions

Page 9: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

To build a world model: Ontology DesignEspecially relevant to situation calculus

• What kinds of objects exist?• What relationships?• What kinds of events and actions can occur ?• How do these change the world ?• How do we structure our models effectively ?• The Protégé tool for specifying Ontologies and World

Models

(Then we will return to the last Planning topic)

Page 10: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Major Elements of Ontologies

• Types (categories, concepts) and individuals1. Entities or things (concrete or abstract, physical or

social)• People, objects, universities , fields of study, . . . • Wines (Read or Re-read: Ontology 101 paper)

2. Events, actions , and processes• To model traveling, commerce, education, cooking, crime,

politics, sports . . .• Types are organized into subclass/superclass taxonomies• Types can have individuals (instances) that are

members of the type

Page 11: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Major Elements of Ontologies

• Types (categories, concepts) and individuals (cont.)3. Relationships

• Part-of relations (substructure, ingredient . . . )• Propertieses (hair color, height, weight)• Role relations (author of a book, victim of a crime)• Spatial relations• Many other types of relationships

• Types are organized into subclass/superclass taxonomies• Types can have individuals (instances) that are

members of the type

Page 12: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Reasoning with Ontologies• Taxonomic relationships relationships are transitive

– If X isa Y and Y isa Z then X isa Z

• Part-of relationships are also transitive– If X ispart Y and Y ispart Z then

X ispart Z• Inheritance of relationships through the taxonomy

– If Z hasa (part or role) Y and X isa Z thenX hasa Y

• Examples:– Human isa primate, primate isa mammal– Primate haspart arm, arm haspart hand– Crime hasa victim, murder isa crime

Page 13: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Ontology Design• Ontologies define entities, events and relations as top-level categories

• Every ontology includes a taxonomy (a tangled tree of ISA-linked concepts)

• A true ontology also defines the structure of each concept (its slots), consisting of its properties, parts and roles (whose fillers are also concepts)

• Some ontologies also include logical rules of conceptual syntax (how to form more complex concepts out of more primitive ones using various operators. Example: restrictive modification such as middle-aged adult)

Page 14: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Entity classesEx: person, number, chairchair has a seat partperson has a sex property

Event classesEx: an election, a concert, a murderevents have time properties and roles (victim, candidate)physical events have location and time

Relation classesEx: employment, marriage, above(Traditional) marriage has roles: husband, wife

filler class of husband = male humanfiller class of wife = female human

The goal of ontology design: formally represent meaning so a computer can manipulate it.

Page 15: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

The importance of taxonomies• Topic taxonomy (Library Science) – supports

search• Taxonomy of living things (Biology) – expresses

and communicates scientific knowledge• AI taxonomy – supports automated reasoning• Domain taxonomy (Information Systems;

semantic web) – supports intelligent IR and application design

• LCC library of congress classification outline (printed in 41 volumes, more than 200,000 topics)

Page 16: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.
Page 17: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.
Page 18: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.
Page 19: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.
Page 20: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

University Degree Taxonomy (tangled)

Degree

UndergradDegree

GraduateDegree

Science Degree Humanities Degree

Biology Degree

MS. in Biology

Page 21: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

For a general knowledge ontology, we need frameworks for formalizing:-- physical attributes (substances (liquid, solid, gas), shapes)

-- time (points, intervals, units, durations, time properties of events, axioms for temporal reasoning)

-- places and positions; spaces and objects

-- qualities, quantities and measurements

-- motion, change and causality

-- human activities, motivations, typical behavior

This requires hundreds of thousands/millions of concepts and associations. But for specific tasks we can create domain and task ontologies with a manageable number of concepts. 

Page 22: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

• Every database schema is a domain ontology

• Every time you design an OO Program with some classes you are creating a domain or task ontology

• Many web sites embody (implictly or explicitly) a domain ontology; for example a University web site probably has a concept: degree programs, arranged in a (possibly tangled) taxonomy.

Page 23: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Seven steps to creating an ontology

1. Determine domain and scope2. Consider re-using existing ontologies3. Enumerate important concepts4. Define the classes and class hierarchy (taxonomy)5. Define the properties, parts and roles (slots)6. Define the facets of the slots7. Create instances

Wine example from Noy & McGuinness, Ontology 101

We will continue this later with examples from Protégé showing how to build an ontology with this tool.

Page 24: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Return to the situation calculus

• Key idea: represent a snapshot of the world, called a ‘situation’ or ‘state’ using first order logic (FOL) sentences.

• ‘Fluents’ are statements that are true or false in a given world state, but can change e.g. ‘I am at home’

• States are object in the model space which constants, variables, and functions can reference.

• FOL functions apply to objects to represent an action

• A Result function exists to map action X state state

Page 25: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Blocks world dynamics

• Move function represents an action: Move(x, loc)• Use of the Result function:

Result(Move(x, loc), si) the state resulting from doing the Move action from si

• Given an axiom about moving things: x loc s [ At(x, loc, Result(Move(x, loc), s)) ]“If you move some object to a location, then in the resulting

state that object is at that location• At(B1, Top(B2), Result(Move(B1, Top(B2)), S0)) can be proved using Universal Instantiation (UI) - substituting

ground (variable-free) terms for universally quantified variables

Page 26: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Monkeys and Bananas Problem

• The monkey-and-bananas problem is faced by a monkey standing under some bananas which are hanging out of reach from the ceiling. There is a box in the corner of the room that will enable the monkey to reach the bananas if he climbs on it.

• Use situation calculus to represent this problem and solve it using resolution theorem proving.

Page 27: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Ontology for Monkey/Banana problem• Fluents: Constants:

– At(x, loc, s) - BANANAS– On(x, y, s) - MONKEY– Reachable(x, Bananas, s) - BOX– Has(x, y, s) - S0

• Other predicates - CORNER– Moveable(x), Climbable(x) - UNDER-BANANAS– Can-move(x)

• Actions– Climb-on(x, y) -- Move(x, loc)– Reach(x, y) -- Push(x, y, loc)

Page 28: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Monkey/Bananas axioms in Situation Calculus

1. ∀ x1, s1 [ Reachable(x1, BANANAS, s1) Has(x1, BANANAS, Result(Reach(x1, BANANAS),

s1)) ]If a person can reach the bananas then the result of reaching them is to

have them.

2. ∀ s2 [At(BOX, UNDER-BANANAS, s2) ^ On(MONKEY, BOX, s2) Reachable(MONKEY,

BANANAS, s2)

If a box is under the bananas and the monkey is on the box then the monkey can reach the bananas.

Page 29: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Monkey/Bananas axioms3. ∀ x3, loc3, s3 [ Can-move(x3)

At(x3, loc, Result(Move(x3, loc3), s3)) ]The result of moving to a location is to be at that location

4. ∀ x4, y4, s4 [∃ loc4 [At(x4, loc4, s4) ^ At(y4, loc4, s4)] ^ Climbable(y4) On(x4, y4, Result(Climb-on(x4, y4), s4))]

The result of climbing on an object is to be on the object

5. ∀ x5, y5, loc5, s5 [∃ loc [At(x, loc0, s) ^ At(y5, loc0, s5) ] ^ Moveable(y5) At(y5, loc5, Result(Push(x5, y5, loc5), s5))

6. <same> At(x6, loc6, Result(Push(x6, y6, loc6), s6)) ]The result of x pushing y to a location is both x and y are at that

location.

Page 30: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Monkey/Bananas axioms (initial state S0)F1. Moveable(BOX)F2. Climbable(BOX)F3. Can-move(MONKEY)F4. At(BOX, CORNER, S0)F5. At(MONKEY, UNDER-BANANAS, S0)

• To solve this for the goal Has(MONKEY, BANANAS, s): – Convert to clause form– Apply resolution to prove something like this:

Has(MONKEY, BANANAS, Result(Reach( . . . ), Result(. .) . .), S0)which gives you the plan in reverse order.(don’t forget to standardize!)

We need 2 additional “frame axioms” for the proof

Page 31: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

A Limitation of Situation Calculus: The Frame problem

• I go from home (S) to the store, creating a new situation S’. In S’:– My friend is still at home– The store still sells chips– My age is still the same– Los Angeles is still the largest city in California…

• How can we efficiently represent everything that hasn’t changed?

Page 32: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Successor state axioms

• Normally, things stay true from one state to the next --unless an action changes them:

At(p, loc, Result(a, s)) iff a = Go(p, x) or [At(p, loc, s) and a != Go(p,

y)]

• We need one or more of these for every fluent

• Now we can use theorem proving (or possibly backward chaining) to deduce a plan: not very practical

Page 33: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Frame Axioms for Monkey/Bananas world

7. ∀ x, y, loc, s [ At(x, loc, s) At(x, loc, Result(Move(y, loc), s)) ]

The location of an object does not change as a result of someone moving to the same location.

8. ∀ x, y, loc, s [ At(x, loc, s) At(x, loc, Result(Climb-on(y, x), s)) ]

The location of an object does not change as a result of someone climbing on it.

Page 34: CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012.

Refutation Resolution as the theoretical basis of BC

A query is conceptualized with existential variables:? Likes(John, x) means ? x Likes(John, x) ∃

to answer the question, assert its NEGATION, and attempt to derive a contradiction by RESOLVING TO THE EMPTY CLAUSE!

~ x Likes(John, x) is equivalent to x ~ Likes(John, x), so add that to ∃ ∀the KB and try to derive the empty clause

Resolution rule: [A1 V A2 V . . . An] ^ [B1 V B2 V . . Bm V ~A1’] where A1 and A1’ unify---------------------------------------------------------------[ A2’ V . . . An’ ] ^ [B1’ V B2’ V . . . Bm’]

Likes(John, Pizza) ^ ~ Likes(John, x) resolves to { }, given {x/Pizza}