Assignment 2: Inference With Knowledge Using Partial-Order Properties
CSE 415: Introduction to Artificial Intelligence
The University of Washington, Seattle, Spring 2017
The reading for this assignment is Knowledge Representation in The Elements of Artificial Intelligence with Python.
Due Wednesday, April 12 through Catalyst CollectIt at 11:59 PM.
 
Part I. Written Answers (20 points).
  1. Exercise 3 on page 154.
  2. Exercise 4 on page 155.

Part II. ISA Hierarchy Manipulation: Redundancy Handling (80 points) The Python code for a program called Linneus that manages a small knowledge base is available here. Add the features described below to the Linneus program. Hint 1: Draw graphs of the partial orders corresponding to example and analyze how the graph must change in response to each turn of the conversation. Hint 2: All of the indirect transitivity-related redundancy analysis can actually be handled with one general-case method. Then the textual answers from Linneus can be varied depending on the results of that analysis.
  1. direct redundancy detection (30 points). Have Linneus detect potential "direct'' redundancy in the database. Here the redundancy occurs when the newest user statement is implied by existing facts via transitivity or by the reflexive property of ISA.
    > A sockeye is a salmon.
    I understand.
    > A salmon is a fish.
    I understand.
    > A sockeye is a fish.
    You don't have to tell me that.
    > OK
    I don't understand.
    > A spade is a spade.
    You don't have to tell me that.
    > A sockeye is a salmon.
    You told me that earlier.
    
  2. simple indirect redundancy detection (20 points). Have Linneus detect and remove simple indirect redundancy. Here the newest statement makes an earlier statement redundant because the older statement could now be derived using transitivity. This is a simple case involving only three relevant propositions.
    > A hawk is a bird.
    I understand.
    > A hawk is a raptor.  
    I understand.
    > A raptor is a bird.
    Your earlier statement that a hawk is a bird is now redundant.
    
  3. intermediate indirect redundancy detection (20 points). Have Linneus detect and remove indirect redundancy in which a single earlier statement becomes implied by a chain of three or more statements including the newest one.
    > A hawk is a raptor
    I understand.
    > A hawk is an animal
    I understand.
    > A bird is an animal
    I understand.
    > A raptor is a bird
    Your earlier statement that a hawk is an animal is now redundant.
    
  4. complex indirect redundancy detection (10 points). Have Linneus detect and remove multiple indirect redundancies in which any number of earlier statements become implied by chains of two or more statements including the newest one.
    > A chinook is an organism.
    I understand.
    > A sockeye is a salmon.
    I understand.
    > A fish is an animal.
    I understand.
    > A sockeye is an organism.
    I understand.
    > A chinook is an animal.
    I understand.
    > A chinook is a salmon.
    I understand.
    > A sockeye is an animal.
    I understand.
    > A fish is an organism.
    I understand.
    > A salmon is a fish.
    The following statements you made earlier are now all redundant:
    a chinook is an organism;
    a sockeye is an organism;
    a chinook is an animal;
    a sockeye is an animal.
    
Extra Credit Options
(Cycle detection and elimination is worth 10 points of extra credit.)
  • Cycle Detection and Elimination. Because the ISA relation is a partial order, it must obey the antisymmetry property, which states that if x R y and y R x, then x = y. Because of transitivity, this means than in any cycle, such as a R b, b R c, and c R a, it must be the case that a = b = c. When the user inputs statements that form such a cycle, your program should detect that a cycle would be formed by the latest statement, if processed normally. It should report that to the user and then perform the following changes to the database: Determine which node is the starting point in the cycle (for example x when x R y and y R x are input in that order). Make all the other nodes in the cycle become "aliases" of the starting node, and merge them into the starting node. That means any edge involving one of these nodes has one of its endpoints replaced by the starting node. The program should be able to use the aliases in further interactions. An example is given below.
    > A creature is a being.
    I understand.    
    > A being is a living-thing.
    I understand.    
    > A living-thing is a creature.
    I infer that creature, being, and living-things are all names
    for the same thing, and I'll call it creature.
    > A bug is a creature.
    I understand.
    > Is a bug a being?
    Yes.
    > Why is a bug a being?
    Because a bug is a creature, and being is another name for creature.
    > A living-thing is an organism.
    I understand.
    > Is a bug an organism?
    Yes.
    > Why is a bug an organism?
    Because a bug is a creature, and a creature is an organism.
    
What to Turn In

Each student should Turn in a file PartI.txt and a file PartII.py.
Your PartI.txt file should contain your name and the answers to the questions in Part I. Your PartII.py file should begin with a multiline string that gives, on the first line, your name, and on the next four lines, the status of your solutions to the Part II and then an indication of whether you did the extra-credit option. Here is an example.

'''PartII.py
John Doe, CSE 415, Spring 2017, University of Washington
Instructor:  S. Tanimoto.
Assignment 2 Part II.  ISA Hierarchy Manipulation

Status of the implementation of new features:

All forms of redundancy detection and processing are working.
Extra credit (Cycle detection and processing) implemented and working.

'''

The rest of your file PartII.py should contain a version of the Linneus program that provides the implementation of the features according to your status comments.

Updates and Corrections

If necessary, substantial updates and corrections will be posted here and mentioned in class or on GoPost.

Feedback Survey

After submitting your solution, please answer this survey