Assignment #1

Assignment #1

1. Read Chapters 1-6
The first part of the book focuses on the artificial intelligence algorithms and techniques used to make applications and agents intelligent. Covering chapters one through six of the textbook we discovered:
• The history of artificial intelligence research and the basic concepts of both symbol processing and neural networks.
• problem solving using search and state-based definitions and how common AI search strategies such as breadth-first, depth-first, and best-first search can be used to find solutions to problems.
• How knowledge representation is used in AI systems including concepts of propositional and predicate logic, frames, and semantic networks. How standards are evolving to support knowledge representation including, the Knowledge Interchange Format (KIF).
• The use of reasoning systems, specifically rule-based systems, and what the basic elements of a rule are. How to relate those concepts to forward chaining and backward chaining with rules. We also explored Fuzzy rule systems that combine rules and fuzzy logic.
• What learning and adaptive techniques are and why they are beneficial in constructing intelligent agents. We looked at the major learning patterns including supervised, unsupervised, and reinforcement learning and were introduced to neural networks, back propagation networks, and self-organizing feature maps. We also looked at how information theory is used to build decision trees using induction.
• How to expand upon the basic techniques and bring intelligence to the agents by considering additional concepts like; the environment, motivation, perception, and actions. We examined the additional complexities introduced my deploying multiple agents such as; common languages, communication, and cooperation.

2. Implement the “RuleApp” Java application. Demonstrate the running of the program with sample outputs showing how it performed for the given inputs and rules. Make a few small changes to the rules and show results.

I researched several different Java development environments and quickly narrowed the search to two products that dominate the market. Both Eclipse and NetBeans are available at no cost, full-featured, and have a strong community of support. After reading several reviews and articles I chose to go with NetBeans because it offers all the features I needed to get working immediately and has the full support of Sun Microsystems behind it.

The source code provided in the book was developed when Java was at version 1.3. The current version is 1.6 and this caused a few small issues as some of the keywords and usages have changed; notably enum and assert. This turned out to be a minor matter of configuring the compiler to accept source version level of 1.3. The application compiled as a .jar file and when executed looked as follows:
Rule Base Application
I tested the application by providing several values for a sports car; doors=2, wheels=4, motor=yes and asked it to solve for the goal of vehicle using forward chaining. It was unable to resolve the problem based on these factors alone. The automobile rule fired based on the motor=yes but no further rules fired yielding a null result.

Examining the rule base it is easy to determine the cause of failure. To determine the truth of vehicle=sporstcar requires a size=small antecedent clause. Further examination of the rule base identifies an inconsistency with how the rules are defined. While it is possible to define a vehicle type of cycle from the values of motor and num_wheels alone there is no constraint on the program to ensure the user provides an entry for num_doors if the vehicle type is reasoned to be an automobile. This is a limitation of forward chaining. There is no method to ask for additional information

I reset the application for backward chaining and restarted it. This time the program was intelligent enough to realize it needed the size variable to complete the reasoning chain and it prompted me for the value.
Ask For Value
Whereupon receipt of this key piece of information was then able to successfully evaluate the sports Car rule:
Backward Chaining Success
I decided to improve the vehicle rule base so that forward chaining could also resolve this problem. So I attempted to modify the sportsCar rule from:



However, after digging through the code and re-reading page 110 in the book I find that the implementation does not support disjunctions between clauses. Implementing an OR capability would appear to be a significant amount of work. The current strategy is that you could have many (up to 4 as I recall) antecedent clauses through which the Rule check() method simply iterates trying to prove them all true (AND). To provide an OR capability implies that you should deal with a rule that might have both AND /OR logic. This would require grouping of clauses and independent evaluation of those groupings.

So, I decided to simply add my own rule;


that required only a single antecedent clause. According to the code my rule would not qualify as the best rule but should still get evaluated if the best rule failed.

This is in fact what happened:


And the result was successfully attained:
New Rules
To expand on this theme I decided to add a new rule.


To support this I had to implement a Cool Factor antecedent:


This modification works in both forward and backward chaining:
It's a COOL car!
3. Do Problems 4-6 at the end of Chapter 4.

Problem 4 – Early expert systems used confidence factors with Boolean rules to reason about uncertainty. How do fuzzy rule systems overcome this issue, or do they? What is the difference between a probability and a fuzzy number?

The goal of an expert system is to simulate the reasoning process that a human expert pursues in analyzing a problem and arriving at a conclusion. One method of dealing with uncertainty is through the use of numeric values called confidences. These numbers are similar in nature to probabilities, but they are not the same. They are meant to imitate the confidences humans use in reasoning rather than to follow the mathematical definitions used in calculating probabilities.

The textbook is careful to differentiate that probability theory deals with the chance or likelihood that an event will occur, whereas, fuzzy logic deals with the degree to which an event occurs. Fuzzy logic is an organized and mathematical method of handling inherently imprecise concepts. The concept of “coldness” cannot be expressed in an equation, because although temperature is a quantity, “coldness” is not.

So confidence factors and fuzzy logic both deal with degrees of truth but in different ways; they are conceptually distinct. A confidence factor attempts to deliver a measurement of how sure, or certain, you are about a conclusion. Contrast this with fuzzy logic which attempts to represents a level of membership in some vaguely defined set such as coldness. Fuzzy logic allows for set membership values between and including 0 and 1, and in its linguistic form, imprecise concepts like “slightly cold”, “quite cold” and “very cold”. Specifically, it allows partial membership in a set.

Therefore, I would not say that fuzzy logic overcomes, or is better than confidence factors; rather, it adds an additional toolset that can be used by the AI programmer to more accurately model an expert system.

Problem 5 – The Motor fuzzy rule base uses four rules to cover the input space of temperature and humidity. Use the RuleApp to enter values over the entire range (0-100) for these variables and plot the motor output value. Does the output change smoothly or jump abruptly as the input values change? Add more rules to the motor rule base, and check the effect on the motor variable. Would adding more fuzzy sets or using other linguistic hedges help to smooth the output response?

I was unable to get the RuleApp to generate consistent values. I did discover the necessity of pressing the enter key after inputing values for the temp and humidity variables so the program would accept them. Nevertheless, when I setup a fixed temp value of 72 and varied the humidity values in intervals of 10 from 1-100, I received the exact same value back from the program. Further experiments included varying the temp from very hot (90) to very cold (20) with a fixed humidity. This also produced inconsistent results. I do not have enough Java coding experience to decipher the code and find out what is wrong.

However, from reading the text I determined that the resulting values should change smoothly based on the fact that the program is using a centroid method for defuzzification.

* Defuzzification method.
* The value of this constant specifies the defuzzification method used
* when the defuzzification method is not explicitly set by the user.

In this implementation, the default is set to Centroid.
final static public int DefuzzifyMethodDefault = CENTROID;

I did not attempt to add any rules to the application since it is not working properly.

A linguistic hedge is an operation that modifies the meaning of the term or fuzzy set. Hedges play the same role in fuzzy production rules that adjectives and adverbs play in English sentences. There are hedges that intensify characteristics of a fuzzy set (very, extremely), dilute fuzzy sets (somewhat, rather) or form a complement (not). So, I would think that dilute fuzzy sets would smooth the output but those that intensify would not.

Problem 6 – You have to create a system to diagnose problems with an engine. A mechanic is available to act as the expert. Your job is to take his knowledge and turn it into rules. The application must make a best-guess diagnosis based on the available data. As more information is available, the diagnosis should be more accurate. Would you choose Boolean or fuzzy rules for this application? Why?

I would choose fuzzy rules for this application because an automotive engine is a complex system. There are many subsystems (fuel, ignition, air) which contribute to the optimum performance and these interactions are complex. There are cases where a diagnosis is simple, something works or doesn’t, but that is more the exception than the rule. An experienced mechanic will reason through the process using fuzzy logic by examining the relationship between the symptoms and diagnosis, instead of relying on the mathematical propagation of probabilities.

The use of linguistic hedges, as noted above, would play an extremely important role in defining the rule set.

4. Create a web page to post your assignments on.

See: (you’re looking at it eh?)