CS 4100 Artificial Intelligence Prof C Hafner Class

  • Slides: 34
Download presentation
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Feb 16, 2012

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

AI Planning – 3 approaches • 1. Strips approach: uses plan operators with preconditions

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.

Remember the “Sussman Anomaly” Initial State: Goal: A C A B B C State

Remember the “Sussman Anomaly” Initial State: Goal: A C A B B C State I: (On A Table) (On C A) (On B Table) (Cleartop B) (Cleartop C) Goal: (On A B) (On B C)

Nets Of Action Hierarchies on(a, b) S J on(b, c) clear(a) S S clear(b)

Nets Of Action Hierarchies on(a, b) S J on(b, c) clear(a) S S clear(b) J puton(a, b) J clear(b) S clear(c) J puton(b, c) Add a “threat” link to the network of plan actions

Resolve threat with an “order” link clear(a) S S clear(b) J puton(a, b) J

Resolve threat with an “order” link clear(a) S S clear(b) J puton(a, b) J clear(b) S clear(c) J puton(b, c) J puton(a, b) clear(a) S S clear(b) J clear(b) S clear(c) J puton(b, c)

clear(a) S J puton(a, b) clear(b) S J clear(c) puton(b, c) puton(c, X) clear(a)

clear(a) S J puton(a, b) clear(b) S J clear(c) puton(b, c) puton(c, X) clear(a) J S clear(b) S clear(c) J puton(b, c) puton(a, b)

Final plan puton(c, X) clear(a) J S clear(b) puton(b, c) puton(a, b)

Final plan puton(c, X) clear(a) J S clear(b) puton(b, c) puton(a, b)

3. Planning using logic and resolution: The situation calculus • Key idea: represent a

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

To build a world model: Ontology Design Especially relevant to situation calculus • •

To build a world model: Ontology Design Especially 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)

Major Elements of Ontologies • Types (categories, concepts) and individuals 1. Entities or things

Major Elements of Ontologies • Types (categories, concepts) and individuals 1. 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

Major Elements of Ontologies • Types (categories, concepts) and individuals (cont. ) 3. Relationships

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

Reasoning with Ontologies • Taxonomic relationships are transitive – If X isa Y and

Reasoning with Ontologies • Taxonomic 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 then X hasa Y • Examples: – Human isa primate, primate isa mammal – Primate haspart arm, arm haspart hand – Crime hasa victim, murder isa crime

Ontology Design • Ontologies define entities, events and relations as toplevel categories • Every

Ontology Design • Ontologies define entities, events and relations as toplevel 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)

Entity classes Ex: person, number, chair has a seat part person has a sex

Entity classes Ex: person, number, chair has a seat part person has a sex property Event classes Ex: an election, a concert, a murder events have time properties and roles (victim, candidate) physical events have location and time Relation classes Ex: employment, marriage, above (Traditional) marriage has roles: husband, wife filler class of husband = male human filler class of wife = female human The goal of ontology design: formally represent meaning so a computer can manipulate it.

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

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)

University Degree Taxonomy (tangled) Degree Undergrad Degree Graduate Degree Science Degree Biology Degree MS.

University Degree Taxonomy (tangled) Degree Undergrad Degree Graduate Degree Science Degree Biology Degree MS. in Biology Humanities Degree

For a general knowledge ontology, we need frameworks formalizing: -- physical attributes (substances (liquid,

For a general knowledge ontology, we need frameworks 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.

 • Every database schema is a domain ontology • Every time you design

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

Seven steps to creating an ontology 1. 2. 3. 4. 5. 6. 7. Determine

Seven steps to creating an ontology 1. 2. 3. 4. 5. 6. 7. Determine domain and scope Consider re-using existing ontologies Enumerate important concepts Define the classes and class hierarchy (taxonomy) Define the properties, parts and roles (slots) Define the facets of the slots Create instances Wine example from Noy & Mc. Guinness, Ontology 101 We will continue this later with examples from Protégé showing how to build an ontology with this tool.

Return to the situation calculus • Key idea: represent a snapshot of the world,

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

Blocks world dynamics • Move function represents an action: Move(x, loc) • Use of

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(B 1, Top(B 2), Result(Move(B 1, Top(B 2)), S 0)) can be proved using Universal Instantiation (UI) - substituting ground (variable-free) terms for universally quantified variables

Monkeys and Bananas Problem • The monkey-and-bananas problem is faced by a monkey standing

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.

Ontology for Monkey/Banana problem • Fluents: – At(x, loc, s) – On(x, y, s)

Ontology for Monkey/Banana problem • Fluents: – At(x, loc, s) – On(x, y, s) – Reachable(x, Bananas, s) – Has(x, y, s) • Other predicates – Moveable(x), Climbable(x) – Can-move(x) • Actions – Climb-on(x, y) – Reach(x, y) Constants: - BANANAS - MONKEY - BOX - S 0 - CORNER - UNDER-BANANAS -- Move(x, loc) -- Push(x, y, loc)

Monkey/Bananas axioms in Situation Calculus 1. ∀ x 1, s 1 [ Reachable(x 1,

Monkey/Bananas axioms in Situation Calculus 1. ∀ x 1, s 1 [ Reachable(x 1, BANANAS, s 1) Has(x 1, BANANAS, Result(Reach(x 1, BANANAS), s 1)) ] If a person can reach the bananas then the result of reaching them is to have them. 2. ∀ s 2 [At(BOX, UNDER-BANANAS, s 2) ^ On(MONKEY, BOX, s 2) Reachable(MONKEY, BANANAS, s 2) If a box is under the bananas and the monkey is on the box then the monkey can reach the bananas.

Monkey/Bananas axioms 3. ∀ x 3, loc 3, s 3 [ Can-move(x 3) At(x

Monkey/Bananas axioms 3. ∀ x 3, loc 3, s 3 [ Can-move(x 3) At(x 3, loc, Result(Move(x 3, loc 3), s 3)) ] The result of moving to a location is to be at that location 4. ∀ x 4, y 4, s 4 [∃ loc 4 [At(x 4, loc 4, s 4) ^ At(y 4, loc 4, s 4)] ^ Climbable(y 4) On(x 4, y 4, Result(Climb-on(x 4, y 4), s 4))] The result of climbing on an object is to be on the object 5. ∀ x 5, y 5, loc 5, s 5 [∃ loc [At(x, loc 0, s) ^ At(y 5, loc 0, s 5) ] ^ Moveable(y 5) At(y 5, loc 5, Result(Push(x 5, y 5, loc 5), s 5)) 6. <same> At(x 6, loc 6, Result(Push(x 6, y 6, loc 6), s 6)) ] The result of x pushing y to a location is both x and y are at that location.

Monkey/Bananas axioms (initial state S 0) F 1. Moveable(BOX) F 2. Climbable(BOX) F 3.

Monkey/Bananas axioms (initial state S 0) F 1. Moveable(BOX) F 2. Climbable(BOX) F 3. Can-move(MONKEY) F 4. At(BOX, CORNER, S 0) F 5. At(MONKEY, UNDER-BANANAS, S 0) • 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(. . ), S 0) which gives you the plan in reverse order. (don’t forget to standardize!) We need 2 additional “frame axioms” for the proof

A Limitation of Situation Calculus: The Frame problem • I go from home (S)

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?

Successor state axioms • Normally, things stay true from one state to the next

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

Frame Axioms for Monkey/Bananas world 7. ∀ x, y, loc, s [ At(x, loc,

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.

Refutation Resolution as theoretical basis of BC A query is conceptualized with existential variables:

Refutation Resolution as 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: [A 1 V A 2 V. . . An] ^ [B 1 V B 2 V. . Bm V ~A 1’] where A 1 and A 1’ unify -------------------------------[ A 2’ V. . . An’ ] ^ [B 1’ V B 2’ V. . . Bm’] Likes(John, Pizza) ^ ~ Likes(John, x) resolves to { }, given {x/Pizza}